Skip to content

Commit a4c9206

Browse files
committed
Address comments
1 parent 20a125f commit a4c9206

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,24 +2385,21 @@ void VPlanTransforms::simplifyEVLIVs(VPlan &Plan) {
23852385
// Find the latch-exiting block and convert to variable-length stepping.
23862386
// Before: (branch-on-count CanonicalIVInc, VectorTripCount)
23872387
// After: (branch-on-count EVLIVInc, TripCount)
2388-
auto FindLatchExiting = [](VPBasicBlock *Entry) {
2389-
auto Range =
2390-
VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow(Entry));
2391-
auto It = find_if(Range, [&](VPBasicBlock *VPBB) {
2392-
return any_of(VPBB->successors(),
2393-
[&](VPBlockBase *Succ) { return Succ == Entry; });
2394-
});
2395-
return It != Range.end() ? *It : nullptr;
2396-
};
2397-
VPBasicBlock *LatchExiting = FindLatchExiting(Entry);
2398-
assert(LatchExiting && "LatchExiting is not found");
2388+
auto Range =
2389+
VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow(Entry));
2390+
auto It = find_if(Range, [&](VPBasicBlock *VPBB) {
2391+
return any_of(VPBB->successors(),
2392+
[&](VPBlockBase *Succ) { return Succ == Entry; });
2393+
});
2394+
assert((It != Range.end()) && "LatchExiting is not found");
2395+
VPBasicBlock *LatchExiting = *It;
23992396
auto *LatchExitingBr = cast<VPInstruction>(LatchExiting->getTerminator());
24002397
VPValue *ScalarIVInc;
2401-
if (!LatchExitingBr ||
2402-
!match(LatchExitingBr,
2403-
m_BranchOnCount(m_VPValue(ScalarIVInc),
2404-
m_Specific(&Plan.getVectorTripCount()))))
2405-
return;
2398+
assert(LatchExitingBr &&
2399+
match(LatchExitingBr,
2400+
m_BranchOnCount(m_VPValue(ScalarIVInc),
2401+
m_Specific(&Plan.getVectorTripCount()))) &&
2402+
"Unexpected terminator in EVL loop");
24062403
LatchExitingBr->setOperand(1, Plan.getTripCount());
24072404
ScalarIVInc->replaceAllUsesWith(EVLIncrement);
24082405
VPRecipeBase *IVIncR = ScalarIVInc->getDefiningRecipe();

0 commit comments

Comments
 (0)