summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AsmWriter.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-24 21:03:05 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-04-24 21:03:05 +0000
commite30f10e6711b57e076b54d01049b63823dd9b441 (patch)
treea8867bddbfa4379d9b4e5573b77e0f4490d0118e /llvm/lib/IR/AsmWriter.cpp
parent5e5524bc25c3f6bf3d829b40ddb2a52011effadc (diff)
downloadbcm5719-llvm-e30f10e6711b57e076b54d01049b63823dd9b441.tar.gz
bcm5719-llvm-e30f10e6711b57e076b54d01049b63823dd9b441.zip
AsmWriter: Only collect attachment names once per module
Collect metadata names once per `AssemblyWriter` instead of every time we need to print some attachments. Just a drive-by; this caught my eye while I was refactoring the code in r235772. llvm-svn: 235774
Diffstat (limited to 'llvm/lib/IR/AsmWriter.cpp')
-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 7d0422d8c0a..54a370d08fb 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()) {
OpenPOWER on IntegriCloud