aboutsummaryrefslogtreecommitdiff
path: root/gcc/dominance.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/dominance.c')
-rw-r--r--gcc/dominance.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/gcc/dominance.c b/gcc/dominance.c
index f001c680243..ce977e292fe 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -30,7 +30,7 @@
The algorithm computes this dominator tree implicitly by computing for
each block its immediate dominator. We use tree balancing and path
- compression, so its the O(e*a(e,v)) variant, where a(e,v) is the very
+ compression, so it's the O(e*a(e,v)) variant, where a(e,v) is the very
slowly growing functional inverse of the Ackerman function. */
#include "config.h"
@@ -372,7 +372,7 @@ calc_dfs_tree (struct dom_info *di, enum cdi_direction reverse)
di->nodes = di->dfsnum - 1;
- /* This aborts e.g. when there is _no_ path from ENTRY to EXIT at all. */
+ /* Make sure there is a path from ENTRY to EXIT at all. */
gcc_assert (di->nodes == (unsigned int) n_basic_blocks + 1);
}
@@ -659,11 +659,11 @@ free_dominance_info (enum cdi_direction dir)
FOR_ALL_BB (bb)
{
- delete_from_dominance_info (dir, bb);
+ et_free_tree_force (bb->dom[dir]);
+ bb->dom[dir] = NULL;
}
- /* If there are any nodes left, something is wrong. */
- gcc_assert (!n_bbs_in_dom_tree[dir]);
+ n_bbs_in_dom_tree[dir] = 0;
dom_computed[dir] = DOM_NONE;
}
@@ -797,6 +797,27 @@ nearest_common_dominator (enum cdi_direction dir, basic_block bb1, basic_block b
return et_nca (bb1->dom[dir], bb2->dom[dir])->data;
}
+
+/* Find the nearest common dominator for the basic blocks in BLOCKS,
+ using dominance direction DIR. */
+
+basic_block
+nearest_common_dominator_for_set (enum cdi_direction dir, bitmap blocks)
+{
+ unsigned i, first;
+ bitmap_iterator bi;
+ basic_block dom;
+
+ first = bitmap_first_set_bit (blocks);
+ dom = BASIC_BLOCK (first);
+ EXECUTE_IF_SET_IN_BITMAP (blocks, 0, i, bi)
+ if (dom != BASIC_BLOCK (i))
+ dom = nearest_common_dominator (dir, dom, BASIC_BLOCK (i));
+
+ return dom;
+}
+
+
/* Return TRUE in case BB1 is dominated by BB2. */
bool
dominated_by_p (enum cdi_direction dir, basic_block bb1, basic_block bb2)