[llvm] [VPlan] Introduce ExitPhi VPInstruction, use to create phi for FOR. (PR #94760)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 06:01:00 PDT 2024


================
@@ -193,11 +193,12 @@ void VPLiveOut::fixPhi(VPlan &Plan, VPTransformState &State) {
   VPValue *ExitValue = getOperand(0);
   if (vputils::isUniformAfterVectorization(ExitValue))
     Lane = VPLane::getFirstLane();
-  VPBasicBlock *MiddleVPBB =
-      cast<VPBasicBlock>(Plan.getVectorLoopRegion()->getSingleSuccessor());
-  BasicBlock *MiddleBB = State.CFG.VPBB2IRBB[MiddleVPBB];
-  Phi->addIncoming(State.get(ExitValue, VPIteration(State.UF - 1, Lane)),
-                   MiddleBB);
+  BasicBlock *PredBB = State.CFG.VPBB2IRBB[Pred];
----------------
ayalz wrote:

nit (independent): seems clearer for the above to do:
```
  VPValue *ExitValue = getOperand(0);
  auto Lane = vputils::isUniformAfterVectorization(ExitValue) ? VPLane::getLastLaneForVF(State.VF) : VPLane::getFirstLane();
```

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


More information about the llvm-commits mailing list