@@ -687,10 +687,12 @@ class InnerLoopAndEpilogueVectorizer : public InnerLoopVectorizer {
687
687
const TargetTransformInfo *TTI, AssumptionCache *AC,
688
688
OptimizationRemarkEmitter *ORE, EpilogueLoopVectorizationInfo &EPI,
689
689
LoopVectorizationCostModel *CM, BlockFrequencyInfo *BFI,
690
- ProfileSummaryInfo *PSI, GeneratedRTChecks &Checks, VPlan &Plan)
691
- : InnerLoopVectorizer(OrigLoop, PSE, LI, DT, TLI, TTI, AC, ORE,
692
- EPI.MainLoopVF, EPI.MainLoopVF, EPI.MainLoopUF, CM,
693
- BFI, PSI, Checks, Plan),
690
+ ProfileSummaryInfo *PSI, GeneratedRTChecks &Checks, VPlan &Plan,
691
+ ElementCount VecWidth, ElementCount MinProfitableTripCount,
692
+ unsigned UnrollFactor)
693
+ : InnerLoopVectorizer(OrigLoop, PSE, LI, DT, TLI, TTI, AC, ORE, VecWidth,
694
+ MinProfitableTripCount, UnrollFactor, CM, BFI, PSI,
695
+ Checks, Plan),
694
696
EPI (EPI) {}
695
697
696
698
// Override this function to handle the more complex control flow around the
@@ -725,8 +727,9 @@ class EpilogueVectorizerMainLoop : public InnerLoopAndEpilogueVectorizer {
725
727
OptimizationRemarkEmitter *ORE, EpilogueLoopVectorizationInfo &EPI,
726
728
LoopVectorizationCostModel *CM, BlockFrequencyInfo *BFI,
727
729
ProfileSummaryInfo *PSI, GeneratedRTChecks &Check, VPlan &Plan)
728
- : InnerLoopAndEpilogueVectorizer(OrigLoop, PSE, LI, DT, TLI, TTI, AC, ORE,
729
- EPI, CM, BFI, PSI, Check, Plan) {}
730
+ : InnerLoopAndEpilogueVectorizer(
731
+ OrigLoop, PSE, LI, DT, TLI, TTI, AC, ORE, EPI, CM, BFI, PSI, Check,
732
+ Plan, EPI.MainLoopVF, EPI.MainLoopVF, EPI.MainLoopUF) {}
730
733
// / Implements the interface for creating a vectorized skeleton using the
731
734
// / *main loop* strategy (ie the first pass of vplan execution).
732
735
BasicBlock *createEpilogueVectorizedLoopSkeleton () final ;
@@ -752,8 +755,9 @@ class EpilogueVectorizerEpilogueLoop : public InnerLoopAndEpilogueVectorizer {
752
755
OptimizationRemarkEmitter *ORE, EpilogueLoopVectorizationInfo &EPI,
753
756
LoopVectorizationCostModel *CM, BlockFrequencyInfo *BFI,
754
757
ProfileSummaryInfo *PSI, GeneratedRTChecks &Checks, VPlan &Plan)
755
- : InnerLoopAndEpilogueVectorizer(OrigLoop, PSE, LI, DT, TLI, TTI, AC, ORE,
756
- EPI, CM, BFI, PSI, Checks, Plan) {
758
+ : InnerLoopAndEpilogueVectorizer(
759
+ OrigLoop, PSE, LI, DT, TLI, TTI, AC, ORE, EPI, CM, BFI, PSI, Checks,
760
+ Plan, EPI.EpilogueVF, EPI.EpilogueVF, EPI.EpilogueUF) {
757
761
TripCount = EPI.TripCount ;
758
762
}
759
763
// / Implements the interface for creating a vectorized skeleton using the
@@ -7508,8 +7512,9 @@ EpilogueVectorizerMainLoop::emitIterationCountCheck(BasicBlock *Bypass,
7508
7512
assert (Bypass && " Expected valid bypass basic block." );
7509
7513
Value *Count = getTripCount ();
7510
7514
MinProfitableTripCount = ElementCount::getFixed (0 );
7511
- Value *CheckMinIters = createIterationCountCheck (
7512
- ForEpilogue ? EPI.EpilogueVF : VF, ForEpilogue ? EPI.EpilogueUF : UF);
7515
+ Value *CheckMinIters =
7516
+ createIterationCountCheck (ForEpilogue ? EPI.EpilogueVF : EPI.MainLoopVF ,
7517
+ ForEpilogue ? EPI.EpilogueUF : EPI.MainLoopUF );
7513
7518
7514
7519
BasicBlock *const TCCheckBlock = LoopVectorPreHeader;
7515
7520
if (!ForEpilogue)
@@ -7641,9 +7646,7 @@ EpilogueVectorizerEpilogueLoop::emitMinimumVectorEpilogueIterCountCheck(
7641
7646
BranchInst &BI =
7642
7647
*BranchInst::Create (Bypass, LoopVectorPreHeader, CheckMinIters);
7643
7648
if (hasBranchWeightMD (*OrigLoop->getLoopLatch ()->getTerminator ())) {
7644
- // FIXME: See test Transforms/LoopVectorize/branch-weights.ll. I don't
7645
- // think the MainLoopStep is correct.
7646
- unsigned MainLoopStep = UF * VF.getKnownMinValue ();
7649
+ unsigned MainLoopStep = EPI.MainLoopUF * EPI.MainLoopVF .getKnownMinValue ();
7647
7650
unsigned EpilogueLoopStep =
7648
7651
EPI.EpilogueUF * EPI.EpilogueVF .getKnownMinValue ();
7649
7652
// We assume the remaining `Count` is equally distributed in
@@ -10288,8 +10291,6 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10288
10291
10289
10292
// Second pass vectorizes the epilogue and adjusts the control flow
10290
10293
// edges from the first pass.
10291
- EPI.MainLoopVF = EPI.EpilogueVF ;
10292
- EPI.MainLoopUF = EPI.EpilogueUF ;
10293
10294
EpilogueVectorizerEpilogueLoop EpilogILV (L, PSE, LI, DT, TLI, TTI, AC,
10294
10295
ORE, EPI, &CM, BFI, PSI,
10295
10296
Checks, BestEpiPlan);
0 commit comments