fix two cases where the arguments were extracted from the wrong range out of the InvokeInst

spotted by baldrick -- thanks\!

llvm-svn: 99914
This commit is contained in:
Gabor Greif 2010-03-30 19:20:53 +00:00
parent ad2c6988a2
commit b469818279
1 changed files with 3 additions and 3 deletions

View File

@ -1768,7 +1768,7 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) {
Pred->getInstList().remove(II); // Take out of symbol table Pred->getInstList().remove(II); // Take out of symbol table
// Insert the call now. // Insert the call now.
SmallVector<Value*,8> Args(II->op_begin()+3, II->op_end()); SmallVector<Value*,8> Args(II->op_begin(), II->op_end()-3);
CallInst *CI = CallInst::Create(II->getCalledValue(), CallInst *CI = CallInst::Create(II->getCalledValue(),
Args.begin(), Args.end(), Args.begin(), Args.end(),
II->getName(), BI); II->getName(), BI);
@ -1970,13 +1970,13 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) {
II->removeFromParent(); // Take out of symbol table II->removeFromParent(); // Take out of symbol table
// Insert the call now... // Insert the call now...
SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end()); SmallVector<Value*, 8> Args(II->op_begin(), II->op_end()-3);
CallInst *CI = CallInst::Create(II->getCalledValue(), CallInst *CI = CallInst::Create(II->getCalledValue(),
Args.begin(), Args.end(), Args.begin(), Args.end(),
II->getName(), BI); II->getName(), BI);
CI->setCallingConv(II->getCallingConv()); CI->setCallingConv(II->getCallingConv());
CI->setAttributes(II->getAttributes()); CI->setAttributes(II->getAttributes());
// If the invoke produced a value, the Call does now instead. // If the invoke produced a value, the call does now instead.
II->replaceAllUsesWith(CI); II->replaceAllUsesWith(CI);
delete II; delete II;
Changed = true; Changed = true;