@@ -2373,24 +2373,21 @@ void VPlanTransforms::simplifyEVLIVs(VPlan &Plan) {
2373
2373
// Find the latch-exiting block and convert to variable-length stepping.
2374
2374
// Before: (branch-on-count CanonicalIVInc, VectorTripCount)
2375
2375
// 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;
2387
2384
auto *LatchExitingBr = cast<VPInstruction>(LatchExiting->getTerminator ());
2388
2385
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 " ) ;
2394
2391
LatchExitingBr->setOperand (1 , Plan.getTripCount ());
2395
2392
ScalarIVInc->replaceAllUsesWith (EVLIncrement);
2396
2393
VPRecipeBase *IVIncR = ScalarIVInc->getDefiningRecipe ();
0 commit comments