[llvm] [VPlan] Update scalar induction resume values in VPlan. (PR #110577)

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 1 05:07:45 PST 2024


================
@@ -2615,27 +2627,21 @@ PHINode *InnerLoopVectorizer::createInductionResumeValue(
     }
   }
 
-  // Create phi nodes to merge from the backedge-taken check block.
-  PHINode *BCResumeVal =
-      PHINode::Create(OrigPhi->getType(), 3, "bc.resume.val",
-                      LoopScalarPreHeader->getFirstNonPHIIt());
-  // Copy original phi DL over to the new one.
-  BCResumeVal->setDebugLoc(OrigPhi->getDebugLoc());
+  auto *ResumePhiRecipe = ScalarPHBuilder.createNaryOp(
+      VPInstruction::ResumePhi,
+      {Plan.getOrAddLiveIn(EndValue), Plan.getOrAddLiveIn(II.getStartValue())},
+      OrigPhi->getDebugLoc(), "bc.resume.val");
+  assert(PhiR->getNumOperands() == 0 && "PhiR should not have any operands");
+  PhiR->addOperand(ResumePhiRecipe);
----------------
ayalz wrote:

Having two Phi Recipes, better rename `PhiR` say into `InductionPhiIRI` to distinguish it from `ResumePhiRecipe`?

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


More information about the llvm-commits mailing list