[llvm] [VPlan] Add exit phi operands during initial construction (NFC). (PR #136455)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 13:32:47 PDT 2025


================
@@ -2505,35 +2505,43 @@ void VPlanTransforms::handleUncountableEarlyExit(
   VPBuilder EarlyExitB(VectorEarlyExitVPBB);
   for (VPRecipeBase &R : VPEarlyExitBlock->phis()) {
     auto *ExitIRI = cast<VPIRPhi>(&R);
-    PHINode &ExitPhi = ExitIRI->getIRPhi();
-    VPValue *IncomingFromEarlyExit = RecipeBuilder.getVPValueOrAddLiveIn(
-        ExitPhi.getIncomingValueForBlock(UncountableExitingBlock));
-
+    // By default, assume early exit operand is first, e.g., when the two exit
+    // blocks are distinct - VPEarlyExitBlock has a single predecessor.
+    unsigned EarlyExitIdx = 0;
     if (OrigLoop->getUniqueExitBlock()) {
----------------
ayalz wrote:

Independent: better ask instead if VPEarlyExitBlock has two predecessors? One (the last) was added above - VectorEarlyExitVPBB. This should match the case where OrigLoop has a unique exit block - which would be aka VPEarlyExitBlock, or rather its underlying EarlyExitIRBB.
```suggestion
    if (VPEarlyExitBlock->getNumPredecessors() == 2) {
```

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


More information about the llvm-commits mailing list