Manman Ren | cb8470b | 2015-12-08 00:14:38 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=aarch64-apple-ios | FileCheck %s |
| 2 | ; RUN: llc < %s -mtriple=aarch64-apple-ios -enable-shrink-wrap=true | FileCheck --check-prefix=CHECK %s |
| 3 | ; Shrink wrapping currently does not kick in because we have a TLS CALL |
| 4 | ; in the entry block and it will clobber the link register. |
| 5 | |
| 6 | %struct.S = type { i8 } |
| 7 | |
| 8 | @sg = internal thread_local global %struct.S zeroinitializer, align 1 |
| 9 | @__dso_handle = external global i8 |
| 10 | @__tls_guard = internal thread_local unnamed_addr global i1 false |
| 11 | |
| 12 | declare %struct.S* @_ZN1SC1Ev(%struct.S* returned) |
| 13 | declare %struct.S* @_ZN1SD1Ev(%struct.S* returned) |
| 14 | declare i32 @_tlv_atexit(void (i8*)*, i8*, i8*) |
| 15 | |
Manman Ren | cbe4f94 | 2015-12-16 21:04:19 +0000 | [diff] [blame^] | 16 | define cxx_fast_tlscc nonnull %struct.S* @_ZTW2sg() nounwind { |
Manman Ren | cb8470b | 2015-12-08 00:14:38 +0000 | [diff] [blame] | 17 | %.b.i = load i1, i1* @__tls_guard, align 1 |
| 18 | br i1 %.b.i, label %__tls_init.exit, label %init.i |
| 19 | |
| 20 | init.i: |
| 21 | store i1 true, i1* @__tls_guard, align 1 |
| 22 | %call.i.i = tail call %struct.S* @_ZN1SC1Ev(%struct.S* nonnull @sg) |
| 23 | %1 = tail call i32 @_tlv_atexit(void (i8*)* nonnull bitcast (%struct.S* (%struct.S*)* @_ZN1SD1Ev to void (i8*)*), i8* nonnull getelementptr inbounds (%struct.S, %struct.S* @sg, i64 0, i32 0), i8* nonnull @__dso_handle) |
| 24 | br label %__tls_init.exit |
| 25 | |
| 26 | __tls_init.exit: |
| 27 | ret %struct.S* @sg |
| 28 | } |
| 29 | |
| 30 | ; CHECK-LABEL: _ZTW2sg |
Manman Ren | cbe4f94 | 2015-12-16 21:04:19 +0000 | [diff] [blame^] | 31 | ; CHECK-NOT: stp d31, d30 |
| 32 | ; CHECK-NOT: stp d29, d28 |
| 33 | ; CHECK-NOT: stp d27, d26 |
| 34 | ; CHECK-NOT: stp d25, d24 |
| 35 | ; CHECK-NOT: stp d23, d22 |
| 36 | ; CHECK-NOT: stp d21, d20 |
| 37 | ; CHECK-NOT: stp d19, d18 |
| 38 | ; CHECK-NOT: stp d17, d16 |
| 39 | ; CHECK-NOT: stp d7, d6 |
| 40 | ; CHECK-NOT: stp d5, d4 |
| 41 | ; CHECK-NOT: stp d3, d2 |
| 42 | ; CHECK-NOT: stp d1, d0 |
| 43 | ; CHECK-NOT: stp x20, x19 |
| 44 | ; CHECK-NOT: stp x14, x13 |
| 45 | ; CHECK-NOT: stp x12, x11 |
| 46 | ; CHECK-NOT: stp x10, x9 |
| 47 | ; CHECK-NOT: stp x8, x7 |
| 48 | ; CHECK-NOT: stp x6, x5 |
| 49 | ; CHECK-NOT: stp x4, x3 |
| 50 | ; CHECK-NOT: stp x2, x1 |
Manman Ren | cb8470b | 2015-12-08 00:14:38 +0000 | [diff] [blame] | 51 | ; CHECK: blr |
| 52 | ; CHECK: tbnz w{{.*}}, #0, [[BB_end:.?LBB0_[0-9]+]] |
| 53 | ; CHECK: blr |
| 54 | ; CHECK: tlv_atexit |
| 55 | ; CHECK: [[BB_end]]: |
| 56 | ; CHECK: blr |
Manman Ren | cbe4f94 | 2015-12-16 21:04:19 +0000 | [diff] [blame^] | 57 | ; CHECK-NOT: ldp x2, x1 |
| 58 | ; CHECK-NOT: ldp x4, x3 |
| 59 | ; CHECK-NOT: ldp x6, x5 |
| 60 | ; CHECK-NOT: ldp x8, x7 |
| 61 | ; CHECK-NOT: ldp x10, x9 |
| 62 | ; CHECK-NOT: ldp x12, x11 |
| 63 | ; CHECK-NOT: ldp x14, x13 |
| 64 | ; CHECK-NOT: ldp x20, x19 |
| 65 | ; CHECK-NOT: ldp d1, d0 |
| 66 | ; CHECK-NOT: ldp d3, d2 |
| 67 | ; CHECK-NOT: ldp d5, d4 |
| 68 | ; CHECK-NOT: ldp d7, d6 |
| 69 | ; CHECK-NOT: ldp d17, d16 |
| 70 | ; CHECK-NOT: ldp d19, d18 |
| 71 | ; CHECK-NOT: ldp d21, d20 |
| 72 | ; CHECK-NOT: ldp d23, d22 |
| 73 | ; CHECK-NOT: ldp d25, d24 |
| 74 | ; CHECK-NOT: ldp d27, d26 |
| 75 | ; CHECK-NOT: ldp d29, d28 |
| 76 | ; CHECK-NOT: ldp d31, d30 |