aboutsummaryrefslogtreecommitdiff
path: root/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
commite43702695dd4500c2a11671f9d353b5cc6b2603b (patch)
tree41d38fa9675b7212e2d875eee28e2ebfb7ff5b0e /lib/Transforms
parent16d0db2da8c274f98db4a89ca7a92f970d464b9a (diff)
preserve calling conventions when hacking on code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22024 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp3
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 7307ff813a..65e816e2e8 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/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/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 2077b32916..218910feb2 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/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...