From 7472f1da960983b1556c574cdda4770b8ee568ed Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sat, 13 May 2023 12:27:53 +0100 Subject: [PATCH] [VPlan] Change LoopVectorizationPlanner::TTI to be const reference (NFC) --- llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h | 4 ++-- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h index 50f5334..106a247 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h @@ -261,7 +261,7 @@ class LoopVectorizationPlanner { const TargetLibraryInfo *TLI; /// Target Transform Info. - const TargetTransformInfo *TTI; + const TargetTransformInfo &TTI; /// The legality analysis. LoopVectorizationLegality *Legal; @@ -285,7 +285,7 @@ class LoopVectorizationPlanner { public: LoopVectorizationPlanner(Loop *L, LoopInfo *LI, const TargetLibraryInfo *TLI, - const TargetTransformInfo *TTI, + const TargetTransformInfo &TTI, LoopVectorizationLegality *Legal, LoopVectorizationCostModel &CM, InterleavedAccessInfo &IAI, diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 2f10393..f51679e 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -7515,7 +7515,7 @@ LoopVectorizationPlanner::planInVPlanNativePath(ElementCount UserVF) { // reasonable one. if (UserVF.isZero()) { VF = ElementCount::getFixed(determineVPlanVF( - TTI->getRegisterBitWidth(TargetTransformInfo::RGK_FixedWidthVector) + TTI.getRegisterBitWidth(TargetTransformInfo::RGK_FixedWidthVector) .getFixedValue(), CM)); LLVM_DEBUG(dbgs() << "LV: VPlan computed VF " << VF << ".\n"); @@ -7559,7 +7559,7 @@ LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC) { // Invalidate interleave groups if all blocks of loop will be predicated. if (CM.blockNeedsPredicationForAnyReason(OrigLoop->getHeader()) && - !useMaskedInterleavedAccesses(*TTI)) { + !useMaskedInterleavedAccesses(TTI)) { LLVM_DEBUG( dbgs() << "LV: Invalidate all interleaved groups due to fold-tail by masking " @@ -9200,7 +9200,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions( VecOp = FMulRecipe; } VPReductionRecipe *RedRecipe = - new VPReductionRecipe(&RdxDesc, R, ChainOp, VecOp, CondOp, TTI); + new VPReductionRecipe(&RdxDesc, R, ChainOp, VecOp, CondOp, &TTI); WidenRecipe->getVPSingleValue()->replaceAllUsesWith(RedRecipe); Plan->removeVPValueFor(R); Plan->addVPValue(R, RedRecipe); @@ -9900,7 +9900,7 @@ static bool processLoopInVPlanNativePath( // Use the planner for outer loop vectorization. // TODO: CM is not used at this point inside the planner. Turn CM into an // optional argument if we don't need it in the future. - LoopVectorizationPlanner LVP(L, LI, TLI, TTI, LVL, CM, IAI, PSE, Hints, ORE); + LoopVectorizationPlanner LVP(L, LI, TLI, *TTI, LVL, CM, IAI, PSE, Hints, ORE); // Get user vectorization factor. ElementCount UserVF = Hints.getWidth(); @@ -10240,7 +10240,8 @@ bool LoopVectorizePass::processLoop(Loop *L) { LoopVectorizationCostModel CM(SEL, L, PSE, LI, &LVL, *TTI, TLI, DB, AC, ORE, F, &Hints, IAI); // Use the planner for vectorization. - LoopVectorizationPlanner LVP(L, LI, TLI, TTI, &LVL, CM, IAI, PSE, Hints, ORE); + LoopVectorizationPlanner LVP(L, LI, TLI, *TTI, &LVL, CM, IAI, PSE, Hints, + ORE); // Get user vectorization factor and interleave count. ElementCount UserVF = Hints.getWidth(); -- 2.7.4