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
This commit is contained in:
Mehdi Amini
2016-09-17 06:00:02 +00:00
parent 05188a646d
commit a53d49e1b5
10 changed files with 29 additions and 25 deletions

View File

@@ -2999,7 +2999,8 @@ void ModuleBitcodeWriter::writeFunction(
}
// Emit names for all the instructions etc.
writeValueSymbolTable(F.getValueSymbolTable());
if (auto *Symtab = F.getValueSymbolTable())
writeValueSymbolTable(*Symtab);
if (NeedsMetadataAttachment)
writeFunctionMetadataAttachment(F);