aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/IR/AsmWriter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 7d0422d..54a370d 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1943,6 +1943,7 @@ class AssemblyWriter {
SetVector<const Comdat *> Comdats;
bool ShouldPreserveUseListOrder;
UseListOrderStack UseListOrders;
+ SmallVector<StringRef, 8> MDNames;
public:
/// Construct an AssemblyWriter with an external SlotTracker
@@ -2967,8 +2968,9 @@ void AssemblyWriter::printMetadataAttachments(
if (MDs.empty())
return;
- SmallVector<StringRef, 8> MDNames;
- TheModule->getMDKindNames(MDNames);
+ if (MDNames.empty())
+ TheModule->getMDKindNames(MDNames);
+
for (const auto &I : MDs) {
unsigned Kind = I.first;
if (Kind < MDNames.size()) {