https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115221
--- Comment #9 from GCC 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:5ada486079d6aa20c64985a20681573f4ac1c86e commit r15-870-g5ada486079d6aa20c64985a20681573f4ac1c86e Author: Andrew MacLeod <amacl...@redhat.com> Date: Mon May 27 11:00:57 2024 -0400 Do not invoke SCEV if it will use a different range query. SCEV always uses the current range_query object. Ranger's cache uses a global value_query when propagating cache values to avoid re-invoking ranger during simple vavhe propagations. when folding a PHI value, SCEV can be invoked, and since it alwys uses the current range_query object, when ranger is active this causes the undesired re-invoking of ranger during cache propagation. This patch checks to see if the fold_using_range specified range_query object is the same as the one SCEV uses, and does not invoke SCEV if they do not match. PR tree-optimization/115221 gcc/ * gimple-range-fold.cc (range_of_ssa_name_with_loop_info): Do not invoke SCEV is range_query's do not match. gcc/testsuite/ * gcc.dg/pr115221.c: New.