Skip to content

Commit e72a71f

Browse files
committed
!fixup address comments, add comments
1 parent dd45cad commit e72a71f

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,8 @@ VPlan *VPlan::duplicate() {
12641264
"TripCount must have been added to Old2NewVPValues");
12651265
NewPlan->TripCount = Old2NewVPValues[TripCount];
12661266

1267-
for (unsigned I = CreatedBlockSize; I != CreatedBlocks.size(); ++I)
1267+
// Transfer cloned blocks to new VPlan.
1268+
for (unsigned I : seq<unsigned>(CreatedBlockSize, CreatedBlocks.size()))
12681269
NewPlan->CreatedBlocks.push_back(CreatedBlocks[I]);
12691270
CreatedBlocks.truncate(CreatedBlockSize);
12701271

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3714,8 +3714,7 @@ class VPRegionBlock : public VPBlockBase {
37143714
: VPBlockBase(VPRegionBlockSC, Name), Entry(nullptr), Exiting(nullptr),
37153715
IsReplicator(IsReplicator) {}
37163716

3717-
~VPRegionBlock() override {
3718-
}
3717+
~VPRegionBlock() override {}
37193718

37203719
/// Method to support type inquiry through isa, cast, and dyn_cast.
37213720
static inline bool classof(const VPBlockBase *V) {
@@ -3841,6 +3840,8 @@ class VPlan {
38413840
/// been modeled in VPlan directly.
38423841
DenseMap<const SCEV *, VPValue *> SCEVToExpansion;
38433842

3843+
/// Blocks allocated and owned by the VPlan. They will be deleted once the
3844+
/// VPlan is destroyed.
38443845
SmallVector<VPBlockBase *> CreatedBlocks;
38453846

38463847
public:
@@ -4060,13 +4061,19 @@ class VPlan {
40604061
/// recipes to refer to the clones, and return it.
40614062
VPlan *duplicate();
40624063

4064+
/// Create a new VPBasicBlock with \p Name and containing \p Recipe if
4065+
/// present. The returned block is owned by the VPlan and deleted once the
4066+
/// VPlan is destroyed.
40634067
VPBasicBlock *createVPBasicBlock(const Twine &Name,
40644068
VPRecipeBase *Recipe = nullptr) {
40654069
auto *VPB = new VPBasicBlock(Name, Recipe);
40664070
CreatedBlocks.push_back(VPB);
40674071
return VPB;
40684072
}
40694073

4074+
/// Create a new VPRegionBlock with \p Entry, \p Exiting and \p Name. If \p
4075+
/// IsReplicator is true, the region is a replicate region. The returned block
4076+
/// is owned by the VPlan and deleted once the VPlan is destroyed.
40704077
VPRegionBlock *createVPRegionBlock(VPBlockBase *Entry, VPBlockBase *Exiting,
40714078
const std::string &Name = "",
40724079
bool IsReplicator = false) {
@@ -4075,6 +4082,10 @@ class VPlan {
40754082
return VPB;
40764083
}
40774084

4085+
/// Create a new VPRegionBlock with \p Name and entry and exiting blocks set
4086+
/// to nullptr. If \p IsReplicator is true, the region is a replicate region.
4087+
/// The returned block is owned by the VPlan and deleted once the VPlan is
4088+
/// destroyed.
40784089
VPRegionBlock *createVPRegionBlock(const std::string &Name = "",
40794090
bool IsReplicator = false) {
40804091
auto *VPB = new VPRegionBlock(Name, IsReplicator);
@@ -4084,6 +4095,8 @@ class VPlan {
40844095

40854096
/// Create a VPIRBasicBlock from \p IRBB containing VPIRInstructions for all
40864097
/// instructions in \p IRBB, except its terminator which is managed in VPlan.
4098+
/// The returned block is owned by the VPlan and deleted once the VPlan is
4099+
/// destroyed.
40874100
VPIRBasicBlock *createVPIRBasicBlock(BasicBlock *IRBB);
40884101
};
40894102

0 commit comments

Comments
 (0)