https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92535
--- Comment #14 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
I fixed some issues
1) merging of OBJ_TYPE_REF was broken
2) last version of my COMPONENT_REF patch clears incorrectly OEP_ADDRESS_OF
3) gimple clobbers mismatches for no good reason
4) volatile memory references can are never considered equal
5) alignment of memory accesses is not hashed and may cause late mismatch
(common in vector code)
With this I get
141 false returned: 'Declaration mismatch' in equals at
../../gcc/ipa-icf.c:1817
162 false returned: 'DECL_CXX_DESTRUCTOR mismatch' in equals_wpa at
../../gcc/ipa-icf.c:565
169 false returned: '' in compare_decl at ../../gcc/ipa-icf-gimple.c:162
246 false returned: 'final flag mismatch' in
compare_referenced_symbol_properties at ../../gcc/ipa-icf.c:401
380 false returned: '' in compare_phi_node at ../../gcc/ipa-icf.c:1595
380 false returned: 'PHI node comparison returns false' in equals_private
at ../../gcc/ipa-icf.c:916
513 false returned: 'different decl attributes' in equals_wpa at
../../gcc/ipa-icf.c:662
571 false returned: 'compare_ao_refs failed (dependence clique
difference)' in compare_operand at ../../gcc/ipa-icf-gimple.c:368
811 false returned: 'GIMPLE call operands are different' in
compare_gimple_call at ../../gcc/ipa-icf-gimple.c:676
912 false returned: 'different references' in compare_symbol_references
at ../../gcc/ipa-icf.c:465
961 false returned: 'size mismatch' in equals_wpa at
../../gcc/ipa-icf.c:1666
1125 false returned: 'variables types are different' in equals at
../../gcc/ipa-icf.c:1712
1129 false returned: 'DECL_CXX_CONSTRUCTOR mismatch' in equals_wpa at
../../gcc/ipa-icf.c:562
1453 false returned: 'operand_equal_p failed' in compare_operand at
../../gcc/ipa-icf-gimple.c:376
2917 false returned: 'compare_ao_refs failed (semantic difference)' in
compare_operand at ../../gcc/ipa-icf-gimple.c:356
3362 false returned: 'ctor polymorphic type mismatch' in equals_wpa at
../../gcc/ipa-icf.c:585
3527 false returned: '' in compare_decl at ../../gcc/ipa-icf-gimple.c:157
3535 false returned: '' in compare_variable_decl at
../../gcc/ipa-icf-gimple.c:442
3535 false returned: '' in operand_equal_p at
../../gcc/ipa-icf-gimple.c:307
3563 false returned: 'GIMPLE assignment operands are different' in
compare_gimple_assign at ../../gcc/ipa-icf-gimple.c:719
4604 false returned: 'GIMPLE LHS type mismatch' in compare_gimple_assign
at ../../gcc/ipa-icf-gimple.c:715
6577 false returned: 'parameter type is not compatible' in
compatible_parm_types_p at ../../gcc/ipa-icf.c:512
8441 false returned: 'inline attributes are different' in
compare_referenced_symbol_properties at ../../gcc/ipa-icf.c:350
11259 false returned: 'parameter types are not compatible' in equals_wpa at
../../gcc/ipa-icf.c:639
25276 false returned: 'different tree types' in compatible_types_p at
../../gcc/ipa-icf-gimple.c:206
26073 false returned: 'references to virtual tables cannot be merged' in
compare_referenced_symbol_properties at ../../gcc/ipa-icf.c:373
26693 false returned: 'decl_or_type flags are different' in equals_wpa at
../../gcc/ipa-icf.c:572
61657 false returned: 'call function types are not compatible' in
compare_gimple_call at ../../gcc/ipa-icf-gimple.c:655
70880 false returned: '' in equals_private at ../../gcc/ipa-icf.c:881
104034 false returned: 'types are not compatible' in compatible_types_p at
../../gcc/ipa-icf-gimple.c:212
113477 false returned: 'result types are different' in equals_wpa at
../../gcc/ipa-icf.c:621
410680 false returned: 'THIS pointer ODR type of cdtor mismatch' in
equals_wpa at ../../gcc/ipa-icf.c:673
414222 false returned: 'types are not same for ODR' in
compatible_polymorphic_types_p at ../../gcc/ipa-icf-gimple.c:197
and more code size savings
VM SIZE FILE SIZE
++++++++++++++ GROWING ++++++++++++++
[ = ] 0 .strtab +439Ki +1.0%
[ = ] 0 .symtab +73.4Ki +0.4%
+0.0% +32 .data +32 +0.0%
-------------- SHRINKING --------------
-2.9% -2.67Mi .text -2.67Mi -2.9%
-6.3% -555Ki .eh_frame -555Ki -6.3%
-7.8% -148Ki .eh_frame_hdr -148Ki -7.8%
-0.4% -78.2Ki .rodata -78.2Ki -0.4%
-0.5% -58.8Ki .rela.dyn -58.8Ki -0.5%
-0.4% -15.0Ki .data.rel.ro.local -15.0Ki -0.4%
-1.0% -10.4Ki .data.rel.ro -10.4Ki -1.0%
-0.0% -64 .bss 0 [ = ]
-0.4% -32 .gcc_except_table -32 -0.4%
-+-+-+-+-+-+-+ MIXED +-+-+-+-+-+-+-
+14% +40 [Unmapped] -1.40Ki -42.6%
-2.3% -3.51Mi TOTAL -3.01Mi -1.4%
ICF still take quite some memory:
ipa lto gimple in : 5.82 ( 4%) 2.10 ( 15%) 8.05 ( 5%)
776M ( 12%)
ipa lto gimple out : 1.52 ( 1%) 0.69 ( 5%) 2.23 ( 1%)
0 ( 0%)
ipa icf : 11.64 ( 7%) 0.51 ( 4%) 12.23 ( 7%)
43M ( 1%)
TOTAL : 163.47 13.69 177.49
6537M
So about 100 reduction and ICF got faster. It also improved the chance that
functions read in are actually merged.
The times are not 100% comparable to my previous report since my earlier build
was with profiledbootstrap while now I bootstrapped the normal way.
There are still quite many nonsences. In particular
1) we could enable merging different polymorphic ODR types of this pointers.
Late devitualization is not that important, but we would need to have way
to notice such merges. This is discussed in thread
https://gcc.gnu.org/pipermail/gcc-patches/2020-November/559573.html
2) result types, operand types and ODR types can be hashed in before the
equals_wpa process start to avoid refining the partitions (that should get rid
of good part of ipa-icf time that now seems to be dominated by equal_wpa and
fibonaci heap)
3) we should be able to do something about call operand types compare - it is
way too sensitive.
4) gimple LHS type test is overactive. I see it is needed for conversions but
it is not needed otherwise.
5) we do bad job on hashing SSA_NAMES. In Firefox there seems to be quite few
functions that differs only by permutation of parameters or permutation of
parameters of callee which we do not see as a difference in hash functions