aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-cache.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2021-06-14 15:33:59 -0400
committerAndrew MacLeod <amacleod@redhat.com>2021-06-14 17:06:32 -0400
commitecc5644fa3bc7f37eada2a3e9c627cd1918922e0 (patch)
tree98111eb5fd9cdebca136300ce17bd8d2372efa68 /gcc/gimple-range-cache.cc
parentc37b5ddcc88e0cc0f6a4ad609eda51021df0f6bb (diff)
downloadgcc-ecc5644fa3bc7f37eada2a3e9c627cd1918922e0.zip
gcc-ecc5644fa3bc7f37eada2a3e9c627cd1918922e0.tar.gz
gcc-ecc5644fa3bc7f37eada2a3e9c627cd1918922e0.tar.bz2
Limit new value calculations to first order effects.
When utilzing poor values during propagation, we mostly care about values that were undefined/processed directly used in calcualting the SSA_NAME being processed. 2nd level derivations of such poor values rarely affect the inital calculation. Leave them to when they are directly encountered. * gimple-range-cache.cc (ranger_cache::ranger_cache): Adjust. (ranger_cache::enable_new_values): Set to specified value and return the old value. (ranger_cache::disable_new_values): Delete. (ranger_cache::fill_block_cache): Disable non 1st order derived poor values. * gimple-range-cache.h (ranger_cache): Adjust prototypes. * gimple-range.cc (gimple_ranger::range_of_expr): Adjust.
Diffstat (limited to 'gcc/gimple-range-cache.cc')
-rw-r--r--gcc/gimple-range-cache.cc27
1 files changed, 13 insertions, 14 deletions
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index 249515f..d9a57c2 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -727,7 +727,7 @@ ranger_cache::ranger_cache (gimple_ranger &q) : query (q)
if (bb)
m_gori.exports (bb);
}
- enable_new_values ();
+ enable_new_values (true);
}
ranger_cache::~ranger_cache ()
@@ -748,21 +748,15 @@ ranger_cache::dump (FILE *f)
fprintf (f, "\n");
}
-// Allow the cache to flag and query new values when propagation is forced
-// to use an unknown value.
+// Allow or disallow the cache to flag and query new values when propagation
+// is forced to use an unknown value. The previous state is returned.
-void
-ranger_cache::enable_new_values ()
-{
- m_new_value_p = true;
-}
-
-// Disable new value querying.
-
-void
-ranger_cache::disable_new_values ()
+bool
+ranger_cache::enable_new_values (bool state)
{
- m_new_value_p = false;
+ bool ret = m_new_value_p;
+ m_new_value_p = state;
+ return ret;
}
// Dump the caches for basic block BB to file F.
@@ -1343,7 +1337,12 @@ ranger_cache::fill_block_cache (tree name, basic_block bb, basic_block def_bb)
// Calculate a range at the exit from the block so the caches feeding
// this block will be filled, and we'll get a "better" value.
+ // Disallow additonal "poor values" during this phase to avoid
+ // iterations that are unlikely to be profitable for this name.
+ // See PR 101014.
+ bool state = enable_new_values (false);
query.range_on_exit (tmp, calc_bb, rec.calc);
+ enable_new_values (state);
// Then ask for NAME to be re-evaluated on outgoing edges and
// use any new values.