When we are dumping the rangers state, we tend to do it at the end when
EVRP is shutting down. The dumping routine is checking to see if the
cache has an on-entry value or the edge generates a range before
dumping, but when it does the actual dump, its calling range_on_edge
which can go and do additional lookups. That late in the game, it can
cause a trap in SCEV if a PHI node attempts to be rcalculated when a
loop has been rewritten.
Instead, query the range_on_edge from the cache, which will only show
information we know, and not cause additional lookups.
Bootstrap on x86_64-pc-linux-gnu with no regressions. pushed.
Andrew
>From 9d674b735f22aa9cf85629851783ce38f25087b5 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacl...@redhat.com>
Date: Tue, 22 Jun 2021 09:20:47 -0400
Subject: [PATCH 1/4] Dump should be read only. Do not trigger new lookups.
* gimple-range.cc (dump_bb): Use range_on_edge from the cache.
---
gcc/gimple-range.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 385cecf330b..49d26509230 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -1457,7 +1457,7 @@ gimple_ranger::dump_bb (FILE *f, basic_block bb)
m_cache.block_range (range, bb, name, false) ||
m_cache.block_range (range, e->dest, name, false))
{
- range_on_edge (range, e, name);
+ m_cache.range_on_edge (range, e, name);
if (!range.varying_p ())
{
fprintf (f, "%d->%d ", e->src->index,
--
2.17.2