[llvm-branch-commits] [llvm] [LoopInterchange] Reject if inner loop IV has outer-variant step (PR #202751)

Ryotaro Kasuga via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 11 04:29:54 PDT 2026


================
@@ -1251,8 +1251,14 @@ bool LoopInterchangeLegality::checkInductionsAndReductions(Loop *OuterLoop) {
     for (PHINode &PHI : CurLoop->getHeader()->phis()) {
       InductionDescriptor ID;
       if (InductionDescriptor::isInductionPHI(&PHI, CurLoop, SE, ID)) {
-        if (CurLoop == InnerLoop)
+        if (CurLoop == InnerLoop) {
----------------
kasuga-fj wrote:

Yes, I believe so. I think the miscompilation we're seeing now is caused by the inner loop's IV depending on the outer loop's IV in the very loops we are actually attempting to interchange. Deeper nested loops shouldn’t be involved in this issue...

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


More information about the llvm-branch-commits mailing list