[PATCH] D41556: [InlineFunction] Preserve calling convention when forwarding VarArgs.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 6 12:57:45 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL321943: [InlineFunction] Preserve calling convention when forwarding VarArgs. (authored by fhahn, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41556?vs=128084&id=128856#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41556

Files:
  llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
  llvm/trunk/test/Transforms/Inline/inline-varargs.ll


Index: llvm/trunk/test/Transforms/Inline/inline-varargs.ll
===================================================================
--- llvm/trunk/test/Transforms/Inline/inline-varargs.ll
+++ llvm/trunk/test/Transforms/Inline/inline-varargs.ll
@@ -3,6 +3,7 @@
 
 declare void @ext_method(i8*, i32)
 declare signext i16 @vararg_fn(...) #0
+declare "cc 9" void @vararg_fn_cc9(i8* %p, ...)
 
 define linkonce_odr void @thunk(i8* %this, ...) {
   %this_adj = getelementptr i8, i8* %this, i32 4
@@ -41,6 +42,18 @@
 ; CHECK-LABEL: define void @test_caller_3
 ; CHECK: call signext i16 (...) @vararg_fn()
 
+define void @test_preserve_cc(i8* %p, ...) {
+  musttail call "cc 9" void (i8*, ...) @vararg_fn_cc9(i8* %p, ...)
+  ret void
+}
+
+define void @test_caller_preserve_cc(i8* %p, i8* %q) {
+  call void (i8*, ...) @test_preserve_cc(i8* %p, i8* %q)
+  ret void
+}
+; CHECK-LABEL: define void @test_caller_preserve_cc
+; CHECK: call "cc 9" void (i8*, ...) @vararg_fn_cc9(i8* %p, i8* %q)
+
 define internal i32 @varg_accessed(...) {
 entry:
   %vargs = alloca i8*, align 8
Index: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
@@ -1860,6 +1860,7 @@
                                Params, "", CI);
           NewCI->setDebugLoc(CI->getDebugLoc());
           NewCI->setAttributes(Attrs);
+          NewCI->setCallingConv(CI->getCallingConv());
           CI->replaceAllUsesWith(NewCI);
           CI->eraseFromParent();
           CI = NewCI;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41556.128856.patch
Type: text/x-patch
Size: 1614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180106/0bf12170/attachment.bin>


More information about the llvm-commits mailing list