https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106114
--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Andrew Macleod <amacl...@gcc.gnu.org>: https://gcc.gnu.org/g:d4738cbb02e201c031a2a44d8bc10d3e17d987dc commit r12-8549-gd4738cbb02e201c031a2a44d8bc10d3e17d987dc Author: Andrew MacLeod <amacl...@redhat.com> Date: Mon Jul 4 11:21:34 2022 -0400 Don't use gori depedencies to optimize. The routine fold_using_range::relation_fold_and_or needs to verify 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.