Skip to content

Commit 7472f1d

Browse files
committed
[VPlan] Change LoopVectorizationPlanner::TTI to be const reference (NFC)
1 parent c40277f commit 7472f1d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class LoopVectorizationPlanner {
261261
const TargetLibraryInfo *TLI;
262262

263263
/// Target Transform Info.
264-
const TargetTransformInfo *TTI;
264+
const TargetTransformInfo &TTI;
265265

266266
/// The legality analysis.
267267
LoopVectorizationLegality *Legal;
@@ -285,7 +285,7 @@ class LoopVectorizationPlanner {
285285

286286
public:
287287
LoopVectorizationPlanner(Loop *L, LoopInfo *LI, const TargetLibraryInfo *TLI,
288-
const TargetTransformInfo *TTI,
288+
const TargetTransformInfo &TTI,
289289
LoopVectorizationLegality *Legal,
290290
LoopVectorizationCostModel &CM,
291291
InterleavedAccessInfo &IAI,

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7515,7 +7515,7 @@ LoopVectorizationPlanner::planInVPlanNativePath(ElementCount UserVF) {
75157515
// reasonable one.
75167516
if (UserVF.isZero()) {
75177517
VF = ElementCount::getFixed(determineVPlanVF(
7518-
TTI->getRegisterBitWidth(TargetTransformInfo::RGK_FixedWidthVector)
7518+
TTI.getRegisterBitWidth(TargetTransformInfo::RGK_FixedWidthVector)
75197519
.getFixedValue(),
75207520
CM));
75217521
LLVM_DEBUG(dbgs() << "LV: VPlan computed VF " << VF << ".\n");
@@ -7559,7 +7559,7 @@ LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC) {
75597559

75607560
// Invalidate interleave groups if all blocks of loop will be predicated.
75617561
if (CM.blockNeedsPredicationForAnyReason(OrigLoop->getHeader()) &&
7562-
!useMaskedInterleavedAccesses(*TTI)) {
7562+
!useMaskedInterleavedAccesses(TTI)) {
75637563
LLVM_DEBUG(
75647564
dbgs()
75657565
<< "LV: Invalidate all interleaved groups due to fold-tail by masking "
@@ -9200,7 +9200,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
92009200
VecOp = FMulRecipe;
92019201
}
92029202
VPReductionRecipe *RedRecipe =
9203-
new VPReductionRecipe(&RdxDesc, R, ChainOp, VecOp, CondOp, TTI);
9203+
new VPReductionRecipe(&RdxDesc, R, ChainOp, VecOp, CondOp, &TTI);
92049204
WidenRecipe->getVPSingleValue()->replaceAllUsesWith(RedRecipe);
92059205
Plan->removeVPValueFor(R);
92069206
Plan->addVPValue(R, RedRecipe);
@@ -9900,7 +9900,7 @@ static bool processLoopInVPlanNativePath(
99009900
// Use the planner for outer loop vectorization.
99019901
// TODO: CM is not used at this point inside the planner. Turn CM into an
99029902
// optional argument if we don't need it in the future.
9903-
LoopVectorizationPlanner LVP(L, LI, TLI, TTI, LVL, CM, IAI, PSE, Hints, ORE);
9903+
LoopVectorizationPlanner LVP(L, LI, TLI, *TTI, LVL, CM, IAI, PSE, Hints, ORE);
99049904

99059905
// Get user vectorization factor.
99069906
ElementCount UserVF = Hints.getWidth();
@@ -10240,7 +10240,8 @@ bool LoopVectorizePass::processLoop(Loop *L) {
1024010240
LoopVectorizationCostModel CM(SEL, L, PSE, LI, &LVL, *TTI, TLI, DB, AC, ORE,
1024110241
F, &Hints, IAI);
1024210242
// Use the planner for vectorization.
10243-
LoopVectorizationPlanner LVP(L, LI, TLI, TTI, &LVL, CM, IAI, PSE, Hints, ORE);
10243+
LoopVectorizationPlanner LVP(L, LI, TLI, *TTI, &LVL, CM, IAI, PSE, Hints,
10244+
ORE);
1024410245

1024510246
// Get user vectorization factor and interleave count.
1024610247
ElementCount UserVF = Hints.getWidth();

0 commit comments

Comments
 (0)