Do not bother to emit a BytecodeBlock for an empty symbol table. This commonly

occurs when the symbol table for a module has been stripped, making all of the
function local symbols go away.

This saves 6728 bytes in the stripped bytecode file of 254.gap (which obviously
has 841 functions), which isn't a ton, but helps and was easy.

llvm-svn: 10750
This commit is contained in:
Chris Lattner 2004-01-10 19:56:59 +00:00
parent 8043f8c294
commit a2bfab849f
1 changed files with 4 additions and 0 deletions

View File

@ -236,6 +236,10 @@ void BytecodeWriter::outputFunction(const Function *F) {
} }
void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) { void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
// Do not output the Bytecode block for an empty symbol table, it just wastes
// space!
if (MST.begin() == MST.end()) return;
BytecodeBlock FunctionBlock(BytecodeFormat::SymbolTable, Out); BytecodeBlock FunctionBlock(BytecodeFormat::SymbolTable, Out);
for (SymbolTable::const_iterator TI = MST.begin(); TI != MST.end(); ++TI) { for (SymbolTable::const_iterator TI = MST.begin(); TI != MST.end(); ++TI) {