stack-clash-dynamic-alloca.ll
4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14 | FileCheck %s
define i32 @fun0(i32 %n) #0 {
; CHECK-LABEL: fun0:
; CHECK: # %bb.0:
; CHECK-NEXT: stmg %r11, %r15, 88(%r15)
; CHECK-NEXT: .cfi_offset %r11, -72
; CHECK-NEXT: .cfi_offset %r15, -40
; CHECK-NEXT: aghi %r15, -160
; CHECK-NEXT: .cfi_def_cfa_offset 320
; CHECK-NEXT: lgr %r11, %r15
; CHECK-NEXT: .cfi_def_cfa_register %r11
; CHECK-NEXT: # kill: def $r2l killed $r2l def $r2d
; CHECK-NEXT: risbgn %r1, %r2, 30, 189, 2
; CHECK-NEXT: la %r0, 7(%r1)
; CHECK-NEXT: risbgn %r1, %r0, 29, 188, 0
; CHECK-NEXT: clgfi %r1, 4096
; CHECK-NEXT: jl .LBB0_2
; CHECK-NEXT: .LBB0_1: # =>This Inner Loop Header: Depth=1
; CHECK-NEXT: slgfi %r1, 4096
; CHECK-NEXT: slgfi %r15, 4096
; CHECK-NEXT: cg %r15, 4088(%r15)
; CHECK-NEXT: clgfi %r1, 4096
; CHECK-NEXT: jhe .LBB0_1
; CHECK-NEXT: .LBB0_2:
; CHECK-NEXT: cgije %r1, 0, .LBB0_4
; CHECK-NEXT: # %bb.3:
; CHECK-NEXT: slgr %r15, %r1
; CHECK-NEXT: cg %r15, -8(%r1,%r15)
; CHECK-NEXT: .LBB0_4:
; CHECK-NEXT: la %r1, 160(%r15)
; CHECK-NEXT: lhi %r0, 1
; CHECK-NEXT: sty %r0, 4792(%r1)
; CHECK-NEXT: l %r2, 0(%r1)
; CHECK-NEXT: lmg %r11, %r15, 248(%r11)
; CHECK-NEXT: br %r14
%a = alloca i32, i32 %n
%b = getelementptr inbounds i32, i32* %a, i64 1198
store volatile i32 1, i32* %b
%c = load volatile i32, i32* %a
ret i32 %c
}
; Probe size should be modulo stack alignment.
define i32 @fun1(i32 %n) #0 "stack-probe-size"="1250" {
; CHECK-LABEL: fun1:
; CHECK: # %bb.0:
; CHECK-NEXT: stmg %r11, %r15, 88(%r15)
; CHECK-NEXT: .cfi_offset %r11, -72
; CHECK-NEXT: .cfi_offset %r15, -40
; CHECK-NEXT: aghi %r15, -160
; CHECK-NEXT: .cfi_def_cfa_offset 320
; CHECK-NEXT: lgr %r11, %r15
; CHECK-NEXT: .cfi_def_cfa_register %r11
; CHECK-NEXT: # kill: def $r2l killed $r2l def $r2d
; CHECK-NEXT: risbgn %r1, %r2, 30, 189, 2
; CHECK-NEXT: la %r0, 7(%r1)
; CHECK-NEXT: risbgn %r1, %r0, 29, 188, 0
; CHECK-NEXT: clgfi %r1, 1248
; CHECK-NEXT: jl .LBB1_2
; CHECK-NEXT: .LBB1_1: # =>This Inner Loop Header: Depth=1
; CHECK-NEXT: slgfi %r1, 1248
; CHECK-NEXT: slgfi %r15, 1248
; CHECK-NEXT: cg %r15, 1240(%r15)
; CHECK-NEXT: clgfi %r1, 1248
; CHECK-NEXT: jhe .LBB1_1
; CHECK-NEXT: .LBB1_2:
; CHECK-NEXT: cgije %r1, 0, .LBB1_4
; CHECK-NEXT: # %bb.3:
; CHECK-NEXT: slgr %r15, %r1
; CHECK-NEXT: cg %r15, -8(%r1,%r15)
; CHECK-NEXT: .LBB1_4:
; CHECK-NEXT: la %r1, 160(%r15)
; CHECK-NEXT: lhi %r0, 1
; CHECK-NEXT: sty %r0, 4792(%r1)
; CHECK-NEXT: l %r2, 0(%r1)
; CHECK-NEXT: lmg %r11, %r15, 248(%r11)
; CHECK-NEXT: br %r14
%a = alloca i32, i32 %n
%b = getelementptr inbounds i32, i32* %a, i64 1198
store volatile i32 1, i32* %b
%c = load volatile i32, i32* %a
ret i32 %c
}
; The minimum probe size is the stack alignment.
define i32 @fun2(i32 %n) #0 "stack-probe-size"="4" {
; CHECK-LABEL: fun2:
; CHECK: # %bb.0:
; CHECK-NEXT: stmg %r11, %r15, 88(%r15)
; CHECK-NEXT: .cfi_offset %r11, -72
; CHECK-NEXT: .cfi_offset %r15, -40
; CHECK-NEXT: lgr %r1, %r15
; CHECK-NEXT: .cfi_def_cfa_register %r1
; CHECK-NEXT: aghi %r1, -160
; CHECK-NEXT: .cfi_def_cfa_offset 320
; CHECK-NEXT: .LBB2_1: # =>This Inner Loop Header: Depth=1
; CHECK-NEXT: aghi %r15, -8
; CHECK-NEXT: cg %r0, 0(%r15)
; CHECK-NEXT: clgrjh %r15, %r1, .LBB2_1
; CHECK-NEXT: # %bb.2:
; CHECK-NEXT: .cfi_def_cfa_register %r15
; CHECK-NEXT: lgr %r11, %r15
; CHECK-NEXT: .cfi_def_cfa_register %r11
; CHECK-NEXT: # kill: def $r2l killed $r2l def $r2d
; CHECK-NEXT: risbgn %r1, %r2, 30, 189, 2
; CHECK-NEXT: la %r0, 7(%r1)
; CHECK-NEXT: risbgn %r1, %r0, 29, 188, 0
; CHECK-NEXT: clgijl %r1, 8, .LBB2_4
; CHECK-NEXT: .LBB2_3: # =>This Inner Loop Header: Depth=1
; CHECK-NEXT: slgfi %r1, 8
; CHECK-NEXT: slgfi %r15, 8
; CHECK-NEXT: cg %r15, 0(%r15)
; CHECK-NEXT: clgijhe %r1, 8, .LBB2_3
; CHECK-NEXT: .LBB2_4:
; CHECK-NEXT: cgije %r1, 0, .LBB2_6
; CHECK-NEXT: # %bb.5:
; CHECK-NEXT: slgr %r15, %r1
; CHECK-NEXT: cg %r15, -8(%r1,%r15)
; CHECK-NEXT: .LBB2_6:
; CHECK-NEXT: la %r1, 160(%r15)
; CHECK-NEXT: lhi %r0, 1
; CHECK-NEXT: sty %r0, 4792(%r1)
; CHECK-NEXT: l %r2, 0(%r1)
; CHECK-NEXT: lmg %r11, %r15, 248(%r11)
; CHECK-NEXT: br %r14
%a = alloca i32, i32 %n
%b = getelementptr inbounds i32, i32* %a, i64 1198
store volatile i32 1, i32* %b
%c = load volatile i32, i32* %a
ret i32 %c
}
attributes #0 = {"probe-stack"="inline-asm"}