Skip to content

Commit 1b0aaef

Browse files
committed
Destroy temp lifetime ValueNames when done writing
1 parent 94fe78c commit 1b0aaef

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2560,6 +2560,7 @@ void DXILBitcodeWriter::writeFunctionLevelValueSymbolTable(
25602560
SmallVector<const ValueName *, 16> SortedTable;
25612561

25622562
MallocAllocator Allocator;
2563+
SmallVector<ValueName *, 2> LifetimeValueNames;
25632564
for (auto &VI : VST) {
25642565
ValueName *VN = VI.second->getValueName();
25652566
// Clang mangles lifetime intrinsic names by appending '.p0' to the end,
@@ -2570,9 +2571,11 @@ void DXILBitcodeWriter::writeFunctionLevelValueSymbolTable(
25702571
if (const Function *Fn = dyn_cast<Function>(VI.getValue());
25712572
Fn && Fn->isIntrinsic()) {
25722573
Intrinsic::ID IID = Fn->getIntrinsicID();
2573-
if (IID == Intrinsic::lifetime_start || IID == Intrinsic::lifetime_end)
2574+
if (IID == Intrinsic::lifetime_start || IID == Intrinsic::lifetime_end) {
25742575
VN = ValueName::create(Intrinsic::getBaseName(IID), Allocator,
25752576
VI.second);
2577+
LifetimeValueNames.push_back(VN);
2578+
}
25762579
}
25772580
SortedTable.push_back(VN);
25782581
}
@@ -2625,6 +2628,8 @@ void DXILBitcodeWriter::writeFunctionLevelValueSymbolTable(
26252628
NameVals.clear();
26262629
}
26272630
Stream.ExitBlock();
2631+
for (auto *VN : LifetimeValueNames)
2632+
VN->Destroy(Allocator);
26282633
}
26292634

26302635
/// Emit a function body to the module stream.

0 commit comments

Comments
 (0)