[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 01:52:42 PDT 2026


================
@@ -1370,11 +1373,17 @@ bool LoopInterchangeLegality::currentLimitations() {
 }
 
 bool LoopInterchangeLegality::findInductions(
-    Loop *L, SmallVectorImpl<PHINode *> &Inductions) {
-  for (PHINode &PHI : L->getHeader()->phis()) {
+    Loop *OuterLoop, Loop *InnerLoop, SmallVectorImpl<PHINode *> &Inductions) {
+  for (PHINode &PHI : InnerLoop->getHeader()->phis()) {
     InductionDescriptor ID;
-    if (InductionDescriptor::isInductionPHI(&PHI, L, SE, ID))
-      Inductions.push_back(&PHI);
+    if (!InductionDescriptor::isInductionPHI(&PHI, InnerLoop, SE, ID))
+      continue;
----------------
kasuga-fj wrote:

I've restacked this PR on top of #203197. I believe the code structure is now clearer than before.

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


More information about the llvm-branch-commits mailing list