This cuts another 250s off the testcase in PR46590 by calling update_ssa from complete unrolling only after all innermost loops are processed once.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2012-09-05 Richard Guenther <rguent...@suse.de> PR tree-optimization/46590 * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Do not update SSA form here. (canonicalize_induction_variables): Assert we do not need to update SSA form. (tree_unroll_loops_completely): Update SSA form here. * tree-ssa-loop-manip.c (gimple_duplicate_loop_to_header_edge): Do not verify loop-closed SSA form if SSA form is not up-to-date. Index: gcc/tree-ssa-loop-ivcanon.c =================================================================== --- gcc/tree-ssa-loop-ivcanon.c (revision 190968) +++ gcc/tree-ssa-loop-ivcanon.c (working copy) @@ -414,7 +414,6 @@ try_unroll_loop_completely (struct loop else gimple_cond_make_false (cond); update_stmt (cond); - update_ssa (TODO_update_ssa); if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Unrolled loop %d completely.\n", loop->num); @@ -493,6 +492,7 @@ canonicalize_induction_variables (void) true, UL_SINGLE_ITER, true); } + gcc_assert (!need_ssa_update_p (cfun)); /* Clean up the information about numbers of iterations, since brute force evaluation could reveal new information. */ @@ -536,6 +536,8 @@ tree_unroll_loops_completely (bool may_i if (changed) { + update_ssa (TODO_update_ssa); + /* This will take care of removing completely unrolled loops from the loop structures so we can continue unrolling now innermost loops. */ Index: gcc/tree-ssa-loop-manip.c =================================================================== --- gcc/tree-ssa-loop-manip.c (revision 190968) +++ gcc/tree-ssa-loop-manip.c (working copy) @@ -752,7 +752,13 @@ gimple_duplicate_loop_to_header_edge (st return false; #ifdef ENABLE_CHECKING - if (loops_state_satisfies_p (LOOP_CLOSED_SSA)) + /* ??? This forces needless update_ssa calls after processing each + loop instead of just once after processing all loops. We should + instead verify that loop-closed SSA form is up-to-date for LOOP + only (and possibly SSA form). For now just skip verifying if + there are to-be renamed variables. */ + if (!need_ssa_update_p (cfun) + && loops_state_satisfies_p (LOOP_CLOSED_SSA)) verify_loop_closed_ssa (true); #endif