summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-14 12:25:32 +0000
committerChris Lattner <sabre@nondot.org>2005-05-14 12:25:32 +0000
commit05c703ea851574f7fab3d5947317c9a4f31e905e (patch)
tree88a8630afa6468046d863cb65eb6f34428134ad4 /llvm/lib/Transforms
parentbcefcf85522f16a429e6ce809cb471ab01e1aa97 (diff)
downloadbcm5719-llvm-05c703ea851574f7fab3d5947317c9a4f31e905e.tar.gz
bcm5719-llvm-05c703ea851574f7fab3d5947317c9a4f31e905e.zip
preserve calling conventions when hacking on code
llvm-svn: 22024
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/ADCE.cpp3
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp
index 7307ff813a2..65e816e2e81 100644
--- a/llvm/lib/Transforms/Scalar/ADCE.cpp
+++ b/llvm/lib/Transforms/Scalar/ADCE.cpp
@@ -188,7 +188,8 @@ bool ADCE::doADCE() {
// 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);
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 2077b329160..218910feb20 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -4271,10 +4271,12 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
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...
OpenPOWER on IntegriCloud