]> git.ipfire.org Git - thirdparty/gcc.git/commit
VN: Don't recurse on for the same value of `a | b` [PR117496]
authorAndrew Pinski <quic_apinski@quicinc.com>
Fri, 8 Nov 2024 21:39:05 +0000 (13:39 -0800)
committerAndrew Pinski <quic_apinski@quicinc.com>
Sat, 9 Nov 2024 16:20:33 +0000 (08:20 -0800)
commit6e84a41622f56ca360d995e6092ded3b5a02ba40
tree3854b72ce547df381c9244db0a6a982f11e2757a
parentaf1277b4d0d274b8c8f6edffcee32b7f39f2df64
VN: Don't recurse on for the same value of `a | b` [PR117496]

After adding vn_valueize to the handle the `a | b ==/!= 0` case
of insert_predicates_for_cond, it would go into an infinite loop
as the Value number for either a or b could be the same as what it
is for the whole expression. This avoids that recursion so there is
no infinite loop here.

Bootstrapped and tested on x86_64-linux.

PR tree-optimization/117496

gcc/ChangeLog:

* tree-ssa-sccvn.cc (insert_predicates_for_cond): If the
valueization for the new lhs is the same as the old one,
don't recurse.

gcc/testsuite/ChangeLog:

* gcc.dg/torture/pr117496-1.c: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/testsuite/gcc.dg/torture/pr117496-1.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.cc