// after it to the normal destination.
std::vector<Value*> Args(II->op_begin()+3, II->op_end());
std::string Name = II->getName(); II->setName("");
- Instruction *NewCall = new CallInst(F, Args, Name, II);
+ CallInst *NewCall = new CallInst(F, Args, Name, II);
+ NewCall->setCallingConv(II->getCallingConv());
II->replaceAllUsesWith(NewCall);
new BranchInst(II->getNormalDest(), II);
if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) {
NC = new InvokeInst(Callee, II->getNormalDest(), II->getUnwindDest(),
Args, Caller->getName(), Caller);
+ cast<InvokeInst>(II)->setCallingConv(II->getCallingConv());
} else {
NC = new CallInst(Callee, Args, Caller->getName(), Caller);
if (cast<CallInst>(Caller)->isTailCall())
cast<CallInst>(NC)->setTailCall();
+ cast<CallInst>(NC)->setCallingConv(cast<CallInst>(Caller)->getCallingConv());
}
// Insert a cast of the return type as necessary...