Commit 1d6e77c5 by Richard Biener Committed by Richard Biener

tree-ssa-sccvn.c (sccvn_dom_walker): Add unreachable_dom member and initialize it.

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.

From-SVN: r231262
parent 1a8c6eff
2015-12-04 Richard Biener <rguenther@suse.de> 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 * bitmap.c (bitmap_find_bit): Guard the bitmap descriptor
query with GATHER_STATISTICS. query with GATHER_STATISTICS.
...@@ -4207,7 +4207,8 @@ class sccvn_dom_walker : public dom_walker ...@@ -4207,7 +4207,8 @@ class sccvn_dom_walker : public dom_walker
{ {
public: public:
sccvn_dom_walker () 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 (); ~sccvn_dom_walker ();
virtual void before_dom_children (basic_block); virtual void before_dom_children (basic_block);
...@@ -4219,6 +4220,7 @@ public: ...@@ -4219,6 +4220,7 @@ public:
enum tree_code code, tree lhs, tree rhs, bool value); enum tree_code code, tree lhs, tree rhs, bool value);
bool fail; bool fail;
basic_block unreachable_dom;
vec<std::pair <basic_block, std::pair <vn_nary_op_t, vn_nary_op_t> > > vec<std::pair <basic_block, std::pair <vn_nary_op_t, vn_nary_op_t> > >
cond_stack; cond_stack;
}; };
...@@ -4299,6 +4301,9 @@ sccvn_dom_walker::record_conds (basic_block bb, ...@@ -4299,6 +4301,9 @@ sccvn_dom_walker::record_conds (basic_block bb,
void void
sccvn_dom_walker::after_dom_children (basic_block bb) sccvn_dom_walker::after_dom_children (basic_block bb)
{ {
if (unreachable_dom == bb)
unreachable_dom = NULL;
while (!cond_stack.is_empty () while (!cond_stack.is_empty ()
&& cond_stack.last ().first == bb) && cond_stack.last ().first == bb)
{ {
...@@ -4325,10 +4330,14 @@ sccvn_dom_walker::before_dom_children (basic_block 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 /* If any of the predecessor edges that do not come from blocks dominated
by us are still marked as possibly executable consider this block by us are still marked as possibly executable consider this block
reachable. */ reachable. */
bool reachable = bb == ENTRY_BLOCK_PTR_FOR_FN (cfun); bool reachable = false;
FOR_EACH_EDGE (e, ei, bb->preds) if (!unreachable_dom)
if (!dominated_by_p (CDI_DOMINATORS, e->src, bb)) {
reachable |= (e->flags & EDGE_EXECUTABLE); 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 /* If the block is not reachable all outgoing edges are not
executable. Neither are incoming edges with src dominated by us. */ executable. Neither are incoming edges with src dominated by us. */
...@@ -4352,6 +4361,11 @@ sccvn_dom_walker::before_dom_children (basic_block bb) ...@@ -4352,6 +4361,11 @@ sccvn_dom_walker::before_dom_children (basic_block bb)
e->flags &= ~EDGE_EXECUTABLE; e->flags &= ~EDGE_EXECUTABLE;
} }
} }
/* Record the most dominating unreachable block. */
if (!unreachable_dom)
unreachable_dom = bb;
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment