preserve calling conventions when hacking on code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22024 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 2077b32..218910f 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -4271,10 +4271,12 @@
   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...