On Wed, Jan 30, 2013 at 12:01 AM, Steven Bosscher wrote:
> To prevent that mistake in the future, I've add an assert in dominance.c.

Hmm, that worked with my release-checking compiler of course, but
fails in at least tree-ssa-dom.c (same as for fwprop.c,
loop_optimizer_init destroys fast queries) and tree-ssa-loop-im.c (not
sure yet why).

NB, the fwprop.c change is independent and should go in. The domwalk.c
thing is something to maybe postpone to gcc 4.9.

Testing this patch now:

Index: domwalk.c
===================================================================
--- domwalk.c   (revision 195559)
+++ domwalk.c   (working copy)
@@ -147,8 +147,17 @@ walk_dominator_tree (struct dom_walk_dat
   bitmap_clear (visited);
   bitmap_set_bit (visited, ENTRY_BLOCK_PTR->index);

+  /* Make sure dominance information is available, and compute fast queries
+     if necessary.  */
+  gcc_assert (dom_info_state (walk_data->dom_direction) >= DOM_NO_FAST_QUERY);
+  calculate_dominance_info (walk_data->dom_direction);
+
   while (true)
     {
+      /* Thou shall not modify the dominator tree while walking it
+         (nor present it without fast queries available).  */
+      gcc_assert (dom_info_state (walk_data->dom_direction) == DOM_OK);
+
       /* Don't worry about unreachable blocks.  */
       if (EDGE_COUNT (bb->preds) > 0
          || bb == ENTRY_BLOCK_PTR

Reply via email to