summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader/Reader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-18 22:35:34 +0000
committerChris Lattner <sabre@nondot.org>2004-01-18 22:35:34 +0000
commit5a66bb75070387f11ba8f1af9675557336287936 (patch)
treeece4eaaba60757415bf2f20c7f3c89eb4ba7624d /llvm/lib/Bytecode/Reader/Reader.cpp
parent979ca2fccdd2dd8d74ea07353b9d4a6def7e7111 (diff)
downloadbcm5719-llvm-5a66bb75070387f11ba8f1af9675557336287936.tar.gz
bcm5719-llvm-5a66bb75070387f11ba8f1af9675557336287936.zip
Save another 30K from 176.gcc by encoding the compaction table a bit more
intelligently. llvm-svn: 10918
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.cpp')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index 2067f222110..f4b620ed19a 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/lib/Bytecode/Reader/Reader.cpp
@@ -496,8 +496,22 @@ void BytecodeParser::ParseCompactionTable(const unsigned char *&Buf,
const unsigned char *End) {
while (Buf != End) {
- unsigned NumEntries = read_vbr_uint(Buf, End);
- unsigned Ty = read_vbr_uint(Buf, End);
+ unsigned NumEntries;
+ unsigned Ty;
+
+ NumEntries = read_vbr_uint(Buf, End);
+ switch (NumEntries & 3) {
+ case 0:
+ case 1:
+ case 2:
+ Ty = NumEntries >> 2;
+ NumEntries &= 3;
+ break;
+ case 3:
+ NumEntries >>= 2;
+ Ty = read_vbr_uint(Buf, End);
+ break;
+ }
if (Ty >= CompactionTable.size())
CompactionTable.resize(Ty+1);
@@ -513,11 +527,10 @@ void BytecodeParser::ParseCompactionTable(const unsigned char *&Buf,
CompactionTable.resize(NumEntries+Type::FirstDerivedTyID);
} else {
- assert(NumEntries != 0 && "Cannot read zero entries!");
const Type *Typ = getType(Ty);
// Push the implicit zero
CompactionTable[Ty].push_back(Constant::getNullValue(Typ));
- for (unsigned i = 1; i != NumEntries; ++i) {
+ for (unsigned i = 0; i != NumEntries; ++i) {
Value *V = getGlobalTableValue(Typ, read_vbr_uint(Buf, End));
CompactionTable[Ty].push_back(V);
}
OpenPOWER on IntegriCloud