]> git.ipfire.org Git - thirdparty/gcc.git/commit
ipa: Compare jump functions in ICF (PR 113907)
authorMartin Jambor <mjambor@suse.cz>
Mon, 8 Apr 2024 16:53:23 +0000 (18:53 +0200)
committerMartin Jambor <mjambor@suse.cz>
Mon, 8 Apr 2024 16:54:08 +0000 (18:54 +0200)
commit1162861439fd3c4b30fc3ccd49462e47e876f04a
tree691deb4535860ebc28343bf4da7330506d08f5fd
parentfeb6a2d3569095706170c9400e93add27a66e034
ipa: Compare jump functions in ICF (PR 113907)

In PR 113907 comment #58, Honza found a case where ICF thinks bodies
of functions are equivalent but becaise of difference in aliases in a
memory access, different aggregate jump functions are associated with
supposedly equivalent call statements.  This patch adds a way to
compare jump functions and plugs it into ICF to avoid the issue.

gcc/ChangeLog:

2024-03-20  Martin Jambor  <mjambor@suse.cz>

PR ipa/113907
* ipa-prop.h (class ipa_vr): Declare new overload of a member function
equal_p.
(ipa_jump_functions_equivalent_p): Declare.
* ipa-prop.cc (ipa_vr::equal_p): New function.
(ipa_agg_pass_through_jf_equivalent_p): Likewise.
(ipa_agg_jump_functions_equivalent_p): Likewise.
(ipa_jump_functions_equivalent_p): Likewise.
* ipa-cp.h (values_equal_for_ipcp_p): Declare.
* ipa-cp.cc (values_equal_for_ipcp_p): Make function public.
* ipa-icf-gimple.cc: Include alloc-pool.h, symbol-summary.h, sreal.h,
ipa-cp.h and ipa-prop.h.
(func_checker::compare_gimple_call): Comapre jump functions.

gcc/testsuite/ChangeLog:

2024-03-20  Martin Jambor  <mjambor@suse.cz>

PR ipa/113907
* gcc.dg/lto/pr113907_0.c: New.
* gcc.dg/lto/pr113907_1.c: Likewise.
* gcc.dg/lto/pr113907_2.c: Likewise.
gcc/ipa-cp.cc
gcc/ipa-cp.h
gcc/ipa-icf-gimple.cc
gcc/ipa-prop.cc
gcc/ipa-prop.h
gcc/testsuite/gcc.dg/lto/pr113907_0.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr113907_1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr113907_2.c [new file with mode: 0644]