]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH] Allow vrp to thread across backedges using FSM threader
authorJeff Law <law@gcc.gnu.org>
Fri, 6 Nov 2015 23:26:20 +0000 (16:26 -0700)
committerJeff Law <law@gcc.gnu.org>
Fri, 6 Nov 2015 23:26:20 +0000 (16:26 -0700)
* cfg-flags.def (IGNORE): New edge flag.
* tree-vrp.c (identify_jump_threads): Mark and clear edges
scheduled for removal with EDGE_IGNORE around call into
jump threader.  Do no thread across edges with EDGE_IGNORE,
but do allow threading across those with EDGE_DFS_BACK.

* gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust to look for
realized jump threads.
* gcc.dg/tree-ssa-pr66752-3.c: Look in vrp1 dump for jump
threads rather than dom1 dump.

From-SVN: r229902

gcc/ChangeLog
gcc/cfg-flags.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/pr66752-3.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-7.c
gcc/tree-vrp.c

index e2f588bf6664fa912d4e745aa63802d777a00dd9..552c51b2ceb63ca2b140def686044ed7567050ba 100644 (file)
@@ -1,3 +1,11 @@
+2015-11-06  Jeff Law <jeff@redhat.com>
+
+       * cfg-flags.def (IGNORE): New edge flag.
+       * tree-vrp.c (identify_jump_threads): Mark and clear edges
+       scheduled for removal with EDGE_IGNORE around call into
+       jump threader.  Do no thread across edges with EDGE_IGNORE,
+       but do allow threading across those with EDGE_DFS_BACK.
+
 2015-11-06  David Wohlferd  <dw@LimeGreenSocks.com>
 
        * doc/md.texi (multi-alternative constraints): Don't document
index eedcd69272400bcc711d37b4e9067df497d5d29c..e2bfbed5ecf5aaf033b2ccb4a32371b96e4357a0 100644 (file)
@@ -78,7 +78,7 @@ DEF_BASIC_BLOCK_FLAG(RTL, 9)
 DEF_BASIC_BLOCK_FLAG(FORWARDER_BLOCK, 10)
 
 /* Set on blocks that cannot be threaded through.
-   Only used in cfgcleanup.c.  */
+   Only used for jump threading.  */
 DEF_BASIC_BLOCK_FLAG(NONTHREADABLE_BLOCK, 11)
 
 /* Set on blocks that were modified in some way.  This bit is set in
@@ -177,6 +177,11 @@ DEF_EDGE_FLAG(TM_UNINSTRUMENTED, 15)
 /* Abort (over) edge out of a GIMPLE_TRANSACTION statement.  */
 DEF_EDGE_FLAG(TM_ABORT, 16)
 
+/* An edge we should ignore.  It should be entirely local to
+   passes.  ie, it is never set on any edge upon the completion
+   of any pass.  */
+DEF_EDGE_FLAG(IGNORE, 17)
+
 #endif
 
 /*
index 80221c1e301ec25f5d2fb3dc9e3dd05e8f1b1da7..af4a7387e829edfddeb13096dd4235377766b675 100644 (file)
@@ -1,3 +1,10 @@
+2015-11-06  Jeff Law  <law@redhat.com>
+
+       * gcc.dg/tree-ssa/ssa-dom-thread-7.c: Adjust to look for
+       realized jump threads.
+       * gcc.dg/tree-ssa-pr66752-3.c: Look in vrp1 dump for jump
+       threads rather than dom1 dump.
+
 2015-11-06  Michael Collison  <michael.collison@linaro.org
            Ramana Radhakrishnan  <ramana.radhakrishnan@linaro.org>
 
index f15b598616600ed2b9147b4e82a930e731be83f3..577a489dd8cb6754996b7978ef7e4d05fb77feb8 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-dom1-details -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-vrp1-details -fdump-tree-optimized" } */
 
 extern int status, pt;
 extern int count;
@@ -33,7 +33,7 @@ foo (int N, int c, int b, int *a)
 }
 
 /* There are 3 FSM jump threading opportunities.  */
-/* { dg-final { scan-tree-dump-times "FSM" 3 "dom1"} } */
+/* { dg-final { scan-tree-dump-times "FSM" 3 "vrp1"} } */
 
 /* There should be no assignments or references to FLAG.  */
 /* { dg-final { scan-tree-dump-not "flag" "optimized"} } */
index 445f2509dc3041e44fc0d5d328c0bfb39891c2bb..ac12b6ca7141fdbd2fbe82ae1defebe5a5737044 100644 (file)
@@ -1,6 +1,8 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-dom1-details" } */
-/* { dg-final { scan-tree-dump-times "FSM" 38 "dom1" } } */
+/* { dg-options "-O2 -fdump-tree-vrp1-stats -fdump-tree-dom1-stats -fdump-tree-dom2-stats" } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 7"  "vrp1" } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 12" "dom1" } } */
+/* { dg-final { scan-tree-dump "Jumps threaded: 3"  "dom2" } } */
 
 enum STATE {
   S0=0,
index c0b6cfc14444b1329036658309f902042bc85f43..87c02654c488e24b3a1539424bf65856ca3f2132 100644 (file)
@@ -10076,9 +10076,9 @@ identify_jump_threads (void)
   mark_dfs_back_edges ();
 
   /* Do not thread across edges we are about to remove.  Just marking
-     them as EDGE_DFS_BACK will do.  */
+     them as EDGE_IGNORE will do.  */
   FOR_EACH_VEC_ELT (to_remove_edges, i, e)
-    e->flags |= EDGE_DFS_BACK;
+    e->flags |= EDGE_IGNORE;
 
   /* Allocate our unwinder stack to unwind any temporary equivalences
      that might be recorded.  */
@@ -10135,9 +10135,9 @@ identify_jump_threads (void)
             it to a specific successor.  */
          FOR_EACH_EDGE (e, ei, bb->preds)
            {
-             /* Do not thread across back edges or abnormal edges
-                in the CFG.  */
-             if (e->flags & (EDGE_DFS_BACK | EDGE_COMPLEX))
+             /* Do not thread across edges marked to ignoreor abnormal
+                edges in the CFG.  */
+             if (e->flags & (EDGE_IGNORE | EDGE_COMPLEX))
                continue;
 
              thread_across_edge (dummy, e, true, equiv_stack, NULL,
@@ -10146,6 +10146,10 @@ identify_jump_threads (void)
        }
     }
 
+  /* Clear EDGE_IGNORE.  */
+  FOR_EACH_VEC_ELT (to_remove_edges, i, e)
+    e->flags &= ~EDGE_IGNORE;
+
   /* We do not actually update the CFG or SSA graphs at this point as
      ASSERT_EXPRs are still in the IL and cfg cleanup code does not yet
      handle ASSERT_EXPRs gracefully.  */