summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-09-17 03:39:01 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-09-17 03:39:01 +0000
commitb877aeb7c80afd1ae360f4368aee4bb055ed30eb (patch)
treeca80cbd5c84bce5c578774458b7ede03ce366bbf /llvm/lib
parent70efa2f25195ca943b2b6b46d9db3db11cfb547f (diff)
downloadbcm5719-llvm-b877aeb7c80afd1ae360f4368aee4bb055ed30eb.tar.gz
bcm5719-llvm-b877aeb7c80afd1ae360f4368aee4bb055ed30eb.zip
Don't create a SymbolTable in Function when the LLVMContext discards value names (NFC)
The ValueSymbolTable is used to detect name conflict and rename instructions automatically. This is not needed when the value names are automatically discarded by the LLVMContext. No functional change intended, just saving a little bit of memory. llvm-svn: 281806
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Function.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index fa34158e9c5..f9f33fef452 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -258,7 +258,10 @@ Function::Function(FunctionType *Ty, LinkageTypes Linkage, const Twine &name,
assert(FunctionType::isValidReturnType(getReturnType()) &&
"invalid return type");
setGlobalObjectSubClassData(0);
- SymTab = new ValueSymbolTable();
+
+ // We only need a symbol table for a function if the context keeps value names
+ if (!getContext().shouldDiscardValueNames())
+ SymTab = make_unique<ValueSymbolTable>();
// If the function has arguments, mark them as lazily built.
if (Ty->getNumParams())
@@ -279,7 +282,6 @@ Function::~Function() {
// Delete all of the method arguments and unlink from symbol table...
ArgumentList.clear();
- delete SymTab;
// Remove the function from the on-the-side GC table.
clearGC();
OpenPOWER on IntegriCloud