blob: 0fc53556f62f06eae39764f6a415970a576924ad [file] [log] [blame]
Evgeniy Stepanovd5a6fdb2018-01-23 21:27:07 +00001; 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
3
4@p = external thread_local global i8*, align 8
5
6define nonnull i8** @__safestack_pointer_address() local_unnamed_addr ATTR {
7entry:
8 ret i8** @p
9}
10
11define void @_Z1fv() safestack {
12entry:
13 %x = alloca i32, align 4
14 %0 = bitcast i32* %x to i8*
15 call void @_Z7CapturePi(i32* nonnull %x)
16 ret void
17}
18
19declare void @_Z7CapturePi(i32*)
20
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]])
25
26; CALL: callq __safestack_pointer_address
27; CALL: movq %rax, %[[A:.*]]
Geoff Berrya2b90112018-02-27 16:59:10 +000028; CALL: movq (%rax), %[[B:.*]]
Evgeniy Stepanovd5a6fdb2018-01-23 21:27:07 +000029; CALL: leaq -16(%[[B]]), %[[C:.*]]
30; CALL: movq %[[C]], (%[[A]])