[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
Tue Jun 9 13:49:51 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:

So maybe I should refactor them first and then build this patch on top of that. I'll work on it.

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


More information about the llvm-branch-commits mailing list