Skip to content

Commit 1b37e80

Browse files
committed
[VPlan] use getVPValueOrAddLiveIn in VPlan::duplicate.
Instead of creating live-ins manually, use getOrAddLiveIn which automatically takes care of adding them to VPLiveInsToFree. Also use it to create the VPValue for the trip-count. This fixes a leak: https://lab.llvm.org/buildbot/#/builders/168/builds/18308/steps/10/logs/stdio
1 parent d14c8f0 commit 1b37e80

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,9 +1078,8 @@ VPlan *VPlan::duplicate() {
10781078
auto *NewPlan = new VPlan(NewPreheader, cast<VPBasicBlock>(NewEntry));
10791079
DenseMap<VPValue *, VPValue *> Old2NewVPValues;
10801080
for (VPValue *OldLiveIn : VPLiveInsToFree) {
1081-
VPValue *NewLiveIn = new VPValue(OldLiveIn->getLiveInIRValue());
1082-
NewPlan->VPLiveInsToFree.push_back(NewLiveIn);
1083-
Old2NewVPValues[OldLiveIn] = NewLiveIn;
1081+
Old2NewVPValues[OldLiveIn] =
1082+
NewPlan->getVPValueOrAddLiveIn(OldLiveIn->getLiveInIRValue());
10841083
}
10851084
Old2NewVPValues[&VectorTripCount] = &NewPlan->VectorTripCount;
10861085
Old2NewVPValues[&VFxUF] = &NewPlan->VFxUF;
@@ -1090,7 +1089,8 @@ VPlan *VPlan::duplicate() {
10901089
}
10911090
assert(TripCount && "trip count must be set");
10921091
if (TripCount->isLiveIn())
1093-
Old2NewVPValues[TripCount] = new VPValue(TripCount->getLiveInIRValue());
1092+
Old2NewVPValues[TripCount] =
1093+
NewPlan->getVPValueOrAddLiveIn(TripCount->getLiveInIRValue());
10941094
// else NewTripCount will be created and inserted into Old2NewVPValues when
10951095
// TripCount is cloned. In any case NewPlan->TripCount is updated below.
10961096

0 commit comments

Comments
 (0)