https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110874
--- Comment #15 from CVS 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:91c963ea6f845a0c59b7523a5330b8d3ed1beb6a commit r14-2978-g91c963ea6f845a0c59b7523a5330b8d3ed1beb6a Author: Andrew Pinski <apin...@marvell.com> Date: Wed Aug 2 14:49:00 2023 -0700 Fix PR 110874: infinite loop in gimple_bitwise_inverted_equal_p with fre This changes gimple_bitwise_inverted_equal_p to use a 2 different match patterns to try to match bit_not wrapped with a possible nop_convert and a comparison also wrapped with a possible nop_convert. This is to avoid being recursive. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/110874 * gimple-match-head.cc (gimple_bit_not_with_nop): New declaration. (gimple_maybe_cmp): Likewise. (gimple_bitwise_inverted_equal_p): Rewrite to use gimple_bit_not_with_nop and gimple_maybe_cmp instead of being recursive. * match.pd (bit_not_with_nop): New match pattern. (maybe_cmp): Likewise. gcc/testsuite/ChangeLog: PR tree-optimization/110874 * gcc.c-torture/compile/pr110874-a.c: New test.