@@ -1844,10 +1844,9 @@ class LoopVectorizationCostModel {
1844
1844
Ops, [this , VF](Value *V) { return this ->needsExtract (V, VF); }));
1845
1845
}
1846
1846
1847
- // / Determines if we have the infrastructure to vectorize loop \p L and its
1847
+ // / Determines if we have the infrastructure to vectorize the loop and its
1848
1848
// / epilogue, assuming the main loop is vectorized by \p VF.
1849
- bool isCandidateForEpilogueVectorization (const Loop &L,
1850
- const ElementCount VF) const ;
1849
+ bool isCandidateForEpilogueVectorization (const ElementCount VF) const ;
1851
1850
1852
1851
// / Returns true if epilogue vectorization is considered profitable, and
1853
1852
// / false otherwise.
@@ -5555,31 +5554,32 @@ VectorizationFactor LoopVectorizationCostModel::selectVectorizationFactor(
5555
5554
}
5556
5555
5557
5556
bool LoopVectorizationCostModel::isCandidateForEpilogueVectorization (
5558
- const Loop &L, ElementCount VF) const {
5557
+ ElementCount VF) const {
5559
5558
// Cross iteration phis such as reductions need special handling and are
5560
5559
// currently unsupported.
5561
- if (any_of (L. getHeader ()->phis (),
5560
+ if (any_of (TheLoop-> getHeader ()->phis (),
5562
5561
[&](PHINode &Phi) { return Legal->isFixedOrderRecurrence (&Phi); }))
5563
5562
return false ;
5564
5563
5565
5564
// Phis with uses outside of the loop require special handling and are
5566
5565
// currently unsupported.
5567
5566
for (const auto &Entry : Legal->getInductionVars ()) {
5568
5567
// Look for uses of the value of the induction at the last iteration.
5569
- Value *PostInc = Entry.first ->getIncomingValueForBlock (L.getLoopLatch ());
5568
+ Value *PostInc =
5569
+ Entry.first ->getIncomingValueForBlock (TheLoop->getLoopLatch ());
5570
5570
for (User *U : PostInc->users ())
5571
- if (!L. contains (cast<Instruction>(U)))
5571
+ if (!TheLoop-> contains (cast<Instruction>(U)))
5572
5572
return false ;
5573
5573
// Look for uses of penultimate value of the induction.
5574
5574
for (User *U : Entry.first ->users ())
5575
- if (!L. contains (cast<Instruction>(U)))
5575
+ if (!TheLoop-> contains (cast<Instruction>(U)))
5576
5576
return false ;
5577
5577
}
5578
5578
5579
5579
// Epilogue vectorization code has not been auditted to ensure it handles
5580
5580
// non-latch exits properly. It may be fine, but it needs auditted and
5581
5581
// tested.
5582
- if (L. getExitingBlock () != L. getLoopLatch ())
5582
+ if (TheLoop-> getExitingBlock () != TheLoop-> getLoopLatch ())
5583
5583
return false ;
5584
5584
5585
5585
return true ;
@@ -5626,7 +5626,7 @@ LoopVectorizationCostModel::selectEpilogueVectorizationFactor(
5626
5626
5627
5627
// Not really a cost consideration, but check for unsupported cases here to
5628
5628
// simplify the logic.
5629
- if (!isCandidateForEpilogueVectorization (*TheLoop, MainLoopVF)) {
5629
+ if (!isCandidateForEpilogueVectorization (MainLoopVF)) {
5630
5630
LLVM_DEBUG (dbgs () << " LEV: Unable to vectorize epilogue because the loop "
5631
5631
" is not a supported candidate.\n " );
5632
5632
return Result;
0 commit comments