aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-fold.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2024-05-27 11:00:57 -0400
committerAndrew MacLeod <amacleod@redhat.com>2024-05-28 14:51:39 -0400
commit5ada486079d6aa20c64985a20681573f4ac1c86e (patch)
tree545356ad8822b0efe4c54777d5033c61b2489e45 /gcc/gimple-range-fold.cc
parentd52b44aa26aa9976caaaa292f4773a08bbaa2fbb (diff)
downloadgcc-5ada486079d6aa20c64985a20681573f4ac1c86e.zip
gcc-5ada486079d6aa20c64985a20681573f4ac1c86e.tar.gz
gcc-5ada486079d6aa20c64985a20681573f4ac1c86e.tar.bz2
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.
Diffstat (limited to 'gcc/gimple-range-fold.cc')
-rw-r--r--gcc/gimple-range-fold.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index b3965b5..98a4877 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -1264,7 +1264,11 @@ fold_using_range::range_of_ssa_name_with_loop_info (vrange &r, tree name,
fur_source &src)
{
gcc_checking_assert (TREE_CODE (name) == SSA_NAME);
- if (!range_of_var_in_loop (r, name, l, phi, src.query ()))
+ // SCEV currently invokes get_range_query () for values. If the query
+ // being passed in is not the same SCEV will use, do not invoke SCEV.
+ // This can be remove if/when SCEV uses a passed in range-query.
+ if (src.query () != get_range_query (cfun)
+ || !range_of_var_in_loop (r, name, l, phi, src.query ()))
r.set_varying (TREE_TYPE (name));
}