]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Early exit to avoid redundant computations
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Oct 2015 15:56:09 +0000 (15:56 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Oct 2015 15:56:09 +0000 (15:56 +0000)
Analyze only those bbs which are outside the region for uses which might be
defined inside the region. This is intended to improve the compile time. This
algorithm may be further improved by only looking at the successors of region as
these regions are sese. Added FIXMEs to make this improvement in future.

Passes regtest and bootstrap on x86_64.

gcc/ChangeLog:

2015-10-05  Aditya Kumar  <hiraditya@msn.com>

        * graphite-sese-to-poly.c (build_loop_iteration_domains): Only loops
        which are in this region are passed so gcc_assert and remove redundant
        computation.
        * sese.c (sese_build_liveouts): Pass only those bbs which are not in region.
        (sese_bad_liveouts_use): Only BBs which are not in region are passed so
        gcc_assert on that and remove unnecessary computation.
        (sese_build_liveouts_use): Same.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228529 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/graphite-sese-to-poly.c
gcc/sese.c

index 08efe78faabc304476b09eb30f1c075fe04ad2f2..002e7f79733ecc4c5e2d9bd9c7605faa7f57bcc3 100644 (file)
@@ -1,3 +1,13 @@
+2015-10-05  Aditya Kumar  <hiraditya@msn.com>
+
+       * graphite-sese-to-poly.c (build_loop_iteration_domains): Only loops
+       which are in this region are passed so gcc_assert and remove redundant
+       computation.
+       * sese.c (sese_build_liveouts): Pass only those bbs which are not in region.
+       (sese_bad_liveouts_use): Only BBs which are not in region are passed so
+       gcc_assert on that and remove unnecessary computation.
+       (sese_build_liveouts_use): Same.
+
 2015-10-05  Aditya Kumar  <aditya.k7@samsung.com>
 
        * graphite-dependences.c (scop_get_reads): Renamed scop->context
index 15d16c1a488eb0fc717953e74592e8a3259d1738..d0c7eb44bf20ce17085bf3becfd7131b1b338ec1 100644 (file)
@@ -595,6 +595,7 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
 
   tree nb_iters = number_of_latch_executions (loop);
   sese region = SCOP_REGION (scop);
+  gcc_assert (loop_in_sese_p (loop, region));
 
   isl_set *inner = isl_set_copy (outer);
   int pos = isl_set_dim (outer, isl_dim_set);
@@ -679,7 +680,7 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
   else
     gcc_unreachable ();
 
-  if (loop->inner && loop_in_sese_p (loop->inner, region))
+  if (loop->inner)
     build_loop_iteration_domains (scop, loop->inner, nb + 1,
                                  isl_set_copy (inner), doms);
 
index 2c654bcb24c5bbd91f40398fc253ba6a75120fc9..6f01ca6b5fb6dba4b38b8590f0fb2ef85b47cbc5 100644 (file)
@@ -134,20 +134,16 @@ static void
 sese_build_liveouts_use (sese region, bitmap liveouts, basic_block bb,
                         tree use)
 {
-  unsigned ver;
-  basic_block def_bb;
-
+  gcc_assert (!bb_in_sese_p (bb, region));
   if (TREE_CODE (use) != SSA_NAME)
     return;
 
-  ver = SSA_NAME_VERSION (use);
-  def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
+  basic_block def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
 
-  if (!def_bb
-      || !bb_in_sese_p (def_bb, region)
-      || bb_in_sese_p (bb, region))
+  if (!def_bb || !bb_in_sese_p (def_bb, region))
     return;
 
+  unsigned ver = SSA_NAME_VERSION (use);
   bitmap_set_bit (liveouts, ver);
 }
 
@@ -188,24 +184,21 @@ static bool
 sese_bad_liveouts_use (sese region, bitmap liveouts, basic_block bb,
                       tree use)
 {
-  unsigned ver;
-  basic_block def_bb;
+  gcc_assert (!bb_in_sese_p (bb, region));
 
   if (TREE_CODE (use) != SSA_NAME)
     return false;
 
-  ver = SSA_NAME_VERSION (use);
+  unsigned ver = SSA_NAME_VERSION (use);
 
   /* If it's in liveouts, the variable will get a new PHI node, and
      the debug use will be properly adjusted.  */
   if (bitmap_bit_p (liveouts, ver))
     return false;
 
-  def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
+  basic_block def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
 
-  if (!def_bb
-      || !bb_in_sese_p (def_bb, region)
-      || bb_in_sese_p (bb, region))
+  if (!def_bb || !bb_in_sese_p (def_bb, region))
     return false;
 
   return true;
@@ -247,11 +240,16 @@ sese_build_liveouts (sese region, bitmap liveouts)
 {
   basic_block bb;
 
+  /* FIXME: We could start iterating form the successor of sese.  */
   FOR_EACH_BB_FN (bb, cfun)
-    sese_build_liveouts_bb (region, liveouts, bb);
+    if (!bb_in_sese_p (bb, region))
+      sese_build_liveouts_bb (region, liveouts, bb);
+
+  /* FIXME: We could start iterating form the successor of sese.  */
   if (MAY_HAVE_DEBUG_STMTS)
     FOR_EACH_BB_FN (bb, cfun)
-      sese_reset_debug_liveouts_bb (region, liveouts, bb);
+      if (!bb_in_sese_p (bb, region))
+       sese_reset_debug_liveouts_bb (region, liveouts, bb);
 }
 
 /* Builds a new SESE region from edges ENTRY and EXIT.  */