https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106114
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Andrew Macleod <amacl...@gcc.gnu.org>: https://gcc.gnu.org/g:918ccccbb0e78ae42bfcf808a1e93a8f6b9d02ea commit r13-1356-g918ccccbb0e78ae42bfcf808a1e93a8f6b9d02ea Author: Andrew MacLeod <amacl...@redhat.com> Date: Wed Jun 29 13:34:05 2022 -0400 Don't use gori dependencies to optimize. The routine fold_using_range::relation_fold_and_or needs to veriyf that both operands of 2 stmts are the same, and uses GORIs dependency cache for this. This cache cannot be counted on to reflect the current contents of a stmt, expecially in the presence of an IL changing pass. Instead, look at the statement operands. PR tree-optimization/106114 gcc/ * gimple-range-fold.cc (fold_using_range::relation_fold_and_or): Check statement operands instead of GORI cache. gcc/testsuite/ * gcc.dg/pr106114.c: New.