OLD | NEW |
1 ; RUN: opt < %s -expand-varargs -S | FileCheck %s | 1 ; RUN: opt < %s -expand-varargs -S | FileCheck %s |
2 | 2 |
3 declare i32 @varargs_func(i32 %arg, ...) | 3 declare i32 @varargs_func(i32 %arg, ...) |
4 | 4 |
5 | 5 |
6 ; Check that attributes such as "byval" are preserved on fixed arguments. | 6 ; Check that attributes such as "byval" are preserved on fixed arguments. |
7 | 7 |
8 %MyStruct = type { i64, i64 } | 8 %MyStruct = type { i64, i64 } |
9 | 9 |
10 define void @func_with_arg_attrs(%MyStruct* byval, ...) { | 10 define void @func_with_arg_attrs(%MyStruct* byval, ...) { |
11 ret void | 11 ret void |
12 } | 12 } |
13 ; CHECK: define void @func_with_arg_attrs(%MyStruct* byval, i8* %varargs) { | 13 ; CHECK: define void @func_with_arg_attrs(%MyStruct* byval, i8* noalias %varargs
) { |
14 | 14 |
15 | 15 |
16 declare void @take_struct_arg(%MyStruct* byval %s, ...) | 16 declare void @take_struct_arg(%MyStruct* byval %s, ...) |
17 | 17 |
18 define void @call_with_arg_attrs(%MyStruct* %s) { | 18 define void @call_with_arg_attrs(%MyStruct* %s) { |
19 call void (%MyStruct*, ...)* @take_struct_arg(%MyStruct* byval %s) | 19 call void (%MyStruct*, ...)* @take_struct_arg(%MyStruct* byval %s) |
20 ret void | 20 ret void |
21 } | 21 } |
22 ; CHECK: define void @call_with_arg_attrs(%MyStruct* %s) { | 22 ; CHECK: define void @call_with_arg_attrs(%MyStruct* %s) { |
23 ; CHECK: call void %vararg_func(%MyStruct* byval %s, %vararg_call{{.*}} %vararg_
buffer) | 23 ; CHECK: call void %vararg_func(%MyStruct* byval %s, %vararg_call{{.*}} %vararg_
buffer) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ; reads space alloca'd by the caller. | 63 ; reads space alloca'd by the caller. |
64 define i32 @tail_call() { | 64 define i32 @tail_call() { |
65 %result = tail call i32 (i32, ...)* @varargs_func(i32 111, i64 222) | 65 %result = tail call i32 (i32, ...)* @varargs_func(i32 111, i64 222) |
66 ret i32 %result | 66 ret i32 %result |
67 } | 67 } |
68 ; CHECK: define i32 @tail_call() { | 68 ; CHECK: define i32 @tail_call() { |
69 ; CHECK: %result = call i32 %vararg_func(i32 111 | 69 ; CHECK: %result = call i32 %vararg_func(i32 111 |
70 | 70 |
71 | 71 |
72 ; CHECK: attributes #1 = { readonly } | 72 ; CHECK: attributes #1 = { readonly } |
OLD | NEW |