https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117496
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:6e84a41622f56ca360d995e6092ded3b5a02ba40 commit r15-5063-g6e84a41622f56ca360d995e6092ded3b5a02ba40 Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Fri Nov 8 13:39:05 2024 -0800 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_apin...@quicinc.com>