]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2015-12-04 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 4 Dec 2015 12:32:26 +0000 (12:32 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 4 Dec 2015 12:32:26 +0000 (12:32 +0000)
* tree-ssa-sccvn.c (sccvn_dom_walker): Add unreachable_dom
member and initialize it.
(sccvn_dom_walker::after_dom_children): Reset unreachable_dom
if necessary.
(sccvn_dom_walker::before_dom_children): If unreachable_dom
is set BB is not reachable either.  Set unreachable_dom
if not set and BB is unreachable.

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

gcc/ChangeLog
gcc/tree-ssa-sccvn.c

index 0531854651830890aa878271e847c7b42c6367b3..c1eacbcda39048cd39beca49ca0242b7ee08e2f8 100644 (file)
@@ -1,3 +1,13 @@
+2015-12-04  Richard Biener  <rguenther@suse.de>
+
+       * tree-ssa-sccvn.c (sccvn_dom_walker): Add unreachable_dom
+       member and initialize it.
+       (sccvn_dom_walker::after_dom_children): Reset unreachable_dom
+       if necessary.
+       (sccvn_dom_walker::before_dom_children): If unreachable_dom
+       is set BB is not reachable either.  Set unreachable_dom
+       if not set and BB is unreachable.
+
 2015-12-04  Richard Biener  <rguenther@suse.de>
 
        * bitmap.c (bitmap_find_bit): Guard the bitmap descriptor
index 0c7fd725255b583b0534c0be58f8ee0af4eebfaf..2014ee7a7ebf11748b99e010c034b33fa879fbb1 100644 (file)
@@ -4207,7 +4207,8 @@ class sccvn_dom_walker : public dom_walker
 {
 public:
   sccvn_dom_walker ()
-    : dom_walker (CDI_DOMINATORS), fail (false), cond_stack (vNULL) {}
+    : dom_walker (CDI_DOMINATORS), fail (false), unreachable_dom (NULL),
+      cond_stack (vNULL) {}
   ~sccvn_dom_walker ();
 
   virtual void before_dom_children (basic_block);
@@ -4219,6 +4220,7 @@ public:
                     enum tree_code code, tree lhs, tree rhs, bool value);
 
   bool fail;
+  basic_block unreachable_dom;
   vec<std::pair <basic_block, std::pair <vn_nary_op_t, vn_nary_op_t> > >
     cond_stack;
 };
@@ -4299,6 +4301,9 @@ sccvn_dom_walker::record_conds (basic_block bb,
 void
 sccvn_dom_walker::after_dom_children (basic_block bb)
 {
+  if (unreachable_dom == bb)
+    unreachable_dom = NULL;
+
   while (!cond_stack.is_empty ()
         && cond_stack.last ().first == bb)
     {
@@ -4325,10 +4330,14 @@ sccvn_dom_walker::before_dom_children (basic_block bb)
   /* If any of the predecessor edges that do not come from blocks dominated
      by us are still marked as possibly executable consider this block
      reachable.  */
-  bool reachable = bb == ENTRY_BLOCK_PTR_FOR_FN (cfun);
-  FOR_EACH_EDGE (e, ei, bb->preds)
-    if (!dominated_by_p (CDI_DOMINATORS, e->src, bb))
-      reachable |= (e->flags & EDGE_EXECUTABLE);
+  bool reachable = false;
+  if (!unreachable_dom)
+    {
+      reachable = bb == ENTRY_BLOCK_PTR_FOR_FN (cfun);
+      FOR_EACH_EDGE (e, ei, bb->preds)
+       if (!dominated_by_p (CDI_DOMINATORS, e->src, bb))
+         reachable |= (e->flags & EDGE_EXECUTABLE);
+    }
 
   /* If the block is not reachable all outgoing edges are not
      executable.  Neither are incoming edges with src dominated by us.  */
@@ -4352,6 +4361,11 @@ sccvn_dom_walker::before_dom_children (basic_block bb)
              e->flags &= ~EDGE_EXECUTABLE;
            }
        }
+
+      /* Record the most dominating unreachable block.  */
+      if (!unreachable_dom)
+       unreachable_dom = bb;
+
       return;
     }