[patch] Fix PR43464: update loop closed SSA form once copy prop is done
Richard Guenther
rguenther@suse.de
Tue Mar 30 09:48:00 GMT 2010
On Mon, 29 Mar 2010, Sebastian Pop wrote:
> On Fri, Mar 26, 2010 at 04:51, Richard Guenther <rguenther@suse.de> wrote:
> > But we already analyzed that copyprop is _not_ the problem. Â The
> > problem is the pass that introduces the two-arg loop-closed PHI
> > node.
>
> Note that pass_tree_unswitch is not the only pass that introduces
> the two-arg loop-closed PHI. Copyprop is another pass that does that,
> as it has a TODO_cleanup_cfg that calls cleanup_tree_cfg.
>
> cleanup_tree_cfg_noloop called from cleanup_tree_cfg is destroying the
> CFG structure needed for the LCSSA form: it removes all the single entry
> basic blocks that were placed after the loops for the LCSSA form.
>
> Interestingly, cleanup_tree_cfg is calling repair_loop_structures
>
> if (current_loops != NULL
> && loops_state_satisfies_p (LOOPS_NEED_FIXUP))
> repair_loop_structures ();
>
> that in turn calls rewrite_into_loop_closed_ssa like this:
>
> /* This usually does nothing. But sometimes parts of cfg that originally
> were inside a loop get out of it due to edge removal (since they
> become unreachable by back edges from latch). */
> if (loops_state_satisfies_p (LOOP_CLOSED_SSA))
> rewrite_into_loop_closed_ssa (changed_bbs, TODO_update_ssa);
>
> and this call to rewrite_into_loop_closed_ssa does not add the single
> entry basic block needed to have a proper LCSSA form.
>
> Should rewrite_into_loop_closed_ssa replace the missing basic blocks,
> or should cleanup_tree_cfg_noloop be fixed to not destroy the CFG
> form needed for the LCSSA?
Well, I'd say avoid breaking LCSSA will be cheaper in the end.
But Zdenek should know more here.
Richard.
More information about the Gcc-patches
mailing list