commit 42a146ac12f48422f5a26b5ab9a804639cbdeea3
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Mon Apr 26 18:14:15 2021 -0400

    Make TRUE/FALSE edge calculation available without the outgoing edge class.
    
    Rename class to gimple_outoging_edge and provide a non-class routine for
    the outgoing edge of a gcond.
    
            * gimple-range-edge.h (gimple_outgoing_range): Rename from
            outgoing_range.
            (gcond_edge_range): Export prototype.
            * gimple-range-edge.cc (gcond_edge_range): New.
            (gimple_outgoing_range::edge_range_p): Use gcond_edge_range.
            * gimple-range-gori.h (gori_compute): Use gimple_outgoing_range.

diff --git a/gcc/gimple-range-edge.cc b/gcc/gimple-range-edge.cc
index 4d4cb97bbec..d11153e677e 100644
--- a/gcc/gimple-range-edge.cc
+++ b/gcc/gimple-range-edge.cc
@@ -52,12 +52,26 @@ gimple_outgoing_range_stmt_p (basic_block bb)
 }
 
 
-outgoing_range::outgoing_range ()
+// Return a TRUE or FALSE range representing the edge value of a GCOND.
+
+void
+gcond_edge_range (irange &r, edge e)
+{
+  gcc_checking_assert (e->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE));
+  if (e->flags & EDGE_TRUE_VALUE)
+    r = int_range<2> (boolean_true_node, boolean_true_node);
+  else
+    r = int_range<2> (boolean_false_node, boolean_false_node);
+}
+
+
+gimple_outgoing_range::gimple_outgoing_range ()
 {
   m_edge_table = NULL;
 }
 
-outgoing_range::~outgoing_range ()
+
+gimple_outgoing_range::~gimple_outgoing_range ()
 {
   if (m_edge_table)
     delete m_edge_table;
@@ -68,7 +82,7 @@ outgoing_range::~outgoing_range ()
 // Use a cached value if it exists, or calculate it if not.
 
 bool
-outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
+gimple_outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
 {
   gcc_checking_assert (is_a<gswitch *> (s));
   gswitch *sw = as_a<gswitch *> (s);
@@ -100,7 +114,7 @@ outgoing_range::get_edge_range (irange &r, gimple *s, edge e)
 // Calculate all switch edges from SW and cache them in the hash table.
 
 void
-outgoing_range::calc_switch_ranges (gswitch *sw)
+gimple_outgoing_range::calc_switch_ranges (gswitch *sw)
 {
   bool existed;
   unsigned x, lim;
@@ -165,7 +179,7 @@ outgoing_range::calc_switch_ranges (gswitch *sw)
 // return NULL
 
 gimple *
-outgoing_range::edge_range_p (irange &r, edge e)
+gimple_outgoing_range::edge_range_p (irange &r, edge e)
 {
   // Determine if there is an outgoing edge.
   gimple *s = gimple_outgoing_range_stmt_p (e->src);
@@ -174,12 +188,7 @@ outgoing_range::edge_range_p (irange &r, edge e)
 
   if (is_a<gcond *> (s))
     {
-      if (e->flags & EDGE_TRUE_VALUE)
-	r = int_range<2> (boolean_true_node, boolean_true_node);
-      else if (e->flags & EDGE_FALSE_VALUE)
-	r = int_range<2> (boolean_false_node, boolean_false_node);
-      else
-	gcc_unreachable ();
+      gcond_edge_range (r, e);
       return s;
     }
 
diff --git a/gcc/gimple-range-edge.h b/gcc/gimple-range-edge.h
index 8970c9e14d6..87b4124d01d 100644
--- a/gcc/gimple-range-edge.h
+++ b/gcc/gimple-range-edge.h
@@ -35,11 +35,11 @@ along with GCC; see the file COPYING3.  If not see
 // The return value is NULL for no range, or the branch statement which the
 // edge gets the range from, along with the range.
 
-class outgoing_range
+class gimple_outgoing_range
 {
 public:
-  outgoing_range ();
-  ~outgoing_range ();
+  gimple_outgoing_range ();
+  ~gimple_outgoing_range ();
   gimple *edge_range_p (irange &r, edge e);
 private:
   void calc_switch_ranges (gswitch *sw);
@@ -47,9 +47,11 @@ private:
 
   hash_map<edge, irange *> *m_edge_table;
   irange_allocator m_range_allocator;
-}; 
+};
 
-// If there is a range control statment at the end of block BB, return it.
+// If there is a range control statement at the end of block BB, return it.
 gimple *gimple_outgoing_range_stmt_p (basic_block bb);
+// Return the range on edge E if it is from a GCOND.  Either TRUE or FALSE.
+void gcond_edge_range (irange &r, edge e);
 
 #endif  // GIMPLE_RANGE_EDGE_H
diff --git a/gcc/gimple-range-gori.h b/gcc/gimple-range-gori.h
index 48c746d1f37..7bb18a9baf1 100644
--- a/gcc/gimple-range-gori.h
+++ b/gcc/gimple-range-gori.h
@@ -108,7 +108,7 @@ private:
 					    const irange &lhs, tree name);
 
   class gori_map *m_gori_map;
-  outgoing_range outgoing;	// Edge values for COND_EXPR & SWITCH_EXPR.
+  gimple_outgoing_range outgoing;	// Edge values for COND_EXPR & SWITCH_EXPR.
 };
 
 
