[gcc r12-3841] Hoist edge calculations in precompute_relations.

Aldy Hernandez aldyh@gcc.gnu.org
Thu Sep 23 11:08:51 GMT 2021


https://gcc.gnu.org/g:f3d357bab357abcbe4d8fc82898c68fd3a4c3471

commit r12-3841-gf3d357bab357abcbe4d8fc82898c68fd3a4c3471
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu Sep 23 09:37:00 2021 +0200

    Hoist edge calculations in precompute_relations.
    
    Tested on x86-64 Linux.
    
    gcc/ChangeLog:
    
            * gimple-range-path.cc (path_range_query::precompute_relations):
            Hoist edge calculations before using EDGE_SUCC.

Diff:
---
 gcc/gimple-range-path.cc | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc
index d052ebd81fc..d9704c8f86b 100644
--- a/gcc/gimple-range-path.cc
+++ b/gcc/gimple-range-path.cc
@@ -643,16 +643,16 @@ path_range_query::precompute_relations (const vec<basic_block> &path)
 	  basic_block next = path[i - 2];
 	  int_range<2> r;
 	  gcond *cond = as_a<gcond *> (stmt);
+	  edge e0 = EDGE_SUCC (bb, 0);
+	  edge e1 = EDGE_SUCC (bb, 1);
 
-	  if (EDGE_SUCC (bb, 0)->dest == next)
-	    gcond_edge_range (r, EDGE_SUCC (bb, 0));
-	  else if (EDGE_SUCC (bb, 1)->dest == next)
-	    gcond_edge_range (r, EDGE_SUCC (bb, 1));
+	  if (e0->dest == next)
+	    gcond_edge_range (r, e0);
+	  else if (e1->dest == next)
+	    gcond_edge_range (r, e1);
 	  else
 	    gcc_unreachable ();
 
-	  edge e0 = EDGE_SUCC (bb, 0);
-	  edge e1 = EDGE_SUCC (bb, 1);
 	  src.register_outgoing_edges (cond, r, e0, e1);
 	}
       prev = bb;


More information about the Gcc-cvs mailing list