From 1d6e77c504dc3f5750374b2d0157f804c95031db Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 4 Dec 2015 12:32:26 +0000 Subject: [PATCH] tree-ssa-sccvn.c (sccvn_dom_walker): Add unreachable_dom member and initialize it. 2015-12-04 Richard Biener * 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. From-SVN: r231262 --- gcc/ChangeLog | 10 ++++++++++ gcc/tree-ssa-sccvn.c | 24 +++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 05318546518..c1eacbcda39 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-12-04 Richard Biener + + * 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 * bitmap.c (bitmap_find_bit): Guard the bitmap descriptor diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 0c7fd725255..2014ee7a7eb 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -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 > > 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; } -- 2.30.2