Chris Dewhurst | 53bde95 | 2016-06-01 08:48:56 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=sparc | FileCheck %s |
| 2 | |
| 3 | ; CHECK-LABEL: struct_ptr_test |
| 4 | ; CHECK: call struct_ptr_fn |
| 5 | ; CHECK-NEXT: st %i0, [%fp+-4] |
| 6 | ; CHECK-NEXT: ret |
| 7 | |
| 8 | %struct.S = type {} |
| 9 | |
| 10 | define void @struct_ptr_test(i32 %i) { |
| 11 | entry: |
| 12 | %i.addr = alloca i32, align 4 |
| 13 | store i32 %i, i32* %i.addr, align 4 |
| 14 | %0 = bitcast i32* %i.addr to %struct.S* |
| 15 | call void @struct_ptr_fn(%struct.S* byval align 1 %0) |
| 16 | ret void |
| 17 | } |
| 18 | |
| 19 | declare void @struct_ptr_fn(%struct.S* byval align 1) |
| 20 | |
| 21 | ; CHECK-LABEL: struct_test |
| 22 | ; CHECK: call struct_fn |
| 23 | ; CHECK-NEXT: nop |
| 24 | ; CHECK-NEXT: ret |
| 25 | |
| 26 | %struct.U = type {} |
| 27 | |
| 28 | @a = internal global [1 x %struct.U] zeroinitializer, align 1 |
| 29 | |
| 30 | define void @struct_test() { |
| 31 | entry: |
| 32 | tail call void @struct_fn(%struct.U* byval align 1 getelementptr inbounds ([1 x %struct.U], [1 x %struct.U]* @a, i32 0, i32 0)) |
| 33 | ret void |
| 34 | } |
| 35 | |
| 36 | ; CHECK-LABEL: struct_arg_test |
| 37 | ; CHECK: call struct_arg_fn |
| 38 | ; CHECK-NEXT: nop |
| 39 | ; CHECK-NEXT: ret |
| 40 | |
| 41 | declare void @struct_fn(%struct.U* byval align 1) |
| 42 | |
| 43 | @b = internal global [1 x %struct.U] zeroinitializer, align 1 |
| 44 | |
| 45 | define void @struct_arg_test() { |
| 46 | entry: |
| 47 | tail call void @struct_arg_fn(%struct.U* byval align 1 getelementptr inbounds ([1 x %struct.U], [1 x %struct.U]* @b, i32 0, i32 0)) |
| 48 | ret void |
| 49 | } |
| 50 | |
| 51 | declare void @struct_arg_fn(%struct.U* byval align 1) |