]> git.ipfire.org Git - thirdparty/gcc.git/commit
icf: Check return type of internal fn calls [PR99517]
authorJakub Jelinek <jakub@redhat.com>
Thu, 11 Mar 2021 09:59:18 +0000 (10:59 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 11 Mar 2021 09:59:18 +0000 (10:59 +0100)
commit070ab283d16d8e8e8bb70f9801aca347f008cbd0
treea5c04f1c66814c685331894991a0e9676491b400
parentaa27696b798b34730f5266cac2adba9178ebc3ae
icf: Check return type of internal fn calls [PR99517]

The following testcase is miscompiled, because IPA-ICF considers the two
functions identical.  They aren't, the types of the .VEC_CONVERT call
lhs is different.  But for calls to internal functions, there is no
fntype nor callee with a function type to compare, so all we compare
is just the ifn, arguments and some call flags.

The following patch fixes it by checking the internal fn calls like e.g. gimple
assignments where the type of the lhs is checked too.

2021-03-11  Jakub Jelinek  <jakub@redhat.com>

PR ipa/99517
* ipa-icf-gimple.c (func_checker::compare_gimple_call): For internal
function calls with lhs fail if the lhs don't have compatible types.

* gcc.target/i386/avx2-pr99517-1.c: New test.
* gcc.target/i386/avx2-pr99517-2.c: New test.
gcc/ipa-icf-gimple.c
gcc/testsuite/gcc.target/i386/avx2-pr99517-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx2-pr99517-2.c [new file with mode: 0644]