diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-09-17 06:00:02 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-09-17 06:00:02 +0000 |
commit | a53d49e1b547a9658be46865d687aeb481b3b32c (patch) | |
tree | 6af44087ae1c06b8690e2a40259801c80049020b /llvm/lib/IR/Function.cpp | |
parent | 05188a646d9e5c097a9d18fcae397c6312fe786d (diff) | |
download | llvm-a53d49e1b547a9658be46865d687aeb481b3b32c.zip llvm-a53d49e1b547a9658be46865d687aeb481b3b32c.tar.gz llvm-a53d49e1b547a9658be46865d687aeb481b3b32c.tar.bz2 |
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.
This is a recommit of r281806 after fixing the accessor to return
a pointer instead of a reference and updating all the call-sites.
llvm-svn: 281813
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index fa34158..f9f33fe 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(); |