[PATCH] D23288: [LoopSimplify] Rebuild LCSSA for the inner loop after separating nested loops.

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 18:55:23 PDT 2016


mzolotukhin added a comment.

> Imagine you had l1 nested inside L2 nested inside L3 nested inside L4. And this takes the l1 nested loop and makes it a sibling of L3. Now you have L2 nested inside L3 nested inside L4, and l1 nested inside L4. But my reading a code indicates we don't ever do this transform. But if you see a way we could do something similar, and end up with L in the code pointing at L3 for example, we might miss that L2 suddenly needs an LCSSA phi node in addition to L3 needing one.


In your example the ordering of the loops has changed - from my understanding of the code we don't do this (it'll be more like loop interchange, right?).

My understanding was that recursive invocation is needed to form LCSSA inside enclosing loop (e.g. if one subloop uses values from another), but since we're not changing internals of the loop, it should be preserved. A simple non-recursive run of formLCSSA on the new loop should fix LCSSA for values used outside it, including values defined in inner loops since their blocks are also blocks of the new loop, and that's the only (as far as I see now) place where LCSSA can be broken. Does this logic sound correct?


https://reviews.llvm.org/D23288





More information about the llvm-commits mailing list