[llvm] [LLE][LoopVersioning] Form LCSSA in Loop Versioning Pass before extending exit PHIs (PR #202296)

Amit Tiwari via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 05:04:19 PDT 2026


loopacino wrote:

Did some study on the passes invoking `versionLoop()` and #78696. Out of five call-sites, two of them (LoopFlatten, LoopVersioningLICM) are loop passes whose LCSSA condition is guaranteed by the loop-pass manager. For the other three, being function-passes, it seems forming LCSSA is not guaranteed–missing in LLE and LoopDistribution but present in LoopVersioning. I think asserting the LCSSA-check in the utility and forming it in the caller would be consistent with the LLVM convention, as also pointed above. LoopDistribution is one more caller that is not guaranteeing LCSSA. Would post the changes for this too. 

@VedantParanjape An interesting point to note is that in LoopPeel case, there's a point at which LCSSA breaks (and the fix was made to handle it), whereas here even the input to LLE is in non-LCSSA form, and nothing breaks LCSSA, making the two cases slightly different with the same end goal. 

https://github.com/llvm/llvm-project/pull/202296


More information about the llvm-commits mailing list