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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=mips-unknown-linux-gnu -enable-shrink-wrap=true \
; RUN: -relocation-model=static < %s | \
; RUN: FileCheck %s -check-prefix=SHRINK-WRAP-STATIC
; RUN: llc -mtriple=mips-unknown-linux-gnu -enable-shrink-wrap=false \
; RUN: -relocation-model=static < %s | \
; RUN: FileCheck %s -check-prefix=NO-SHRINK-WRAP-STATIC
; RUN: llc -mtriple=mips-unknown-linux-gnu -enable-shrink-wrap=true \
; RUN: -relocation-model=pic -mips-jalr-reloc=false < %s | \
; RUN: FileCheck %s -check-prefix=SHRINK-WRAP-PIC
; RUN: llc -mtriple=mips-unknown-linux-gnu -enable-shrink-wrap=false \
; RUN: -relocation-model=pic -mips-jalr-reloc=false < %s | \
; RUN: FileCheck %s -check-prefix=NO-SHRINK-WRAP-PIC
; RUN: llc -mtriple=mips64-unknown-linux-gnu -enable-shrink-wrap=true \
; RUN: -relocation-model=static < %s | \
; RUN: FileCheck %s -check-prefix=SHRINK-WRAP-64-STATIC
; RUN: llc -mtriple=mips64-unknown-linux-gnu -enable-shrink-wrap=false \
; RUN: -relocation-model=static < %s | \
; RUN: FileCheck %s -check-prefix=NO-SHRINK-WRAP-64-STATIC
; RUN: llc -mtriple=mips64-unknown-linux-gnu -enable-shrink-wrap=true \
; RUN: -relocation-model=pic -mips-jalr-reloc=false < %s | \
; RUN: FileCheck %s -check-prefix=SHRINK-WRAP-64-PIC
; RUN: llc -mtriple=mips64-unknown-linux-gnu -enable-shrink-wrap=false \
; RUN: -relocation-model=pic -mips-jalr-reloc=false < %s | \
; RUN: FileCheck %s -check-prefix=NO-SHRINK-WRAP-64-PIC
declare void @f(i32 signext)
define i32 @foo(i32 signext %a) {
; SHRINK-WRAP-STATIC-LABEL: foo:
; SHRINK-WRAP-STATIC: # %bb.0: # %entry
; SHRINK-WRAP-STATIC-NEXT: beqz $4, $BB0_2
; SHRINK-WRAP-STATIC-NEXT: nop
; SHRINK-WRAP-STATIC-NEXT: # %bb.1: # %if.end
; SHRINK-WRAP-STATIC-NEXT: addiu $sp, $sp, -24
; SHRINK-WRAP-STATIC-NEXT: .cfi_def_cfa_offset 24
; SHRINK-WRAP-STATIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; SHRINK-WRAP-STATIC-NEXT: .cfi_offset 31, -4
; SHRINK-WRAP-STATIC-NEXT: jal f
; SHRINK-WRAP-STATIC-NEXT: addiu $4, $4, 1
; SHRINK-WRAP-STATIC-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
; SHRINK-WRAP-STATIC-NEXT: addiu $sp, $sp, 24
; SHRINK-WRAP-STATIC-NEXT: $BB0_2: # %return
; SHRINK-WRAP-STATIC-NEXT: jr $ra
; SHRINK-WRAP-STATIC-NEXT: addiu $2, $zero, 0
;
; NO-SHRINK-WRAP-STATIC-LABEL: foo:
; NO-SHRINK-WRAP-STATIC: # %bb.0: # %entry
; NO-SHRINK-WRAP-STATIC-NEXT: addiu $sp, $sp, -24
; NO-SHRINK-WRAP-STATIC-NEXT: .cfi_def_cfa_offset 24
; NO-SHRINK-WRAP-STATIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; NO-SHRINK-WRAP-STATIC-NEXT: .cfi_offset 31, -4
; NO-SHRINK-WRAP-STATIC-NEXT: beqz $4, $BB0_2
; NO-SHRINK-WRAP-STATIC-NEXT: nop
; NO-SHRINK-WRAP-STATIC-NEXT: # %bb.1: # %if.end
; NO-SHRINK-WRAP-STATIC-NEXT: jal f
; NO-SHRINK-WRAP-STATIC-NEXT: addiu $4, $4, 1
; NO-SHRINK-WRAP-STATIC-NEXT: $BB0_2: # %return
; NO-SHRINK-WRAP-STATIC-NEXT: addiu $2, $zero, 0
; NO-SHRINK-WRAP-STATIC-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
; NO-SHRINK-WRAP-STATIC-NEXT: jr $ra
; NO-SHRINK-WRAP-STATIC-NEXT: addiu $sp, $sp, 24
;
; SHRINK-WRAP-PIC-LABEL: foo:
; SHRINK-WRAP-PIC: # %bb.0: # %entry
; SHRINK-WRAP-PIC-NEXT: lui $2, %hi(_gp_disp)
; SHRINK-WRAP-PIC-NEXT: addiu $2, $2, %lo(_gp_disp)
; SHRINK-WRAP-PIC-NEXT: beqz $4, $BB0_2
; SHRINK-WRAP-PIC-NEXT: addu $gp, $2, $25
; SHRINK-WRAP-PIC-NEXT: # %bb.1: # %if.end
; SHRINK-WRAP-PIC-NEXT: addiu $sp, $sp, -24
; SHRINK-WRAP-PIC-NEXT: .cfi_def_cfa_offset 24
; SHRINK-WRAP-PIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; SHRINK-WRAP-PIC-NEXT: .cfi_offset 31, -4
; SHRINK-WRAP-PIC-NEXT: lw $25, %call16(f)($gp)
; SHRINK-WRAP-PIC-NEXT: jalr $25
; SHRINK-WRAP-PIC-NEXT: addiu $4, $4, 1
; SHRINK-WRAP-PIC-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
; SHRINK-WRAP-PIC-NEXT: addiu $sp, $sp, 24
; SHRINK-WRAP-PIC-NEXT: $BB0_2: # %return
; SHRINK-WRAP-PIC-NEXT: jr $ra
; SHRINK-WRAP-PIC-NEXT: addiu $2, $zero, 0
;
; NO-SHRINK-WRAP-PIC-LABEL: foo:
; NO-SHRINK-WRAP-PIC: # %bb.0: # %entry
; NO-SHRINK-WRAP-PIC-NEXT: lui $2, %hi(_gp_disp)
; NO-SHRINK-WRAP-PIC-NEXT: addiu $2, $2, %lo(_gp_disp)
; NO-SHRINK-WRAP-PIC-NEXT: addiu $sp, $sp, -24
; NO-SHRINK-WRAP-PIC-NEXT: .cfi_def_cfa_offset 24
; NO-SHRINK-WRAP-PIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; NO-SHRINK-WRAP-PIC-NEXT: .cfi_offset 31, -4
; NO-SHRINK-WRAP-PIC-NEXT: beqz $4, $BB0_2
; NO-SHRINK-WRAP-PIC-NEXT: addu $gp, $2, $25
; NO-SHRINK-WRAP-PIC-NEXT: # %bb.1: # %if.end
; NO-SHRINK-WRAP-PIC-NEXT: lw $25, %call16(f)($gp)
; NO-SHRINK-WRAP-PIC-NEXT: jalr $25
; NO-SHRINK-WRAP-PIC-NEXT: addiu $4, $4, 1
; NO-SHRINK-WRAP-PIC-NEXT: $BB0_2: # %return
; NO-SHRINK-WRAP-PIC-NEXT: addiu $2, $zero, 0
; NO-SHRINK-WRAP-PIC-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
; NO-SHRINK-WRAP-PIC-NEXT: jr $ra
; NO-SHRINK-WRAP-PIC-NEXT: addiu $sp, $sp, 24
;
; SHRINK-WRAP-64-STATIC-LABEL: foo:
; SHRINK-WRAP-64-STATIC: # %bb.0: # %entry
; SHRINK-WRAP-64-STATIC-NEXT: beqz $4, .LBB0_2
; SHRINK-WRAP-64-STATIC-NEXT: nop
; SHRINK-WRAP-64-STATIC-NEXT: # %bb.1: # %if.end
; SHRINK-WRAP-64-STATIC-NEXT: daddiu $sp, $sp, -16
; SHRINK-WRAP-64-STATIC-NEXT: .cfi_def_cfa_offset 16
; SHRINK-WRAP-64-STATIC-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
; SHRINK-WRAP-64-STATIC-NEXT: .cfi_offset 31, -8
; SHRINK-WRAP-64-STATIC-NEXT: jal f
; SHRINK-WRAP-64-STATIC-NEXT: addiu $4, $4, 1
; SHRINK-WRAP-64-STATIC-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
; SHRINK-WRAP-64-STATIC-NEXT: daddiu $sp, $sp, 16
; SHRINK-WRAP-64-STATIC-NEXT: .LBB0_2: # %return
; SHRINK-WRAP-64-STATIC-NEXT: jr $ra
; SHRINK-WRAP-64-STATIC-NEXT: addiu $2, $zero, 0
;
; NO-SHRINK-WRAP-64-STATIC-LABEL: foo:
; NO-SHRINK-WRAP-64-STATIC: # %bb.0: # %entry
; NO-SHRINK-WRAP-64-STATIC-NEXT: daddiu $sp, $sp, -16
; NO-SHRINK-WRAP-64-STATIC-NEXT: .cfi_def_cfa_offset 16
; NO-SHRINK-WRAP-64-STATIC-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
; NO-SHRINK-WRAP-64-STATIC-NEXT: .cfi_offset 31, -8
; NO-SHRINK-WRAP-64-STATIC-NEXT: beqz $4, .LBB0_2
; NO-SHRINK-WRAP-64-STATIC-NEXT: nop
; NO-SHRINK-WRAP-64-STATIC-NEXT: # %bb.1: # %if.end
; NO-SHRINK-WRAP-64-STATIC-NEXT: jal f
; NO-SHRINK-WRAP-64-STATIC-NEXT: addiu $4, $4, 1
; NO-SHRINK-WRAP-64-STATIC-NEXT: .LBB0_2: # %return
; NO-SHRINK-WRAP-64-STATIC-NEXT: addiu $2, $zero, 0
; NO-SHRINK-WRAP-64-STATIC-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
; NO-SHRINK-WRAP-64-STATIC-NEXT: jr $ra
; NO-SHRINK-WRAP-64-STATIC-NEXT: daddiu $sp, $sp, 16
;
; SHRINK-WRAP-64-PIC-LABEL: foo:
; SHRINK-WRAP-64-PIC: # %bb.0: # %entry
; SHRINK-WRAP-64-PIC-NEXT: lui $1, %hi(%neg(%gp_rel(foo)))
; SHRINK-WRAP-64-PIC-NEXT: beqz $4, .LBB0_2
; SHRINK-WRAP-64-PIC-NEXT: daddu $2, $1, $25
; SHRINK-WRAP-64-PIC-NEXT: # %bb.1: # %if.end
; SHRINK-WRAP-64-PIC-NEXT: daddiu $sp, $sp, -16
; SHRINK-WRAP-64-PIC-NEXT: .cfi_def_cfa_offset 16
; SHRINK-WRAP-64-PIC-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
; SHRINK-WRAP-64-PIC-NEXT: sd $gp, 0($sp) # 8-byte Folded Spill
; SHRINK-WRAP-64-PIC-NEXT: .cfi_offset 31, -8
; SHRINK-WRAP-64-PIC-NEXT: .cfi_offset 28, -16
; SHRINK-WRAP-64-PIC-NEXT: daddiu $gp, $2, %lo(%neg(%gp_rel(foo)))
; SHRINK-WRAP-64-PIC-NEXT: ld $25, %call16(f)($gp)
; SHRINK-WRAP-64-PIC-NEXT: jalr $25
; SHRINK-WRAP-64-PIC-NEXT: addiu $4, $4, 1
; SHRINK-WRAP-64-PIC-NEXT: ld $gp, 0($sp) # 8-byte Folded Reload
; SHRINK-WRAP-64-PIC-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
; SHRINK-WRAP-64-PIC-NEXT: daddiu $sp, $sp, 16
; SHRINK-WRAP-64-PIC-NEXT: .LBB0_2: # %return
; SHRINK-WRAP-64-PIC-NEXT: jr $ra
; SHRINK-WRAP-64-PIC-NEXT: addiu $2, $zero, 0
;
; NO-SHRINK-WRAP-64-PIC-LABEL: foo:
; NO-SHRINK-WRAP-64-PIC: # %bb.0: # %entry
; NO-SHRINK-WRAP-64-PIC-NEXT: daddiu $sp, $sp, -16
; NO-SHRINK-WRAP-64-PIC-NEXT: .cfi_def_cfa_offset 16
; NO-SHRINK-WRAP-64-PIC-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
; NO-SHRINK-WRAP-64-PIC-NEXT: sd $gp, 0($sp) # 8-byte Folded Spill
; NO-SHRINK-WRAP-64-PIC-NEXT: .cfi_offset 31, -8
; NO-SHRINK-WRAP-64-PIC-NEXT: .cfi_offset 28, -16
; NO-SHRINK-WRAP-64-PIC-NEXT: lui $1, %hi(%neg(%gp_rel(foo)))
; NO-SHRINK-WRAP-64-PIC-NEXT: beqz $4, .LBB0_2
; NO-SHRINK-WRAP-64-PIC-NEXT: daddu $2, $1, $25
; NO-SHRINK-WRAP-64-PIC-NEXT: # %bb.1: # %if.end
; NO-SHRINK-WRAP-64-PIC-NEXT: daddiu $gp, $2, %lo(%neg(%gp_rel(foo)))
; NO-SHRINK-WRAP-64-PIC-NEXT: ld $25, %call16(f)($gp)
; NO-SHRINK-WRAP-64-PIC-NEXT: jalr $25
; NO-SHRINK-WRAP-64-PIC-NEXT: addiu $4, $4, 1
; NO-SHRINK-WRAP-64-PIC-NEXT: .LBB0_2: # %return
; NO-SHRINK-WRAP-64-PIC-NEXT: addiu $2, $zero, 0
; NO-SHRINK-WRAP-64-PIC-NEXT: ld $gp, 0($sp) # 8-byte Folded Reload
; NO-SHRINK-WRAP-64-PIC-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload
; NO-SHRINK-WRAP-64-PIC-NEXT: jr $ra
; NO-SHRINK-WRAP-64-PIC-NEXT: daddiu $sp, $sp, 16
entry:
%cmp = icmp eq i32 %a, 0
br i1 %cmp, label %return, label %if.end
if.end:
%add = add nsw i32 %a, 1
tail call void @f(i32 signext %add)
br label %return
return:
ret i32 0
}
; Test that long branch expansion works correctly with shrink-wrapping enabled.
define i32 @foo2(i32 signext %a) {
; SHRINK-WRAP-STATIC-LABEL: foo2:
; SHRINK-WRAP-STATIC: # %bb.0:
; SHRINK-WRAP-STATIC-NEXT: addiu $1, $zero, 4
; SHRINK-WRAP-STATIC-NEXT: bne $4, $1, $BB1_2
; SHRINK-WRAP-STATIC-NEXT: nop
; SHRINK-WRAP-STATIC-NEXT: # %bb.1:
; SHRINK-WRAP-STATIC-NEXT: j $BB1_3
; SHRINK-WRAP-STATIC-NEXT: nop
; SHRINK-WRAP-STATIC-NEXT: $BB1_2: # %if.then
; SHRINK-WRAP-STATIC-NEXT: addiu $sp, $sp, -24
; SHRINK-WRAP-STATIC-NEXT: .cfi_def_cfa_offset 24
; SHRINK-WRAP-STATIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; SHRINK-WRAP-STATIC-NEXT: .cfi_offset 31, -4
; SHRINK-WRAP-STATIC-NEXT: #APP
;
; NO-SHRINK-WRAP-STATIC-LABEL: foo2:
; NO-SHRINK-WRAP-STATIC: # %bb.0:
; NO-SHRINK-WRAP-STATIC-NEXT: addiu $sp, $sp, -24
; NO-SHRINK-WRAP-STATIC-NEXT: .cfi_def_cfa_offset 24
; NO-SHRINK-WRAP-STATIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; NO-SHRINK-WRAP-STATIC-NEXT: .cfi_offset 31, -4
; NO-SHRINK-WRAP-STATIC-NEXT: addiu $1, $zero, 4
; NO-SHRINK-WRAP-STATIC-NEXT: bne $4, $1, $BB1_2
; NO-SHRINK-WRAP-STATIC-NEXT: nop
; NO-SHRINK-WRAP-STATIC-NEXT: # %bb.1:
; NO-SHRINK-WRAP-STATIC-NEXT: j $BB1_3
; NO-SHRINK-WRAP-STATIC-NEXT: nop
; NO-SHRINK-WRAP-STATIC-NEXT: $BB1_2: # %if.then
; NO-SHRINK-WRAP-STATIC-NEXT: #APP
;
; SHRINK-WRAP-PIC-LABEL: foo2:
; SHRINK-WRAP-PIC: # %bb.0:
; SHRINK-WRAP-PIC-NEXT: lui $2, %hi(_gp_disp)
; SHRINK-WRAP-PIC-NEXT: addiu $2, $2, %lo(_gp_disp)
; SHRINK-WRAP-PIC-NEXT: addiu $1, $zero, 4
; SHRINK-WRAP-PIC-NEXT: bne $4, $1, $BB1_3
; SHRINK-WRAP-PIC-NEXT: addu $gp, $2, $25
; SHRINK-WRAP-PIC-NEXT: # %bb.1:
; SHRINK-WRAP-PIC-NEXT: addiu $sp, $sp, -8
; SHRINK-WRAP-PIC-NEXT: sw $ra, 0($sp)
; SHRINK-WRAP-PIC-NEXT: lui $1, %hi(($BB1_4)-($BB1_2))
; SHRINK-WRAP-PIC-NEXT: bal $BB1_2
; SHRINK-WRAP-PIC-NEXT: addiu $1, $1, %lo(($BB1_4)-($BB1_2))
; SHRINK-WRAP-PIC-NEXT: $BB1_2:
; SHRINK-WRAP-PIC-NEXT: addu $1, $ra, $1
; SHRINK-WRAP-PIC-NEXT: lw $ra, 0($sp)
; SHRINK-WRAP-PIC-NEXT: jr $1
; SHRINK-WRAP-PIC-NEXT: addiu $sp, $sp, 8
; SHRINK-WRAP-PIC-NEXT: $BB1_3: # %if.then
; SHRINK-WRAP-PIC-NEXT: addiu $sp, $sp, -24
; SHRINK-WRAP-PIC-NEXT: .cfi_def_cfa_offset 24
; SHRINK-WRAP-PIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; SHRINK-WRAP-PIC-NEXT: .cfi_offset 31, -4
; SHRINK-WRAP-PIC-NEXT: #APP
;
; NO-SHRINK-WRAP-PIC-LABEL: foo2:
; NO-SHRINK-WRAP-PIC: # %bb.0:
; NO-SHRINK-WRAP-PIC-NEXT: lui $2, %hi(_gp_disp)
; NO-SHRINK-WRAP-PIC-NEXT: addiu $2, $2, %lo(_gp_disp)
; NO-SHRINK-WRAP-PIC-NEXT: addiu $sp, $sp, -24
; NO-SHRINK-WRAP-PIC-NEXT: .cfi_def_cfa_offset 24
; NO-SHRINK-WRAP-PIC-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
; NO-SHRINK-WRAP-PIC-NEXT: .cfi_offset 31, -4
; NO-SHRINK-WRAP-PIC-NEXT: addiu $1, $zero, 4
; NO-SHRINK-WRAP-PIC-NEXT: bne $4, $1, $BB1_3
; NO-SHRINK-WRAP-PIC-NEXT: addu $gp, $2, $25
; NO-SHRINK-WRAP-PIC-NEXT: # %bb.1:
; NO-SHRINK-WRAP-PIC-NEXT: addiu $sp, $sp, -8
; NO-SHRINK-WRAP-PIC-NEXT: sw $ra, 0($sp)
; NO-SHRINK-WRAP-PIC-NEXT: lui $1, %hi(($BB1_4)-($BB1_2))
; NO-SHRINK-WRAP-PIC-NEXT: bal $BB1_2
; NO-SHRINK-WRAP-PIC-NEXT: addiu $1, $1, %lo(($BB1_4)-($BB1_2))
; NO-SHRINK-WRAP-PIC-NEXT: $BB1_2:
; NO-SHRINK-WRAP-PIC-NEXT: addu $1, $ra, $1
; NO-SHRINK-WRAP-PIC-NEXT: lw $ra, 0($sp)
; NO-SHRINK-WRAP-PIC-NEXT: jr $1
; NO-SHRINK-WRAP-PIC-NEXT: addiu $sp, $sp, 8
; NO-SHRINK-WRAP-PIC-NEXT: $BB1_3: # %if.then
; NO-SHRINK-WRAP-PIC-NEXT: #APP
;
; SHRINK-WRAP-64-STATIC-LABEL: foo2:
; SHRINK-WRAP-64-STATIC: # %bb.0:
; SHRINK-WRAP-64-STATIC-NEXT: addiu $1, $zero, 4
; SHRINK-WRAP-64-STATIC-NEXT: bne $4, $1, .LBB1_2
; SHRINK-WRAP-64-STATIC-NEXT: nop
; SHRINK-WRAP-64-STATIC-NEXT: # %bb.1:
; SHRINK-WRAP-64-STATIC-NEXT: j .LBB1_3
; SHRINK-WRAP-64-STATIC-NEXT: nop
; SHRINK-WRAP-64-STATIC-NEXT: .LBB1_2: # %if.then
; SHRINK-WRAP-64-STATIC-NEXT: daddiu $sp, $sp, -16
; SHRINK-WRAP-64-STATIC-NEXT: .cfi_def_cfa_offset 16
; SHRINK-WRAP-64-STATIC-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
; SHRINK-WRAP-64-STATIC-NEXT: .cfi_offset 31, -8
; SHRINK-WRAP-64-STATIC-NEXT: sll $4, $4, 0
; SHRINK-WRAP-64-STATIC-NEXT: #APP
;
; NO-SHRINK-WRAP-64-STATIC-LABEL: foo2:
; NO-SHRINK-WRAP-64-STATIC: # %bb.0:
; NO-SHRINK-WRAP-64-STATIC-NEXT: daddiu $sp, $sp, -16
; NO-SHRINK-WRAP-64-STATIC-NEXT: .cfi_def_cfa_offset 16
; NO-SHRINK-WRAP-64-STATIC-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
; NO-SHRINK-WRAP-64-STATIC-NEXT: .cfi_offset 31, -8
; NO-SHRINK-WRAP-64-STATIC-NEXT: addiu $1, $zero, 4
; NO-SHRINK-WRAP-64-STATIC-NEXT: bne $4, $1, .LBB1_2
; NO-SHRINK-WRAP-64-STATIC-NEXT: nop
; NO-SHRINK-WRAP-64-STATIC-NEXT: # %bb.1:
; NO-SHRINK-WRAP-64-STATIC-NEXT: j .LBB1_3
; NO-SHRINK-WRAP-64-STATIC-NEXT: nop
; NO-SHRINK-WRAP-64-STATIC-NEXT: .LBB1_2: # %if.then
; NO-SHRINK-WRAP-64-STATIC-NEXT: sll $4, $4, 0
; NO-SHRINK-WRAP-64-STATIC-NEXT: #APP
;
; SHRINK-WRAP-64-PIC-LABEL: foo2:
; SHRINK-WRAP-64-PIC: # %bb.0:
; SHRINK-WRAP-64-PIC-NEXT: lui $1, %hi(%neg(%gp_rel(foo2)))
; SHRINK-WRAP-64-PIC-NEXT: daddu $2, $1, $25
; SHRINK-WRAP-64-PIC-NEXT: addiu $1, $zero, 4
; SHRINK-WRAP-64-PIC-NEXT: bne $4, $1, .LBB1_3
; SHRINK-WRAP-64-PIC-NEXT: nop
; SHRINK-WRAP-64-PIC-NEXT: # %bb.1:
; SHRINK-WRAP-64-PIC-NEXT: daddiu $sp, $sp, -16
; SHRINK-WRAP-64-PIC-NEXT: sd $ra, 0($sp)
; SHRINK-WRAP-64-PIC-NEXT: daddiu $1, $zero, %hi(.LBB1_4-.LBB1_2)
; SHRINK-WRAP-64-PIC-NEXT: dsll $1, $1, 16
; SHRINK-WRAP-64-PIC-NEXT: bal .LBB1_2
; SHRINK-WRAP-64-PIC-NEXT: daddiu $1, $1, %lo(.LBB1_4-.LBB1_2)
; SHRINK-WRAP-64-PIC-NEXT: .LBB1_2:
; SHRINK-WRAP-64-PIC-NEXT: daddu $1, $ra, $1
; SHRINK-WRAP-64-PIC-NEXT: ld $ra, 0($sp)
; SHRINK-WRAP-64-PIC-NEXT: jr $1
; SHRINK-WRAP-64-PIC-NEXT: daddiu $sp, $sp, 16
; SHRINK-WRAP-64-PIC-NEXT: .LBB1_3: # %if.then
; SHRINK-WRAP-64-PIC-NEXT: daddiu $sp, $sp, -16
; SHRINK-WRAP-64-PIC-NEXT: .cfi_def_cfa_offset 16
; SHRINK-WRAP-64-PIC-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
; SHRINK-WRAP-64-PIC-NEXT: sd $gp, 0($sp) # 8-byte Folded Spill
; SHRINK-WRAP-64-PIC-NEXT: .cfi_offset 31, -8
; SHRINK-WRAP-64-PIC-NEXT: .cfi_offset 28, -16
; SHRINK-WRAP-64-PIC-NEXT: daddiu $gp, $2, %lo(%neg(%gp_rel(foo2)))
; SHRINK-WRAP-64-PIC-NEXT: sll $4, $4, 0
; SHRINK-WRAP-64-PIC-NEXT: #APP
;
; NO-SHRINK-WRAP-64-PIC-LABEL: foo2:
; NO-SHRINK-WRAP-64-PIC: # %bb.0:
; NO-SHRINK-WRAP-64-PIC-NEXT: daddiu $sp, $sp, -16
; NO-SHRINK-WRAP-64-PIC-NEXT: .cfi_def_cfa_offset 16
; NO-SHRINK-WRAP-64-PIC-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill
; NO-SHRINK-WRAP-64-PIC-NEXT: sd $gp, 0($sp) # 8-byte Folded Spill
; NO-SHRINK-WRAP-64-PIC-NEXT: .cfi_offset 31, -8
; NO-SHRINK-WRAP-64-PIC-NEXT: .cfi_offset 28, -16
; NO-SHRINK-WRAP-64-PIC-NEXT: lui $1, %hi(%neg(%gp_rel(foo2)))
; NO-SHRINK-WRAP-64-PIC-NEXT: daddu $2, $1, $25
; NO-SHRINK-WRAP-64-PIC-NEXT: addiu $1, $zero, 4
; NO-SHRINK-WRAP-64-PIC-NEXT: bne $4, $1, .LBB1_3
; NO-SHRINK-WRAP-64-PIC-NEXT: nop
; NO-SHRINK-WRAP-64-PIC-NEXT: # %bb.1:
; NO-SHRINK-WRAP-64-PIC-NEXT: daddiu $sp, $sp, -16
; NO-SHRINK-WRAP-64-PIC-NEXT: sd $ra, 0($sp)
; NO-SHRINK-WRAP-64-PIC-NEXT: daddiu $1, $zero, %hi(.LBB1_4-.LBB1_2)
; NO-SHRINK-WRAP-64-PIC-NEXT: dsll $1, $1, 16
; NO-SHRINK-WRAP-64-PIC-NEXT: bal .LBB1_2
; NO-SHRINK-WRAP-64-PIC-NEXT: daddiu $1, $1, %lo(.LBB1_4-.LBB1_2)
; NO-SHRINK-WRAP-64-PIC-NEXT: .LBB1_2:
; NO-SHRINK-WRAP-64-PIC-NEXT: daddu $1, $ra, $1
; NO-SHRINK-WRAP-64-PIC-NEXT: ld $ra, 0($sp)
; NO-SHRINK-WRAP-64-PIC-NEXT: jr $1
; NO-SHRINK-WRAP-64-PIC-NEXT: daddiu $sp, $sp, 16
; NO-SHRINK-WRAP-64-PIC-NEXT: .LBB1_3: # %if.then
; NO-SHRINK-WRAP-64-PIC-NEXT: daddiu $gp, $2, %lo(%neg(%gp_rel(foo2)))
; NO-SHRINK-WRAP-64-PIC-NEXT: sll $4, $4, 0
; NO-SHRINK-WRAP-64-PIC-NEXT: #APP
%1 = icmp ne i32 %a, 4
br i1 %1, label %if.then, label %if.end
if.then:
call void asm sideeffect ".space 1048576", "~{$1}"()
call void @f(i32 signext %a)
br label %if.end
if.end:
ret i32 0
}
|