summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode/Reader/InstructionReader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-06-17 13:31:10 +0000
committerChris Lattner <sabre@nondot.org>2003-06-17 13:31:10 +0000
commitbbd00c12e0abcf1f3cca0b19e873ffc7b14e4bfc (patch)
tree2392ae3ec4da2fb99626ab563ab9a7dcb59a11df /llvm/lib/Bytecode/Reader/InstructionReader.cpp
parent5c2d7ac52f45883555625ea6646166950edc8cdb (diff)
downloadbcm5719-llvm-bbd00c12e0abcf1f3cca0b19e873ffc7b14e4bfc.tar.gz
bcm5719-llvm-bbd00c12e0abcf1f3cca0b19e873ffc7b14e4bfc.zip
Fix bug: Assembler/2003-06-17-InvokeDisassemble.llx
"yes, invoke instructions can have just three arguments" llvm-svn: 6736
Diffstat (limited to 'llvm/lib/Bytecode/Reader/InstructionReader.cpp')
-rw-r--r--llvm/lib/Bytecode/Reader/InstructionReader.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/llvm/lib/Bytecode/Reader/InstructionReader.cpp b/llvm/lib/Bytecode/Reader/InstructionReader.cpp
index d652af74683..e81927c441b 100644
--- a/llvm/lib/Bytecode/Reader/InstructionReader.cpp
+++ b/llvm/lib/Bytecode/Reader/InstructionReader.cpp
@@ -302,16 +302,19 @@ bool BytecodeParser::ParseInstruction(const unsigned char *&Buf,
if (Raw.NumOperands < 3) return true;
Normal = cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg2));
- Except = cast<BasicBlock>(getValue(Type::LabelTy, args[0]));
-
- FunctionType::ParamTypes::const_iterator It = PL.begin();
- for (unsigned i = 1; i < args.size(); i++) {
- if (It == PL.end()) return true;
- // TODO: Check getValue for null!
- Params.push_back(getValue(*It++, args[i]));
+ if (Raw.NumOperands == 3)
+ Except = cast<BasicBlock>(getValue(Type::LabelTy, Raw.Arg3));
+ else {
+ Except = cast<BasicBlock>(getValue(Type::LabelTy, args[0]));
+
+ FunctionType::ParamTypes::const_iterator It = PL.begin();
+ for (unsigned i = 1; i < args.size(); i++) {
+ if (It == PL.end()) return true;
+ // TODO: Check getValue for null!
+ Params.push_back(getValue(*It++, args[i]));
+ }
+ if (It != PL.end()) return true;
}
-
- if (It != PL.end()) return true;
} else {
if (args.size() < 4) return true;
@@ -326,7 +329,8 @@ bool BytecodeParser::ParseInstruction(const unsigned char *&Buf,
}
}
- delete Raw.VarArgs;
+ if (Raw.NumOperands > 3)
+ delete Raw.VarArgs;
Res = new InvokeInst(M, Normal, Except, Params);
return false;
}
OpenPOWER on IntegriCloud