diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index a022461d333..4ab4fe5fee0 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(I)->isTailCall()) cast(Res)->setTailCall(); + cast(Res)->setCallingConv(cast(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(I)->isTailCall()) + cast(Res)->setTailCall(); + cast(Res)->setCallingConv(cast(I)->getCallingConv()); break; } default: diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp index c15aa257d94..718f07de82e 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(CI->op_begin()+1, CI->op_end())); + if (CI->isTailCall()) NewCall->setTailCall(); + NewCall->setCallingConv(CI->getCallingConv()); ++BI; ReplaceInstWithInst(CI, NewCall);