Skip to content

Commit 70de0b8

Browse files
authored
[LV][NFC] Simplify initialization of MinProfitableTripCount (#113445)
Iteration runtime check confirms whether the trip count is greater than VFxUF at least. Therefore, there is no need to adjust the MinProfitableTripCount to VF if it is zero. Retaining the original MinProfitableTripCount information is also beneficial for supporting more profitable runtime checks in the future.
1 parent 7de1eff commit 70de0b8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -470,18 +470,14 @@ class InnerLoopVectorizer {
470470
ProfileSummaryInfo *PSI, GeneratedRTChecks &RTChecks,
471471
VPlan &Plan)
472472
: OrigLoop(OrigLoop), PSE(PSE), LI(LI), DT(DT), TLI(TLI), TTI(TTI),
473-
AC(AC), ORE(ORE), VF(VecWidth), UF(UnrollFactor),
473+
AC(AC), ORE(ORE), VF(VecWidth),
474+
MinProfitableTripCount(MinProfitableTripCount), UF(UnrollFactor),
474475
Builder(PSE.getSE()->getContext()), Legal(LVL), Cost(CM), BFI(BFI),
475476
PSI(PSI), RTChecks(RTChecks), Plan(Plan) {
476477
// Query this against the original loop and save it here because the profile
477478
// of the original loop header may change as the transformation happens.
478479
OptForSizeBasedOnProfile = llvm::shouldOptimizeForSize(
479480
OrigLoop->getHeader(), PSI, BFI, PGSOQueryType::IRPass);
480-
481-
if (MinProfitableTripCount.isZero())
482-
this->MinProfitableTripCount = VecWidth;
483-
else
484-
this->MinProfitableTripCount = MinProfitableTripCount;
485481
}
486482

487483
virtual ~InnerLoopVectorizer() = default;

0 commit comments

Comments
 (0)