[llvm] [LoopInterchange] Fix handling of PHI which refers to another PHI (PR #194364)

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 06:11:38 PDT 2026


================
@@ -1945,12 +1944,13 @@ bool LoopInterchangeTransform::transform(
 
     SmallVector<Instruction *, 8> InnerIndexVarList;
     for (PHINode *CurInductionPHI : InductionPHIs) {
-      if (CurInductionPHI->getIncomingBlock(0) == InnerLoopPreHeader)
-        InnerIndexVarList.push_back(
-            dyn_cast<Instruction>(CurInductionPHI->getIncomingValue(1)));
-      else
-        InnerIndexVarList.push_back(
-            dyn_cast<Instruction>(CurInductionPHI->getIncomingValue(0)));
+      Instruction *IncomingValue = dyn_cast<Instruction>(
----------------
sjoerdmeijer wrote:

This was already present, but do we need an assert here in case the incoming value is not an instruction? Not sure if this can occur. 

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


More information about the llvm-commits mailing list