Don't forget to match the calling convention when producing a thunk.
authorNick Lewycky <nicholas@mxc.ca>
Fri, 12 Jun 2009 16:04:00 +0000 (16:04 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Fri, 12 Jun 2009 16:04:00 +0000 (16:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73231 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/MergeFunctions.cpp

index e237fcde0267cea5faa3e4d07fc4088762990609..a1d91c256e545e469cbeb4fb308a5ad19c189808 100644 (file)
@@ -478,6 +478,7 @@ static void ThunkGToF(Function *F, Function *G) {
 
   CallInst *CI = CallInst::Create(F, Args.begin(), Args.end(), "", BB);
   CI->setTailCall();
+  CI->setCallingConv(F->getCallingConv());
   if (NewG->getReturnType() == Type::VoidTy) {
     ReturnInst::Create(BB);
   } else if (CI->getType() != NewG->getReturnType()) {
@@ -492,8 +493,7 @@ static void ThunkGToF(Function *F, Function *G) {
   G->replaceAllUsesWith(NewG);
   G->eraseFromParent();
 
-  // TODO: look at direct callers to G and make them all direct callers to F
-  // iff G->hasAddressTaken() is false.
+  // TODO: look at direct callers to G and make them all direct callers to F.
 }
 
 static void AliasGToF(Function *F, Function *G) {