[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
================
@@ -2501,35 +2501,41 @@ void VPlanTransforms::handleUncountableEarlyExit(
if (!ExitIRI)
break;
- PHINode &ExitPhi = ExitIRI->getIRPhi();
- VPValue *IncomingFromEarlyExit = RecipeBuilder.getVPValueOrAddLiveIn(
- ExitPhi.getIncomingValueForBlock(UncountableExitingBlock));
-
+ unsigned EarlyExitIdx = 0;
----------------
ayalz wrote:
Hmm, perhaps its better instead to set EarlyExitIdx to be the last operand, consistently?
If VPEarlyExitBlock has two predecessors, they are already ordered such that early exit is second, by construction. But its underlying IRBB may have its predecessors ordered the other way around, and it is this order which corresponds to the order of operands of VPEarlyExitBlock's phi recipes. Therefore, if early exit is the first predecessor of the underlying IRBB, we swap the operands of phi recipes, bringing them to match VPEarlyExitBlock's predecessor order with early exit being last (second).
https://github.com/llvm/llvm-project/pull/136455
More information about the llvm-commits
mailing list