[PATCH] D41556: [InlineFunction] Preserve calling convention when forwarding VarArgs.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 23 10:15:04 PST 2017
fhahn created this revision.
fhahn added reviewers: efriedma, rnk, davide.
Herald added a subscriber: eraman.
https://reviews.llvm.org/D41556
Files:
lib/Transforms/Utils/InlineFunction.cpp
test/Transforms/Inline/inline-varargs.ll
Index: test/Transforms/Inline/inline-varargs.ll
===================================================================
--- test/Transforms/Inline/inline-varargs.ll
+++ test/Transforms/Inline/inline-varargs.ll
@@ -3,6 +3,7 @@
declare void @ext_method(i8*, i32)
declare void @vararg_fn(...)
+declare "cc 9" void @vararg_fn_cc9(i8* %p, ...)
define linkonce_odr void @thunk(i8* %this, ...) {
%this_adj = getelementptr i8, i8* %this, i32 4
@@ -43,6 +44,19 @@
; CHECK-LABEL: define void @test_caller_3
; CHECK: call void (...) @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: lib/Transforms/Utils/InlineFunction.cpp
===================================================================
--- lib/Transforms/Utils/InlineFunction.cpp
+++ 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.128084.patch
Type: text/x-patch
Size: 1533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171223/7ba39a04/attachment.bin>
More information about the llvm-commits
mailing list