Preserve calling conv when hacking on calls
authorChris Lattner <sabre@nondot.org>
Sat, 14 May 2005 12:28:32 +0000 (12:28 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 14 May 2005 12:28:32 +0000 (12:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22025 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/ExprTypeConvert.cpp
lib/Transforms/LevelRaise.cpp

index a022461d333690c06dfe0501ba4843cf644f533f..4ab4fe5fee0e916bdde6b04c2e789536a53420a2 100644 (file)
@@ -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:
index c15aa257d94ff9fd7b2cf637b299fe2f4ccdb6ef..718f07de82e5ccf300e7312fe7898cebe4477860 100644 (file)
@@ -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);