Skip to content

Commit 119300c

Browse files
committed
Put VPDT as pointer into State
1 parent c552c49 commit 119300c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

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

227229
Value *VPTransformState::get(VPValue *Def, const VPLane &Lane) {
228230
if (Def->isLiveIn())
@@ -265,11 +267,10 @@ Value *VPTransformState::get(VPValue *Def, bool NeedsScalar) {
265267
return Data.VPV2Vector[Def];
266268

267269
auto GetBroadcastInstrs = [this, Def](Value *V) {
268-
VPDominatorTree VPDT(*Plan);
269270
bool SafeToHoist =
270271
!Def->hasDefiningRecipe() ||
271-
VPDT.properlyDominates(Def->getDefiningRecipe()->getParent(),
272-
Plan->getVectorPreheader());
272+
VPDT->properlyDominates(Def->getDefiningRecipe()->getParent(),
273+
Plan->getVectorPreheader());
273274

274275
if (VF.isScalar())
275276
return V;

llvm/lib/Transforms/Vectorize/VPlanHelpers.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class VPRegionBlock;
3838
class VPlan;
3939
class Value;
4040
class LoopVersioning;
41+
class VPDominatorTree;
4142

4243
/// Returns a calculation for the total number of elements for a given \p VF.
4344
/// For fixed width vectors this value is a constant, whereas for scalable
@@ -351,6 +352,9 @@ struct VPTransformState {
351352

352353
/// VPlan-based type analysis.
353354
VPTypeAnalysis TypeAnalysis;
355+
356+
/// VPlan-based dominator tree.
357+
VPDominatorTree *VPDT = nullptr;
354358
};
355359

356360
/// Struct to hold various analysis needed for cost computations.

0 commit comments

Comments
 (0)