Hi. It's some time I implemented first version of IPA ICF pass. Since that I experienced more with the GCC internals and now is the right time to do an overhaul.
Main motivation of changes is to share as many as possible in between current operand_equal_p and ipa_icf::compare_operand. That's achieved by a new class operand_compare. That allows use to share and unify a lot of code. Apart from that I would like to learn current operand_equal_p to handle new tree types. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. I also built Firefox, Godot engine. Thanks, Martin Martin Liska (9): Replace int with boolean in predicate functions. operand_equal_p: add support for FIELD_DECL operand_equal_p: add support for OBJ_TYPE_REF. Strengthen alias_ptr_types_compatible_p in LTO mode. Come up with an abstraction. Integrate that for IPA ICF. IPA ICF: remove dead code Remove comparison for polymorphic types. Remove alias set comparison. gcc/alias.c | 7 +- gcc/fold-const.c | 547 +++++++++++++++--- gcc/fold-const.h | 30 +- gcc/ipa-icf-gimple.c | 328 ++--------- gcc/ipa-icf-gimple.h | 16 +- gcc/ipa-icf.c | 19 +- gcc/ipa-icf.h | 3 - .../c-c++-common/Wstringop-truncation-4.c | 2 +- gcc/testsuite/gcc.dg/ipa/ipa-icf-40.c | 32 + gcc/testsuite/gcc.dg/{torture => }/pr70740.c | 3 +- gcc/testsuite/gcc.dg/tree-ssa/pr64910-2.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr79352.c | 2 +- gcc/testsuite/gcc.dg/vect/vect-35-big-array.c | 3 +- gcc/testsuite/gcc.dg/vect/vect-35.c | 3 +- gcc/testsuite/gfortran.dg/vect/vect-8.f90 | 2 +- gcc/tree.c | 273 --------- 16 files changed, 588 insertions(+), 684 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/ipa/ipa-icf-40.c rename gcc/testsuite/gcc.dg/{torture => }/pr70740.c (77%) -- 2.22.0