Skip to content

Commit 71d75fe

Browse files
committed
update VPTransformState to include TargetTransformInfo
- pass down the TTI from the LoopVectorizationPlanner into the VPTransformState - this will allow this information to all VPRecipe::execute functions when they generate new IR
1 parent 3a236c7 commit 71d75fe

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7631,7 +7631,8 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
76317631
LLVM_DEBUG(BestVPlan.dump());
76327632

76337633
// Perform the actual loop transformation.
7634-
VPTransformState State(BestVF, BestUF, LI, DT, ILV.Builder, &ILV, &BestVPlan);
7634+
VPTransformState State(&TTI, BestVF, BestUF, LI, DT, ILV.Builder, &ILV,
7635+
&BestVPlan);
76357636

76367637
// 0. Generate SCEV-dependent code into the preheader, including TripCount,
76377638
// before making any changes to the CFG.

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,11 @@ VPBasicBlock::iterator VPBasicBlock::getFirstNonPhi() {
222222
return It;
223223
}
224224

225-
VPTransformState::VPTransformState(ElementCount VF, unsigned UF, LoopInfo *LI,
225+
VPTransformState::VPTransformState(const TargetTransformInfo *TTI,
226+
ElementCount VF, unsigned UF, LoopInfo *LI,
226227
DominatorTree *DT, IRBuilderBase &Builder,
227228
InnerLoopVectorizer *ILV, VPlan *Plan)
228-
: VF(VF), CFG(DT), LI(LI), Builder(Builder), ILV(ILV), Plan(Plan),
229+
: TTI(TTI), VF(VF), CFG(DT), LI(LI), Builder(Builder), ILV(ILV), Plan(Plan),
229230
LVer(nullptr), TypeAnalysis(Plan->getCanonicalIV()->getScalarType()) {}
230231

231232
Value *VPTransformState::get(VPValue *Def, const VPLane &Lane) {

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,11 @@ class VPLane {
234234
/// VPTransformState holds information passed down when "executing" a VPlan,
235235
/// needed for generating the output IR.
236236
struct VPTransformState {
237-
VPTransformState(ElementCount VF, unsigned UF, LoopInfo *LI,
238-
DominatorTree *DT, IRBuilderBase &Builder,
237+
VPTransformState(const TargetTransformInfo *TTI, ElementCount VF, unsigned UF,
238+
LoopInfo *LI, DominatorTree *DT, IRBuilderBase &Builder,
239239
InnerLoopVectorizer *ILV, VPlan *Plan);
240+
/// Target Transform Info.
241+
const TargetTransformInfo *TTI;
240242

241243
/// The chosen Vectorization Factor of the loop being vectorized.
242244
ElementCount VF;

0 commit comments

Comments
 (0)