Skip to content

Commit 981589a

Browse files
committed
Address comments
1 parent 645a5fa commit 981589a

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

0 commit comments

Comments
 (0)