Skip to content

Commit dc68b0b

Browse files
committed
Transform to branch-on-cond, update comments
1 parent bdb8062 commit dc68b0b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,7 +2458,7 @@ void VPlanTransforms::canonicalizeEVLLoops(VPlan &Plan) {
24582458

24592459
// Replace the use of VectorTripCount in the latch-exiting block.
24602460
// Before: (branch-on-count EVLIVInc, VectorTripCount)
2461-
// After: (branch-on-count AVLNext, 0)
2461+
// After: (branch-on-cond eq AVLNext, 0)
24622462

24632463
VPBasicBlock *LatchExiting =
24642464
HeaderVPBB->getPredecessors()[1]->getEntryBasicBlock();
@@ -2473,10 +2473,12 @@ void VPlanTransforms::canonicalizeEVLLoops(VPlan &Plan) {
24732473
"Unexpected terminator in EVL loop");
24742474

24752475
Type *AVLTy = VPTypeAnalysis(Plan).inferScalarType(AVLNext);
2476-
2477-
LatchExitingBr->setOperand(0, AVLNext);
2478-
LatchExitingBr->setOperand(
2479-
1, Plan.getOrAddLiveIn(ConstantInt::getNullValue(AVLTy)));
2476+
VPBuilder Builder(LatchExitingBr);
2477+
VPValue *Cmp =
2478+
Builder.createICmp(CmpInst::ICMP_EQ, AVLNext,
2479+
Plan.getOrAddLiveIn(ConstantInt::getNullValue(AVLTy)));
2480+
Builder.createNaryOp(VPInstruction::BranchOnCond, Cmp);
2481+
LatchExitingBr->eraseFromParent();
24802482
}
24812483

24822484
void VPlanTransforms::dropPoisonGeneratingRecipes(

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ struct VPlanTransforms {
225225
/// * Makes EVL-Phi concrete.
226226
// * Removes CanonicalIV and increment.
227227
/// * Replaces the exit condition from
228-
/// (branch-on-cond CanonicalIVInc, VectorTripCount)
228+
/// (branch-on-count CanonicalIVInc, VectorTripCount)
229229
/// to
230-
/// (branch-on-cond AVLNext, 0)
230+
/// (branch-on-cond eq AVLNext, 0)
231231
static void canonicalizeEVLLoops(VPlan &Plan);
232232

233233
/// Lower abstract recipes to concrete ones, that can be codegen'd. Use \p

0 commit comments

Comments
 (0)