summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-08-27 00:38:44 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-08-27 00:38:44 +0000
commit248c06dceab0584dba91d007b57881c3af22b758 (patch)
tree9f26c4f41cf34dc55adf8196533b0fc4ad1c7b78 /llvm/lib
parent3b789ad2b851e7a9076d23bc3f07efa92f6bdef4 (diff)
downloadbcm5719-llvm-248c06dceab0584dba91d007b57881c3af22b758.tar.gz
bcm5719-llvm-248c06dceab0584dba91d007b57881c3af22b758.zip
Prevent an empty compaction table from being written to the bytecode file.
llvm-svn: 16063
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Bytecode/Writer/Writer.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp
index 6654fd1b023..7db21486034 100644
--- a/llvm/lib/Bytecode/Writer/Writer.cpp
+++ b/llvm/lib/Bytecode/Writer/Writer.cpp
@@ -1034,15 +1034,19 @@ void BytecodeWriter::outputCompactionTypes(unsigned StartNo) {
}
void BytecodeWriter::outputCompactionTable() {
- BytecodeBlock CTB(BytecodeFormat::CompactionTableBlockID, *this,
- true/*ElideIfEmpty*/);
- const std::vector<std::vector<const Value*> > &CT =Table.getCompactionTable();
-
- // First thing is first, emit the type compaction table if there is one.
- outputCompactionTypes(Type::FirstDerivedTyID);
+ // Avoid writing the compaction table at all if there is no content.
+ if (Table.getCompactionTypes().size() >= Type::FirstDerivedTyID ||
+ (!Table.CompactionTableIsEmpty())) {
+ BytecodeBlock CTB(BytecodeFormat::CompactionTableBlockID, *this,
+ true/*ElideIfEmpty*/);
+ const std::vector<std::vector<const Value*> > &CT =Table.getCompactionTable();
+
+ // First things first, emit the type compaction table if there is one.
+ outputCompactionTypes(Type::FirstDerivedTyID);
- for (unsigned i = 0, e = CT.size(); i != e; ++i)
- outputCompactionTablePlane(i, CT[i], 0);
+ for (unsigned i = 0, e = CT.size(); i != e; ++i)
+ outputCompactionTablePlane(i, CT[i], 0);
+ }
}
void BytecodeWriter::outputSymbolTable(const SymbolTable &MST) {
OpenPOWER on IntegriCloud