	PR middle-end/56113
	* fwprop.c (fwprop_init): Set up loops without CFG modifications.
	* domwalk.c (walk_dominator_tree): Be intollerant of dominator
	tree modifications while walking it.

Index: fwprop.c
===================================================================
--- fwprop.c	(revision 195559)
+++ fwprop.c	(working copy)
@@ -1404,10 +1404,10 @@ fwprop_init (void)
   calculate_dominance_info (CDI_DOMINATORS);
 
   /* We do not always want to propagate into loops, so we have to find
-     loops and be careful about them.  But we have to call flow_loops_find
-     before df_analyze, because flow_loops_find may introduce new jump
-     insns (sadly) if we are not working in cfglayout mode.  */
-  loop_optimizer_init (0);
+     loops and be careful about them.  Avoid CFG modifications so that
+     we don't have to update dominance information afterwards for
+     build_single_def_use_links.  */
+  loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
 
   build_single_def_use_links ();
   df_set_flags (DF_DEFER_INSN_RESCAN);
Index: domwalk.c
===================================================================
--- domwalk.c	(revision 195559)
+++ domwalk.c	(working copy)
@@ -149,6 +149,10 @@ walk_dominator_tree (struct dom_walk_dat
 
   while (true)
     {
+      /* Thou shall not modify the dominator tree while walking it
+         (nor present it without fast queries available).  */
+      gcc_checking_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
