summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-14 12:28:32 +0000
committerChris Lattner <sabre@nondot.org>2005-05-14 12:28:32 +0000
commit65af1abd1e4d93a57b28f3f81f7a4c7af851ba30 (patch)
treed14d28c260befef53e145d8d00f9a1c9daa92a39 /lib
parente43702695dd4500c2a11671f9d353b5cc6b2603b (diff)
downloadllvm-65af1abd1e4d93a57b28f3f81f7a4c7af851ba30.tar.gz
llvm-65af1abd1e4d93a57b28f3f81f7a4c7af851ba30.tar.bz2
llvm-65af1abd1e4d93a57b28f3f81f7a4c7af851ba30.tar.xz
Preserve calling conv when hacking on calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22025 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp4
-rw-r--r--lib/Transforms/LevelRaise.cpp2
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index a022461d33..4ab4fe5fee 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -525,6 +525,7 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
Name);
if (cast<CallInst>(I)->isTailCall())
cast<CallInst>(Res)->setTailCall();
+ cast<CallInst>(Res)->setCallingConv(cast<CallInst>(I)->getCallingConv());
VMC.ExprMap[I] = Res;
Res->setOperand(0, ConvertExpressionToType(I->getOperand(0),NewPTy,VMC,TD));
break;
@@ -1218,6 +1219,9 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
}
Res = new CallInst(Meth, Params, Name);
+ if (cast<CallInst>(I)->isTailCall())
+ cast<CallInst>(Res)->setTailCall();
+ cast<CallInst>(Res)->setCallingConv(cast<CallInst>(I)->getCallingConv());
break;
}
default:
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index c15aa257d9..718f07de82 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -538,6 +538,8 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
// Create a new call instruction...
CallInst *NewCall = new CallInst(NewCast,
std::vector<Value*>(CI->op_begin()+1, CI->op_end()));
+ if (CI->isTailCall()) NewCall->setTailCall();
+ NewCall->setCallingConv(CI->getCallingConv());
++BI;
ReplaceInstWithInst(CI, NewCall);