When lowering invokes to calls, amke sure to preserve the calling conv. This
authorChris Lattner <sabre@nondot.org>
Fri, 13 May 2005 06:27:02 +0000 (06:27 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 13 May 2005 06:27:02 +0000 (06:27 +0000)
fixes Ptrdist/anagram with x86 llcbeta

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21925 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/LowerInvoke.cpp

index 2738b4aa5e3b762b98e3e1eeaa4232d11f7718c4..b0c807f958a60c20d84cf3b6151b37cb4bbfd8b6 100644 (file)
@@ -205,9 +205,10 @@ bool LowerInvoke::insertCheapEHSupport(Function &F) {
     if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator())) {
       // Insert a normal call instruction...
       std::string Name = II->getName(); II->setName("");
-      Value *NewCall = new CallInst(II->getCalledValue(),
-                                    std::vector<Value*>(II->op_begin()+3,
-                                                        II->op_end()), Name,II);
+      CallInst *NewCall = new CallInst(II->getCalledValue(),
+                                       std::vector<Value*>(II->op_begin()+3,
+                                                       II->op_end()), Name, II);
+      NewCall->setCallingConv(II->getCallingConv());
       II->replaceAllUsesWith(NewCall);
 
       // Insert an unconditional branch to the normal destination.
@@ -286,10 +287,11 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
 
       // Insert a normal call instruction on the normal execution path.
       std::string Name = II->getName(); II->setName("");
-      Value *NewCall = new CallInst(II->getCalledValue(),
-                                    std::vector<Value*>(II->op_begin()+3,
-                                                        II->op_end()), Name,
-                                    InsertLoc);
+      CallInst *NewCall = new CallInst(II->getCalledValue(),
+                                       std::vector<Value*>(II->op_begin()+3,
+                                                           II->op_end()), Name,
+                                       InsertLoc);
+      NewCall->setCallingConv(II->getCallingConv());
       II->replaceAllUsesWith(NewCall);
 
       // If we got this far, then no exception was thrown and we can pop our