Skip to content

Commit 5f8cde2

Browse files
committed
Address comments
1 parent 583023a commit 5f8cde2

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
@@ -2406,24 +2406,21 @@ void VPlanTransforms::simplifyEVLIVs(VPlan &Plan) {
24062406
// Find the latch-exiting block and convert to variable-length stepping.
24072407
// Before: (branch-on-count CanonicalIVInc, VectorTripCount)
24082408
// After: (branch-on-count EVLIVInc, TripCount)
2409-
auto FindLatchExiting = [](VPBasicBlock *Entry) {
2410-
auto Range =
2411-
VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow(Entry));
2412-
auto It = find_if(Range, [&](VPBasicBlock *VPBB) {
2413-
return any_of(VPBB->successors(),
2414-
[&](VPBlockBase *Succ) { return Succ == Entry; });
2415-
});
2416-
return It != Range.end() ? *It : nullptr;
2417-
};
2418-
VPBasicBlock *LatchExiting = FindLatchExiting(Entry);
2419-
assert(LatchExiting && "LatchExiting is not found");
2409+
auto Range =
2410+
VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow(Entry));
2411+
auto It = find_if(Range, [&](VPBasicBlock *VPBB) {
2412+
return any_of(VPBB->successors(),
2413+
[&](VPBlockBase *Succ) { return Succ == Entry; });
2414+
});
2415+
assert((It != Range.end()) && "LatchExiting is not found");
2416+
VPBasicBlock *LatchExiting = *It;
24202417
auto *LatchExitingBr = cast<VPInstruction>(LatchExiting->getTerminator());
24212418
VPValue *ScalarIVInc;
2422-
if (!LatchExitingBr ||
2423-
!match(LatchExitingBr,
2424-
m_BranchOnCount(m_VPValue(ScalarIVInc),
2425-
m_Specific(&Plan.getVectorTripCount()))))
2426-
return;
2419+
assert(LatchExitingBr &&
2420+
match(LatchExitingBr,
2421+
m_BranchOnCount(m_VPValue(ScalarIVInc),
2422+
m_Specific(&Plan.getVectorTripCount()))) &&
2423+
"Unexpected terminator in EVL loop");
24272424
LatchExitingBr->setOperand(1, Plan.getTripCount());
24282425
ScalarIVInc->replaceAllUsesWith(EVLIncrement);
24292426
VPRecipeBase *IVIncR = ScalarIVInc->getDefiningRecipe();

0 commit comments

Comments
 (0)