aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2007-06-08 09:28:50 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2007-06-08 07:28:50 +0000
commit1fc3998daa162619e2826523d2b9efad2a3c7725 (patch)
treeac0d18d45cdef103f030e114f2c61dc3ba28ccf0
parent32a7ab3d8069ff4cc16c3be5ff157e732f55203c (diff)
downloadgcc-1fc3998daa162619e2826523d2b9efad2a3c7725.zip
gcc-1fc3998daa162619e2826523d2b9efad2a3c7725.tar.gz
gcc-1fc3998daa162619e2826523d2b9efad2a3c7725.tar.bz2
re PR middle-end/32209 (Boot failure Comparing stages 2 and 3 with --disable-checking)
PR middle-end/32209 * dominance.c (debug_dominance_tree, debug_dominance_tree_1): New functions. (verify_dominators): Do not change dominance tree. From-SVN: r125563
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/dominance.c67
2 files changed, 59 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ccf4318..14ac46a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2007-06-08 Zdenek Dvorak <dvorakz@suse.cz>
+
+ PR middle-end/32209
+ * dominance.c (debug_dominance_tree, debug_dominance_tree_1): New
+ functions.
+ (verify_dominators): Do not change dominance tree.
+
2007-06-08 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/constraints.md: New file.
diff --git a/gcc/dominance.c b/gcc/dominance.c
index 57a9df6..3ad0d20 100644
--- a/gcc/dominance.c
+++ b/gcc/dominance.c
@@ -124,6 +124,7 @@ static TBB eval (struct dom_info *, TBB);
static void link_roots (struct dom_info *, TBB, TBB);
static void calc_idoms (struct dom_info *, bool);
void debug_dominance_info (enum cdi_direction);
+void debug_dominance_tree (enum cdi_direction, basic_block);
/* Keeps track of the*/
static unsigned n_bbs_in_dom_tree[2];
@@ -970,37 +971,35 @@ void
verify_dominators (enum cdi_direction dir)
{
int err = 0;
- basic_block *old_dom = XNEWVEC (basic_block, last_basic_block);
- basic_block bb, imm_bb;
+ basic_block bb, imm_bb, imm_bb_correct;
+ struct dom_info di;
+ bool reverse = (dir == CDI_POST_DOMINATORS) ? true : false;
gcc_assert (dom_info_available_p (dir));
+ init_dom_info (&di, dir);
+ calc_dfs_tree (&di, reverse);
+ calc_idoms (&di, reverse);
+
FOR_EACH_BB (bb)
{
- old_dom[bb->index] = get_immediate_dominator (dir, bb);
-
- if (!old_dom[bb->index])
+ imm_bb = get_immediate_dominator (dir, bb);
+ if (!imm_bb)
{
error ("dominator of %d status unknown", bb->index);
err = 1;
}
- }
-
- free_dominance_info (dir);
- calculate_dominance_info (dir);
- FOR_EACH_BB (bb)
- {
- imm_bb = get_immediate_dominator (dir, bb);
- if (old_dom[bb->index] != imm_bb)
+ imm_bb_correct = di.dfs_to_bb[di.dom[di.dfs_order[bb->index]]];
+ if (imm_bb != imm_bb_correct)
{
error ("dominator of %d should be %d, not %d",
- bb->index, imm_bb->index, old_dom[bb->index]->index);
+ bb->index, imm_bb_correct->index, imm_bb->index);
err = 1;
}
}
- free (old_dom);
+ free_dom_info (&di);
gcc_assert (!err);
}
@@ -1453,3 +1452,41 @@ debug_dominance_info (enum cdi_direction dir)
if ((bb2 = get_immediate_dominator (dir, bb)))
fprintf (stderr, "%i %i\n", bb->index, bb2->index);
}
+
+/* Prints to stderr representation of the dominance tree (for direction DIR)
+ rooted in ROOT, indented by INDENT tabelators. If INDENT_FIRST is false,
+ the first line of the output is not indented. */
+
+static void
+debug_dominance_tree_1 (enum cdi_direction dir, basic_block root,
+ unsigned indent, bool indent_first)
+{
+ basic_block son;
+ unsigned i;
+ bool first = true;
+
+ if (indent_first)
+ for (i = 0; i < indent; i++)
+ fprintf (stderr, "\t");
+ fprintf (stderr, "%d\t", root->index);
+
+ for (son = first_dom_son (dir, root);
+ son;
+ son = next_dom_son (dir, son))
+ {
+ debug_dominance_tree_1 (dir, son, indent + 1, !first);
+ first = false;
+ }
+
+ if (first)
+ fprintf (stderr, "\n");
+}
+
+/* Prints to stderr representation of the dominance tree (for direction DIR)
+ rooted in ROOT. */
+
+void
+debug_dominance_tree (enum cdi_direction dir, basic_block root)
+{
+ debug_dominance_tree_1 (dir, root, 0, false);
+}