Skip to content

Commit 97a3cfb

Browse files
committed
Address comments
1 parent 4df1019 commit 97a3cfb

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
@@ -2381,24 +2381,21 @@ void VPlanTransforms::simplifyEVLIVs(VPlan &Plan) {
23812381
// Find the latch-exiting block and convert to variable-length stepping.
23822382
// Before: (branch-on-count CanonicalIVInc, VectorTripCount)
23832383
// After: (branch-on-count EVLIVInc, TripCount)
2384-
auto FindLatchExiting = [](VPBasicBlock *Entry) {
2385-
auto Range =
2386-
VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow(Entry));
2387-
auto It = find_if(Range, [&](VPBasicBlock *VPBB) {
2388-
return any_of(VPBB->successors(),
2389-
[&](VPBlockBase *Succ) { return Succ == Entry; });
2390-
});
2391-
return It != Range.end() ? *It : nullptr;
2392-
};
2393-
VPBasicBlock *LatchExiting = FindLatchExiting(Entry);
2394-
assert(LatchExiting && "LatchExiting is not found");
2384+
auto Range =
2385+
VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow(Entry));
2386+
auto It = find_if(Range, [&](VPBasicBlock *VPBB) {
2387+
return any_of(VPBB->successors(),
2388+
[&](VPBlockBase *Succ) { return Succ == Entry; });
2389+
});
2390+
assert((It != Range.end()) && "LatchExiting is not found");
2391+
VPBasicBlock *LatchExiting = *It;
23952392
auto *LatchExitingBr = cast<VPInstruction>(LatchExiting->getTerminator());
23962393
VPValue *ScalarIVInc;
2397-
if (!LatchExitingBr ||
2398-
!match(LatchExitingBr,
2399-
m_BranchOnCount(m_VPValue(ScalarIVInc),
2400-
m_Specific(&Plan.getVectorTripCount()))))
2401-
return;
2394+
assert(LatchExitingBr &&
2395+
match(LatchExitingBr,
2396+
m_BranchOnCount(m_VPValue(ScalarIVInc),
2397+
m_Specific(&Plan.getVectorTripCount()))) &&
2398+
"Unexpected terminator in EVL loop");
24022399
LatchExitingBr->setOperand(1, Plan.getTripCount());
24032400
ScalarIVInc->replaceAllUsesWith(EVLIncrement);
24042401
VPRecipeBase *IVIncR = ScalarIVInc->getDefiningRecipe();

0 commit comments

Comments
 (0)