Skip to content

Commit 5008301

Browse files
committed
Address comments
1 parent c969cf8 commit 5008301

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

0 commit comments

Comments
 (0)