[llvm] r321943 - [InlineFunction] Preserve calling convention when forwarding VarArgs.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 6 12:56:28 PST 2018
Author: fhahn
Date: Sat Jan 6 12:56:27 2018
New Revision: 321943
URL: http://llvm.org/viewvc/llvm-project?rev=321943&view=rev
Log:
[InlineFunction] Preserve calling convention when forwarding VarArgs.
Reviewers: efriedma, rnk, davide
Reviewed By: rnk, davide
Differential Revision: https://reviews.llvm.org/D41556
Modified:
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
llvm/trunk/test/Transforms/Inline/inline-varargs.ll
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=321943&r1=321942&r2=321943&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Sat Jan 6 12:56:27 2018
@@ -1860,6 +1860,7 @@ bool llvm::InlineFunction(CallSite CS, I
Params, "", CI);
NewCI->setDebugLoc(CI->getDebugLoc());
NewCI->setAttributes(Attrs);
+ NewCI->setCallingConv(CI->getCallingConv());
CI->replaceAllUsesWith(NewCI);
CI->eraseFromParent();
CI = NewCI;
Modified: llvm/trunk/test/Transforms/Inline/inline-varargs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/inline-varargs.ll?rev=321943&r1=321942&r2=321943&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/inline-varargs.ll (original)
+++ llvm/trunk/test/Transforms/Inline/inline-varargs.ll Sat Jan 6 12:56:27 2018
@@ -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 @@ define void @test_caller_3(i8* %p, i8* %
; 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
More information about the llvm-commits
mailing list