On 11/7/25 08:29, Richard Biener wrote:
When feeding non-SSA names to range_on_edge we degrade to a
non-contextual query even though range_on_exits handling suggests
that we can do better.  The following does what it does in
range_on_edge directly, passing the edge source as 'bbend'
argument to get_tree_range if the edge source has a single
successor (as will be the case for queries from niter analysis).

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

OK?  The remainder of the series makes use of this, I'll hold of
that a bit for followup work.

Yeah, That's good.

Andrew

Thanks,
Richard.

        * gimple-range.cc (gimple_ranger::range_on_edge): Pass
        the source block as 'bbend' to get_tree_range when
        it has a single successor.
---
  gcc/gimple-range.cc | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index e91eeb455f1..942bf8bf0a5 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -252,7 +252,8 @@ gimple_ranger::range_on_edge (vrange &r, edge e, tree name)
bool res = true;
    if (!gimple_range_ssa_p (name))
-    res = get_tree_range (r, name, NULL);
+    res = get_tree_range (r, name, NULL, NULL,
+                         single_succ_p (e->src) ? e->src : NULL);
    else
      {
        range_on_exit (r, e->src, name);

Reply via email to