Set the calling convention based on the CGFunctionInfo.

llvm-svn: 81582
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 399624d..fcaa49e 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -851,9 +851,9 @@
   }
 
   CS.setAttributes(Attrs);
-  if (const llvm::Function *F =
-        dyn_cast<llvm::Function>(Callee->stripPointerCasts()))
-    CS.setCallingConv(F->getCallingConv());
+  llvm::CallingConv::ID CC =
+    static_cast<llvm::CallingConv::ID>(CallInfo.getCallingConvention());
+  CS.setCallingConv(CC);
 
   // If the call doesn't return, finish the basic block and clear the
   // insertion point; this allows the rest of IRgen to discard