Currently verify_loop_structure assumes dominators are up-to-date. Most of the callers of verify_loop_structure verify dominators before calling it, some do it afterwards, some don't do it at all. This cleans things up by moving the verification into verify_loop_structure. It also notices some unconditional verifier calls and wraps them in ENABLE_CHECKING properly.
Bootstrap and regtest pending on x86_64-unknown-linux-gnu. Richard. 2012-03-05 Richard Guenther <rguent...@suse.de> * cfgloop.c (verify_loop_structure): Verify dominators before using them. * graphite-clast-to-gimple.c (graphite_verify): Do not verify dominators from here. * graphite-scop-detection.c (create_sese_edges): Likewise. * loop-doloop.c (doloop_optimize_loops): Likewise. * loop-init.c (loop_optimizer_init): Likewise. * loop-unroll.c (unroll_and_peel_loops): Likewise. * loop-unswitch.c (unswitch_loops): Likewise. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Likewise. * tree-parloops.c (parallelize_loops): Likewise. Verify only when checking is enabled. * tree-loop-distribution.c (tree_loop_distribution): Likewise. Index: graphite-clast-to-gimple.c =================================================================== --- graphite-clast-to-gimple.c (revision 184932) +++ graphite-clast-to-gimple.c (working copy) @@ -55,7 +55,6 @@ graphite_verify (void) { #ifdef ENABLE_CHECKING verify_loop_structure (); - verify_dominators (CDI_DOMINATORS); verify_loop_closed_ssa (true); #endif } Index: graphite-scop-detection.c =================================================================== --- graphite-scop-detection.c (revision 184932) +++ graphite-scop-detection.c (working copy) @@ -1026,7 +1026,6 @@ create_sese_edges (VEC (sd_region, heap) #ifdef ENABLE_CHECKING verify_loop_structure (); - verify_dominators (CDI_DOMINATORS); verify_ssa (false); #endif } Index: loop-doloop.c =================================================================== --- loop-doloop.c (revision 184932) +++ loop-doloop.c (working copy) @@ -747,7 +747,6 @@ doloop_optimize_loops (void) iv_analysis_done (); #ifdef ENABLE_CHECKING - verify_dominators (CDI_DOMINATORS); verify_loop_structure (); #endif } Index: loop-init.c =================================================================== --- loop-init.c (revision 184932) +++ loop-init.c (working copy) @@ -91,7 +91,6 @@ loop_optimizer_init (unsigned flags) flow_loops_dump (dump_file, NULL, 1); #ifdef ENABLE_CHECKING - verify_dominators (CDI_DOMINATORS); verify_loop_structure (); #endif } Index: loop-unroll.c =================================================================== --- loop-unroll.c (revision 184932) +++ loop-unroll.c (working copy) @@ -198,7 +198,6 @@ unroll_and_peel_loops (int flags) if (check) { #ifdef ENABLE_CHECKING - verify_dominators (CDI_DOMINATORS); verify_loop_structure (); #endif } @@ -255,7 +254,6 @@ peel_loops_completely (int flags) { peel_loop_completely (loop); #ifdef ENABLE_CHECKING - verify_dominators (CDI_DOMINATORS); verify_loop_structure (); #endif } Index: loop-unswitch.c =================================================================== --- loop-unswitch.c (revision 184932) +++ loop-unswitch.c (working copy) @@ -149,7 +149,6 @@ unswitch_loops (void) { unswitch_single_loop (loop, NULL_RTX, 0); #ifdef ENABLE_CHECKING - verify_dominators (CDI_DOMINATORS); verify_loop_structure (); #endif } Index: tree-loop-distribution.c =================================================================== --- tree-loop-distribution.c (revision 184932) +++ tree-loop-distribution.c (working copy) @@ -1293,7 +1293,9 @@ tree_loop_distribution (void) fprintf (dump_file, "Loop %d is the same.\n", num); } +#ifdef ENABLE_CHECKING verify_loop_structure (); +#endif VEC_free (gimple, heap, work_list); } Index: tree-parloops.c =================================================================== --- tree-parloops.c (revision 184932) +++ tree-parloops.c (working copy) @@ -2222,10 +2222,11 @@ parallelize_loops (void) } gen_parallel_loop (loop, reduction_list, n_threads, &niter_desc); +#ifdef ENABLE_CHECKING verify_flow_info (); - verify_dominators (CDI_DOMINATORS); verify_loop_structure (); verify_loop_closed_ssa (true); +#endif } free_stmt_vec_info_vec (); Index: tree-ssa-loop-manip.c =================================================================== --- tree-ssa-loop-manip.c (revision 184932) +++ tree-ssa-loop-manip.c (working copy) @@ -1096,7 +1096,6 @@ tree_transform_and_unroll_loop (struct l #ifdef ENABLE_CHECKING verify_flow_info (); - verify_dominators (CDI_DOMINATORS); verify_loop_structure (); verify_loop_closed_ssa (true); #endif Index: cfgloop.c =================================================================== --- cfgloop.c (revision 184932) +++ cfgloop.c (working copy) @@ -1318,6 +1318,9 @@ verify_loop_structure (void) loop_iterator li; struct loop_exit *exit, *mexit; + /* We need up-to-date dominators, verify them. */ + verify_dominators (CDI_DOMINATORS); + /* Check sizes. */ sizes = XCNEWVEC (unsigned, num); sizes[0] = 2;