FAST_VRP uses a non-ranger gori_on_edge routine to calculate the full set of SSA ranges that can be calculated on an edge. It allows an optional outgoing_edge_range object if one wanted to use switches. This is now integrated with the gori () method of a range_query, and is no longer needed.
Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed. Andrew
commit a19f588d0b71a4cbc48b064177de87d3ca46b39f Author: Andrew MacLeod <amacl...@redhat.com> Date: Wed May 22 19:51:16 2024 -0400 Gori_on_edge tweaks. FAST_VRP uses a non-ranger gori_on_edge routine which allows an optional outgoing_edge_range object if one wanted to use switches. This is now integrated with the gori () method of a range_query, and is no longer needed. * gimple-range-gori.cc (gori_on_edge): Always use static ranges from the specified range_query. * gimple-range-gori.h (gori_on_edge): Change prototype. * gimple-range.cc (dom_ranger::maybe_push_edge): Change arguments to call. diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc index 0d471b46903..d489aef312c 100644 --- a/gcc/gimple-range-gori.cc +++ b/gcc/gimple-range-gori.cc @@ -1625,28 +1625,20 @@ gori_calc_operands (vrange &lhs, gimple *stmt, ssa_cache &r, range_query *q) } // Use ssa_cache R as a repository for all outgoing ranges on edge E that -// can be calculated. Use OGR if present to establish starting edge ranges, -// and Q to resolve operand values. If Q is NULL use the current range +// can be calculated. Use Q to establish starting edge ranges anbd to resolve +// operand values. If Q is NULL use the current range // query available to the system. bool -gori_on_edge (ssa_cache &r, edge e, range_query *q, gimple_outgoing_range *ogr) +gori_on_edge (ssa_cache &r, edge e, range_query *q) { + if (!q) + q = get_range_query (cfun); // Start with an empty vector r.clear (); int_range_max lhs; // Determine if there is an outgoing edge. - gimple *stmt; - if (ogr) - stmt = ogr->edge_range_p (lhs, e); - else - { - stmt = gimple_outgoing_range_stmt_p (e->src); - if (stmt && is_a<gcond *> (stmt)) - gcond_edge_range (lhs, e); - else - stmt = NULL; - } + gimple *stmt = q->gori ().edge_range_p (lhs, e); if (!stmt) return false; gori_calc_operands (lhs, stmt, r, q); diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h index 9b4bcd919f5..11019e38471 100644 --- a/gcc/gimple-range-gori.h +++ b/gcc/gimple-range-gori.h @@ -213,10 +213,8 @@ private: // ssa_cache structure). // GORI_NAME_ON_EDGE is used to simply ask if NAME has a range on edge E -// Fill ssa-cache R with any outgoing ranges on edge E, using OGR and QUERY. -bool gori_on_edge (class ssa_cache &r, edge e, - range_query *query = NULL, - gimple_outgoing_range *ogr = NULL); +// Fill ssa-cache R with any outgoing ranges on edge E, using QUERY. +bool gori_on_edge (class ssa_cache &r, edge e, range_query *query = NULL); // Query if NAME has an outgoing range on edge E, and return it in R if so. // Note this doesnt use ranger, its a static GORI analysis of the range in diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc index 711646abb67..be22bb4aa18 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -1156,7 +1156,7 @@ dom_ranger::maybe_push_edge (edge e, bool edge_0) e_cache = m_freelist.pop (); else e_cache = new ssa_lazy_cache; - gori_on_edge (*e_cache, e, this, &gori ()); + gori_on_edge (*e_cache, e, this); if (e_cache->empty_p ()) m_freelist.safe_push (e_cache); else