Skip to content

Commit 324ba39

Browse files
committed
Use VPDominatorTree instead of VPDominatorTree pointer
1 parent 8127ede commit 324ba39

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,7 @@ 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), VPDT(new VPDominatorTree(*Plan)) {}
226-
227-
VPTransformState::~VPTransformState() { delete VPDT; }
225+
TypeAnalysis(CanonicalIVTy), VPDT(*Plan) {}
228226

229227
Value *VPTransformState::get(VPValue *Def, const VPLane &Lane) {
230228
if (Def->isLiveIn())
@@ -269,8 +267,8 @@ Value *VPTransformState::get(VPValue *Def, bool NeedsScalar) {
269267
auto GetBroadcastInstrs = [this, Def](Value *V) {
270268
bool SafeToHoist =
271269
!Def->hasDefiningRecipe() ||
272-
VPDT->properlyDominates(Def->getDefiningRecipe()->getParent(),
273-
Plan->getVectorPreheader());
270+
VPDT.properlyDominates(Def->getDefiningRecipe()->getParent(),
271+
Plan->getVectorPreheader());
274272

275273
if (VF.isScalar())
276274
return V;
@@ -983,9 +981,9 @@ void VPlan::execute(VPTransformState *State) {
983981
State->CFG.PrevVPBB = nullptr;
984982
State->CFG.ExitBB = State->CFG.PrevBB->getSingleSuccessor();
985983

986-
// Update VPDominatorTree since VPBasicBlock may be removed after State wsa
987-
// constucted.
988-
State->VPDT->recalculate(*this);
984+
// Update VPDominatorTree since VPBasicBlock may be removed after State was
985+
// constructed.
986+
State->VPDT.recalculate(*this);
989987

990988
// Disconnect VectorPreHeader from ExitBB in both the CFG and DT.
991989
BasicBlock *VectorPreHeader = State->CFG.PrevBB;

llvm/lib/Transforms/Vectorize/VPlanHelpers.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#define LLVM_TRANSFORMS_VECTORIZE_VPLANHELPERS_H
1717

1818
#include "VPlanAnalysis.h"
19+
#include "VPlanDominatorTree.h"
1920
#include "llvm/ADT/DenseMap.h"
2021
#include "llvm/ADT/SmallPtrSet.h"
2122
#include "llvm/ADT/SmallVector.h"
@@ -38,7 +39,6 @@ class VPRegionBlock;
3839
class VPlan;
3940
class Value;
4041
class LoopVersioning;
41-
class VPDominatorTree;
4242

4343
/// Returns a calculation for the total number of elements for a given \p VF.
4444
/// For fixed width vectors this value is a constant, whereas for scalable
@@ -199,7 +199,6 @@ struct VPTransformState {
199199
LoopInfo *LI, DominatorTree *DT, IRBuilderBase &Builder,
200200
InnerLoopVectorizer *ILV, VPlan *Plan,
201201
Loop *CurrentParentLoop, Type *CanonicalIVTy);
202-
~VPTransformState();
203202
/// Target Transform Info.
204203
const TargetTransformInfo *TTI;
205204

@@ -354,7 +353,7 @@ struct VPTransformState {
354353
VPTypeAnalysis TypeAnalysis;
355354

356355
/// VPlan-based dominator tree.
357-
VPDominatorTree *VPDT = nullptr;
356+
VPDominatorTree VPDT;
358357
};
359358

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

0 commit comments

Comments
 (0)