On Thu, 9 Jul 2015, Tom de Vries wrote: > On 07/07/15 17:58, Tom de Vries wrote: > > > If you can > > > handle one exit edge I also can't see the difficulty in handling > > > all exit edges. > > > > > > > Agreed, that doesn't look to complicated. I could call > > rewrite_virtuals_into_loop_closed_ssa for all loops in > > rewrite_virtuals_into_loop_closed_ssa, to get non-single_dom_exit loops > > exercising the code, and fix what breaks. > > Hmm, I just realised, it's more complicated than I thought. > > In loops with single_dom_exit, the exit dominates the uses outside the loop, > so I can replace the uses of the def with the uses of the exit phi result. > > If !single_dom_exit, the exit(s) may not dominate all uses, and I need to > insert non-loop-exit phi nodes to deal with that.
Yes. This is why I originally suggested to amend the regular loop-close-SSA rewriting code. Richard.