[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Jan 10 13:58:01 PST 2004


Changes in directory llvm/lib/Bytecode/Writer:

Writer.cpp updated: 1.49 -> 1.50

---
Log message:

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.



---
Diffs of the changes:  (+4 -0)

Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.49 llvm/lib/Bytecode/Writer/Writer.cpp:1.50
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.49	Sat Jan 10 13:10:01 2004
+++ llvm/lib/Bytecode/Writer/Writer.cpp	Sat Jan 10 13:56:59 2004
@@ -236,6 +236,10 @@
 }
 
 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);
 
   for (SymbolTable::const_iterator TI = MST.begin(); TI != MST.end(); ++TI) {





More information about the llvm-commits mailing list