aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-06 04:27:07 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-06 04:27:07 +0000
commitcae6053587a0909e222feaeaf211fc2cb6c72ba4 (patch)
tree49ff6ffa26e80dbc2557fb8dc2034372773fa9f0
parent698b51e8707f96914aebbae46e64c80c282a7100 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32253 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Bytecode/Writer/Writer.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index fdd0f3ca42..b8f57f7f72 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -449,8 +449,8 @@ void BytecodeWriter::outputInstructionFormat0(const Instruction *I,
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 @@ void BytecodeWriter::outputInstructionFormat0(const Instruction *I,
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 @@ void BytecodeWriter::outputInstruction(const Instruction &I) {
}
}
- // 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);