[llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp
Reid Spencer
reid at x10sys.com
Tue Dec 5 20:27:22 PST 2006
Changes in directory llvm/lib/Bytecode/Writer:
Writer.cpp updated: 1.133 -> 1.134
---
Log message:
Fix a CmpInst writing bug by removing merge cruft that I *know* I've removed
before. Also, make sure we write the predicate value for Cmp instructions
using instruction format 0.
---
Diffs of the changes: (+4 -9)
Writer.cpp | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
Index: llvm/lib/Bytecode/Writer/Writer.cpp
diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.133 llvm/lib/Bytecode/Writer/Writer.cpp:1.134
--- llvm/lib/Bytecode/Writer/Writer.cpp:1.133 Sun Dec 3 23:23:49 2006
+++ llvm/lib/Bytecode/Writer/Writer.cpp Tue Dec 5 22:27:07 2006
@@ -449,8 +449,8 @@
output_typeid(Type); // Result type
unsigned NumArgs = I->getNumOperands();
- output_vbr(NumArgs + (isa<CastInst>(I) || isa<InvokeInst>(I) ||
- isa<VAArgInst>(I) || Opcode == 58));
+ output_vbr(NumArgs + (isa<CastInst>(I) || isa<InvokeInst>(I) ||
+ isa<CmpInst>(I) || isa<VAArgInst>(I) || Opcode == 58));
if (!isa<GetElementPtrInst>(&I)) {
for (unsigned i = 0; i < NumArgs; ++i) {
@@ -463,6 +463,8 @@
int Slot = Table.getSlot(I->getType());
assert(Slot != -1 && "Cast return type unknown?");
output_typeid((unsigned)Slot);
+ } else if (isa<CmpInst>(I)) {
+ output_vbr(unsigned(cast<CmpInst>(I)->getPredicate()));
} else if (isa<InvokeInst>(I)) {
output_vbr(cast<InvokeInst>(I)->getCallingConv());
} else if (Opcode == 58) { // Call escape sequence
@@ -793,13 +795,6 @@
}
}
- // In the weird case of the ICmp or FCmp instructions, we need to also put
- // out the instruction's predicate value. We do that here, after the
- // instruction's type and operands have been written so we can reuse the
- // code above.
- if (const CmpInst* CI = dyn_cast<CmpInst>(&I))
- output_vbr((unsigned)CI->getPredicate());
-
// If we weren't handled before here, we either have a large number of
// operands or a large operand index that we are referring to.
outputInstructionFormat0(&I, Opcode, Table, Type);
More information about the llvm-commits
mailing list