diff options
| author | Florian Hahn <florian.hahn@arm.com> | 2018-01-06 20:46:00 +0000 |
|---|---|---|
| committer | Florian Hahn <florian.hahn@arm.com> | 2018-01-06 20:46:00 +0000 |
| commit | de10e6e064e822f6d6bc0d25339b499af21d6be9 (patch) | |
| tree | e4039cac690e55dcf20f2e226bf237b08cdd88e1 /llvm/test/Transforms/Inline | |
| parent | 0b93cd7351789911dd13c4f3bfa472be57f4e414 (diff) | |
| download | bcm5719-llvm-de10e6e064e822f6d6bc0d25339b499af21d6be9.tar.gz bcm5719-llvm-de10e6e064e822f6d6bc0d25339b499af21d6be9.zip | |
[InlineFunction] Preserve attributes when forwarding VarArgs.
Reviewers: rnk, efriedma
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D41555
llvm-svn: 321942
Diffstat (limited to 'llvm/test/Transforms/Inline')
| -rw-r--r-- | llvm/test/Transforms/Inline/inline-varargs.ll | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/llvm/test/Transforms/Inline/inline-varargs.ll b/llvm/test/Transforms/Inline/inline-varargs.ll index de3147e488d..b46821a992a 100644 --- a/llvm/test/Transforms/Inline/inline-varargs.ll +++ b/llvm/test/Transforms/Inline/inline-varargs.ll @@ -2,11 +2,11 @@ ; RUN: opt < %s -passes='cgscc(inline,function(instcombine))' -S | FileCheck %s declare void @ext_method(i8*, i32) -declare void @vararg_fn(i8*, ...) +declare signext i16 @vararg_fn(...) #0 define linkonce_odr void @thunk(i8* %this, ...) { %this_adj = getelementptr i8, i8* %this, i32 4 - musttail call void (i8*, ...) bitcast (void (i8*, i32)* @ext_method to void (i8*, ...)*)(i8* %this_adj, ...) + musttail call void (i8*, ...) bitcast (void (i8*, i32)* @ext_method to void (i8*, ...)*)(i8* nonnull %this_adj, ...) ret void } @@ -15,21 +15,31 @@ define void @thunk_caller(i8* %p) { ret void } ; CHECK-LABEL: define void @thunk_caller(i8* %p) -; CHECK: call void (i8*, ...) bitcast (void (i8*, i32)* @ext_method to void (i8*, ...)*)(i8* %this_adj.i, i32 42) +; CHECK: call void (i8*, ...) bitcast (void (i8*, i32)* @ext_method to void (i8*, ...)*)(i8* nonnull %this_adj.i, i32 42) -define void @test_callee_2(i8* %this, ...) { - %this_adj = getelementptr i8, i8* %this, i32 4 - musttail call void (i8*, ...) @vararg_fn(i8* %this_adj, ...) +define signext i16 @test_callee_2(...) { + %res = musttail call signext i16 (...) @vararg_fn(...) #0 + ret i16 %res +} + +define void @test_caller_2(i8* %p, i8* %q, i16 %r) { + call signext i16 (...) @test_callee_2(i8* %p, i8* byval %q, i16 signext %r) ret void } +; CHECK-LABEL: define void @test_caller_2 +; CHECK: call signext i16 (...) @vararg_fn(i8* %p, i8* byval %q, i16 signext %r) [[FN_ATTRS:#[0-9]+]] -define void @test_caller_2(i8* %p) { - call void (i8*, ...) @test_callee_2(i8* %p) +define void @test_callee_3(i8* %p, ...) { + call signext i16 (...) @vararg_fn() ret void } -; CHECK-LABEL: define void @test_caller_2(i8* %p) -; CHECK: call void (i8*, ...) @vararg_fn(i8* %this_adj.i) +define void @test_caller_3(i8* %p, i8* %q) { + call void (i8*, ...) @test_callee_3(i8* nonnull %p, i8* %q) + ret void +} +; CHECK-LABEL: define void @test_caller_3 +; CHECK: call signext i16 (...) @vararg_fn() define internal i32 @varg_accessed(...) { entry: @@ -50,3 +60,6 @@ define i32 @call_vargs() { declare void @llvm.va_start(i8*) declare void @llvm.va_end(i8*) + +; CHECK: attributes [[FN_ATTRS]] = { "foo"="bar" } +attributes #0 = { "foo"="bar" } |

