summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/LLVMTargetMachine.cpp3
-rw-r--r--llvm/lib/MC/MCContext.cpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index 61d68f60711..610c9f47bac 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -198,6 +198,9 @@ bool LLVMTargetMachine::addPassesToEmitFile(
if (!MCE || !MAB)
return true;
+ // Don't waste memory on names of temp labels.
+ Context->setUseNamesOnTempLabels(false);
+
Triple T(getTargetTriple());
AsmStreamer.reset(getTarget().createMCObjectStreamer(
T, *Context, *MAB, Out, MCE, STI, Options.MCOptions.MCRelaxAll,
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index fd0422daf29..d6f6dbb04fe 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -150,6 +150,9 @@ MCSymbol *MCContext::CreateSymbol(StringRef Name, bool AlwaysAddSuffix) {
if (AllowTemporaryLabels)
IsTemporary = Name.startswith(MAI->getPrivateGlobalPrefix());
+ if (IsTemporary && AlwaysAddSuffix && !UseNamesOnTempLabels)
+ return new (*this) MCSymbol("", true);
+
SmallString<128> NewName = Name;
bool AddSuffix = AlwaysAddSuffix;
unsigned &NextUniqueID = NextID[Name];
OpenPOWER on IntegriCloud