[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Jan 18 16:36:21 PST 2004
Changes in directory llvm/lib/Bytecode/Reader:
Reader.cpp updated: 1.99 -> 1.100
---
Log message:
Save another 30K from 176.gcc by encoding the compaction table a bit more
intelligently.
---
Diffs of the changes: (+17 -4)
Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.99 llvm/lib/Bytecode/Reader/Reader.cpp:1.100
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.99 Sun Jan 18 15:08:15 2004
+++ llvm/lib/Bytecode/Reader/Reader.cpp Sun Jan 18 16:35:30 2004
@@ -496,8 +496,22 @@
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 @@
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);
}
More information about the llvm-commits
mailing list