Skip to content

Commit 4c104c3

Browse files
committed
Put VPDT as pointer into State
1 parent 415d657 commit 4c104c3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ VPTransformState::VPTransformState(const TargetTransformInfo *TTI,
220220
Loop *CurrentParentLoop, Type *CanonicalIVTy)
221221
: TTI(TTI), VF(VF), CFG(DT), LI(LI), Builder(Builder), ILV(ILV), Plan(Plan),
222222
CurrentParentLoop(CurrentParentLoop), LVer(nullptr),
223-
TypeAnalysis(CanonicalIVTy) {}
223+
TypeAnalysis(CanonicalIVTy), VPDT(new VPDominatorTree(*Plan)) {}
224+
225+
VPTransformState::~VPTransformState() { delete VPDT; }
224226

225227
Value *VPTransformState::get(VPValue *Def, const VPLane &Lane) {
226228
if (Def->isLiveIn())
@@ -263,11 +265,10 @@ Value *VPTransformState::get(VPValue *Def, bool NeedsScalar) {
263265
return Data.VPV2Vector[Def];
264266

265267
auto GetBroadcastInstrs = [this, Def](Value *V) {
266-
VPDominatorTree VPDT(*Plan);
267268
bool SafeToHoist =
268269
!Def->hasDefiningRecipe() ||
269-
VPDT.properlyDominates(Def->getDefiningRecipe()->getParent(),
270-
Plan->getVectorPreheader());
270+
VPDT->properlyDominates(Def->getDefiningRecipe()->getParent(),
271+
Plan->getVectorPreheader());
271272

272273
if (VF.isScalar())
273274
return V;

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class VPlanSlp;
6767
class Value;
6868
class LoopVectorizationCostModel;
6969
class LoopVersioning;
70+
class VPDominatorTree;
7071

7172
struct VPCostContext;
7273

@@ -238,6 +239,7 @@ struct VPTransformState {
238239
LoopInfo *LI, DominatorTree *DT, IRBuilderBase &Builder,
239240
InnerLoopVectorizer *ILV, VPlan *Plan,
240241
Loop *CurrentParentLoop, Type *CanonicalIVTy);
242+
~VPTransformState();
241243
/// Target Transform Info.
242244
const TargetTransformInfo *TTI;
243245

@@ -390,6 +392,9 @@ struct VPTransformState {
390392

391393
/// VPlan-based type analysis.
392394
VPTypeAnalysis TypeAnalysis;
395+
396+
/// VPlan-based dominator tree.
397+
VPDominatorTree *VPDT = nullptr;
393398
};
394399

395400
/// VPBlockBase is the building block of the Hierarchical Control-Flow Graph.

0 commit comments

Comments
 (0)