1 ; RUN: sed -e "s/ATTR//" %s | llc -mtriple=x86_64-linux -safestack-use-pointer-address | FileCheck --check-prefix=INLINE %s
2 ; RUN: sed -e "s/ATTR/noinline/" %s | llc -mtriple=x86_64-linux -safestack-use-pointer-address | FileCheck --check-prefix=CALL %s
4 @p = external thread_local global i8*, align 8
6 define nonnull i8** @__safestack_pointer_address() local_unnamed_addr ATTR {
11 define void @_Z1fv() safestack {
13 %x = alloca i32, align 4
14 %0 = bitcast i32* %x to i8*
15 call void @_Z7CapturePi(i32* nonnull %x)
19 declare void @_Z7CapturePi(i32*)
21 ; INLINE: movq p@GOTTPOFF(%rip), %[[A:.*]]
22 ; INLINE: movq %fs:(%[[A]]), %[[B:.*]]
23 ; INLINE: leaq -16(%[[B]]), %[[C:.*]]
24 ; INLINE: movq %[[C]], %fs:(%[[A]])
26 ; CALL: callq __safestack_pointer_address
27 ; CALL: movq %rax, %[[A:.*]]
28 ; CALL: movq (%rax), %[[B:.*]]
29 ; CALL: leaq -16(%[[B]]), %[[C:.*]]
30 ; CALL: movq %[[C]], (%[[A]])