aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2021-11-19 12:59:12 -0500
committerAndrew MacLeod <amacleod@redhat.com>2021-11-24 09:03:07 -0500
commitd986ff50b4aad62c45d7ac62915e072643ddfca1 (patch)
tree079d6a4f311580b7dc15272e9c7737ae792b1468 /gcc/gimple-range.cc
parenta031bb7a585f789df2aed856a57646b8c45d0878 (diff)
downloadgcc-d986ff50b4aad62c45d7ac62915e072643ddfca1.zip
gcc-d986ff50b4aad62c45d7ac62915e072643ddfca1.tar.gz
gcc-d986ff50b4aad62c45d7ac62915e072643ddfca1.tar.bz2
Split return functionality of get_non_stale_global_range.
Get_non_stale_global_range returns true only when there is a cache entry that is not out of date. Change it so that it returns true if there was a cache value, but return the temporal comparison result in an auxiallary flag. * gimple-range-cache.cc (ranger_cache::get_global_range): Always return a range, return if it came from the cache or not. (get_non_stale_global_range): Rename to get_global_range, and return the temporal state in a flag. * gimple-range-cache.h (get_non_stale_global_range): Rename and adjust. * gimple-range.cc (gimple_ranger::range_of_expr): No need to query get_global_range. (gimple_ranger::range_of_stmt): Adjust for global cache temporal state returned in a flag.
Diffstat (limited to 'gcc/gimple-range.cc')
-rw-r--r--gcc/gimple-range.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 9ca568c..e3ab3a8 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -85,8 +85,7 @@ gimple_ranger::range_of_expr (irange &r, tree expr, gimple *stmt)
if (!stmt)
{
int_range_max tmp;
- if (!m_cache.get_global_range (r, expr))
- r = gimple_range_global (expr);
+ m_cache.get_global_range (r, expr);
// Pick up implied context information from the on-entry cache
// if current_bb is set. Do not attempt any new calculations.
if (current_bb && m_cache.block_range (tmp, current_bb, expr, false))
@@ -282,15 +281,19 @@ gimple_ranger::range_of_stmt (irange &r, gimple *s, tree name)
}
else if (!gimple_range_ssa_p (name))
res = get_tree_range (r, name, NULL);
- // Check if the stmt has already been processed, and is not stale.
- else if (m_cache.get_non_stale_global_range (r, name))
- {
- if (idx)
- tracer.trailer (idx, " cached", true, name, r);
- return true;
- }
else
{
+ bool current;
+ // Check if the stmt has already been processed, and is not stale.
+ if (m_cache.get_global_range (r, name, current))
+ {
+ if (current)
+ {
+ if (idx)
+ tracer.trailer (idx, " cached", true, name, r);
+ return true;
+ }
+ }
// Otherwise calculate a new value.
int_range_max tmp;
fold_range_internal (tmp, s, name);