1 ; RUN: llc -relocation-model=static -verify-machineinstrs < %s --enable-shrink-wrap=false -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s 2 %struct.S = type { i8 } 3 4 @sg = internal thread_local global %struct.S zeroinitializer, align 1 5 @__dso_handle = external global i8 6 @__tls_guard = internal thread_local unnamed_addr global i1 false 7 @sum1 = internal thread_local global i32 0, align 4 8 9 declare void @_ZN1SC1Ev(%struct.S*) 10 declare void @_ZN1SD1Ev(%struct.S*) 11 declare i32 @_tlv_atexit(void (i8*)*, i8*, i8*) 12 13 ; CHECK-LABEL: _ZTW2sg 14 define cxx_fast_tlscc nonnull %struct.S* @_ZTW2sg() nounwind { 15 %.b.i = load i1, i1* @__tls_guard, align 1 16 ; CHECK: bc 12, 1, [[BB_end:.?LBB0_[0-9]+]] 17 br i1 %.b.i, label %__tls_init.exit, label %init.i 18 19 init.i: 20 ; CHECK: Folded Spill 21 store i1 true, i1* @__tls_guard, align 1 22 tail call void @_ZN1SC1Ev(%struct.S* nonnull @sg) #2 23 ; CHECK: bl _ZN1SC1Ev 24 %1 = tail call i32 @_tlv_atexit(void (i8*)* nonnull bitcast (void (%struct.S*)* @_ZN1SD1Ev to void (i8*)*), i8* nonnull getelementptr inbounds (%struct.S, %struct.S* @sg, i64 0, i32 0), i8* nonnull @__dso_handle) #2 25 ; CHECK: Folded Reload 26 ; CHECK: _tlv_atexit 27 br label %__tls_init.exit 28 29 ; CHECK: [[BB_end]]: 30 __tls_init.exit: 31 ret %struct.S* @sg 32 } 33 34 ; CHECK-LABEL: _ZTW4sum1 35 define cxx_fast_tlscc nonnull i32* @_ZTW4sum1() nounwind { 36 ret i32* @sum1 37 } 38 39 define cxx_fast_tlscc i32* @_ZTW4sum2() #0 { 40 ret i32* @sum1 41 } 42 43 attributes #0 = { nounwind "no-frame-pointer-elim"="true" } 44