block-placement-1.mir
9.97 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
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
# RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple powerpc64le-unknown-linux-gnu \
# RUN: -run-pass=block-placement -o - %s | FileCheck %s
--- |
; ModuleID = 'test.ll'
source_filename = "test.ll"
target datalayout = "e-m:e-i64:64-n32:64"
@_ZTIl = external constant i8*
@_ZTIi = external constant i8*
@_ZTIc = external constant i8*
define dso_local void @_Z6calleev() local_unnamed_addr {
entry:
tail call void @__cxa_rethrow()
unreachable
}
declare void @__cxa_rethrow() local_unnamed_addr
define dso_local void @_Z14TestSinglePredv() local_unnamed_addr personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
entry:
br label %for.body
for.cond.cleanup: ; preds = %for.inc
ret void
for.body: ; preds = %for.inc, %entry
%lsr.iv = phi i32 [ %lsr.iv.next, %for.inc ], [ 10, %entry ]
invoke void @__cxa_rethrow()
to label %.noexc unwind label %lpad
.noexc: ; preds = %for.body
unreachable
lpad: ; preds = %for.body
%0 = landingpad { i8*, i32 }
catch i8* bitcast (i8** @_ZTIl to i8*)
catch i8* bitcast (i8** @_ZTIi to i8*)
catch i8* null
%1 = extractvalue { i8*, i32 } %0, 0
%2 = extractvalue { i8*, i32 } %0, 1
%3 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIl to i8*))
%matches = icmp eq i32 %2, %3
br i1 %matches, label %catch4, label %catch.fallthrough
catch4: ; preds = %lpad
%4 = tail call i8* @__cxa_begin_catch(i8* %1)
invoke void @__cxa_rethrow()
to label %unreachable unwind label %lpad6
catch.fallthrough: ; preds = %lpad
%5 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*))
%matches1 = icmp eq i32 %2, %5
%6 = tail call i8* @__cxa_begin_catch(i8* %1)
br i1 %matches1, label %catch2, label %catch
catch2: ; preds = %catch.fallthrough
tail call void @__cxa_end_catch()
br label %for.inc
catch: ; preds = %catch.fallthrough
tail call void @__cxa_end_catch()
br label %for.inc
lpad6: ; preds = %catch4
%7 = landingpad { i8*, i32 }
cleanup
catch i8* bitcast (i8** @_ZTIc to i8*)
%8 = extractvalue { i8*, i32 } %7, 1
%9 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIc to i8*))
%matches9 = icmp eq i32 %8, %9
br i1 %matches9, label %catch10, label %ehcleanup
catch10: ; preds = %lpad6
%10 = extractvalue { i8*, i32 } %7, 0
%11 = tail call i8* @__cxa_begin_catch(i8* %10)
tail call void @__cxa_end_catch()
tail call void @__cxa_end_catch()
br label %for.inc
for.inc: ; preds = %catch10, %catch, %catch2
%lsr.iv.next = add nsw i32 %lsr.iv, -1
%exitcond = icmp eq i32 %lsr.iv.next, 0
br i1 %exitcond, label %for.cond.cleanup, label %for.body
ehcleanup: ; preds = %lpad6
tail call void @__cxa_end_catch()
%exn.obj = extractvalue { i8*, i32 } %7, 0
call void @_Unwind_Resume(i8* %exn.obj)
unreachable
unreachable: ; preds = %catch4
unreachable
}
declare i32 @__gxx_personality_v0(...)
; Function Attrs: nounwind readnone
declare i32 @llvm.eh.typeid.for(i8*) #0
declare i8* @__cxa_begin_catch(i8*) local_unnamed_addr
declare void @__cxa_end_catch() local_unnamed_addr
; Function Attrs: nounwind
declare void @llvm.stackprotector(i8*, i8**) #1
declare void @_Unwind_Resume(i8*)
attributes #0 = { nounwind readnone }
attributes #1 = { nounwind }
...
---
name: _Z6calleev
alignment: 16
exposesReturnsTwice: false
legalized: false
regBankSelected: false
selected: false
failedISel: false
tracksRegLiveness: true
hasWinCFI: false
registers: []
liveins: []
frameInfo:
isFrameAddressTaken: false
isReturnAddressTaken: false
hasStackMap: false
hasPatchPoint: false
stackSize: 32
offsetAdjustment: 0
maxAlignment: 0
adjustsStack: true
hasCalls: true
stackProtector: ''
maxCallFrameSize: 32
cvBytesOfCalleeSavedRegisters: 0
hasOpaqueSPAdjustment: false
hasVAStart: false
hasMustTailInVarArgFunc: false
localFrameSize: 0
savePoint: ''
restorePoint: ''
fixedStack: []
stack: []
callSites: []
constants: []
machineFunctionInfo: {}
body: |
bb.0.entry:
$x0 = MFLR8 implicit $lr8
STD killed $x0, 16, $x1
$x1 = STDU $x1, -32, $x1
CFI_INSTRUCTION def_cfa_offset 32
CFI_INSTRUCTION offset $lr8, 16
BL8_NOP @__cxa_rethrow, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
...
---
name: _Z14TestSinglePredv
alignment: 16
exposesReturnsTwice: false
legalized: false
regBankSelected: false
selected: false
failedISel: false
tracksRegLiveness: true
hasWinCFI: false
registers: []
liveins: []
frameInfo:
isFrameAddressTaken: false
isReturnAddressTaken: false
hasStackMap: false
hasPatchPoint: false
stackSize: 64
offsetAdjustment: 0
maxAlignment: 0
adjustsStack: true
hasCalls: true
stackProtector: ''
maxCallFrameSize: 32
cvBytesOfCalleeSavedRegisters: 0
hasOpaqueSPAdjustment: false
hasVAStart: false
hasMustTailInVarArgFunc: false
localFrameSize: 0
savePoint: ''
restorePoint: ''
fixedStack:
- { id: 0, type: spill-slot, offset: -80, size: 8, alignment: 16, stack-id: default,
callee-saved-register: '$x30', callee-saved-restored: true, debug-info-variable: '',
debug-info-expression: '', debug-info-location: '' }
- { id: 1, type: spill-slot, offset: -88, size: 8, alignment: 8, stack-id: default,
callee-saved-register: '$x29', callee-saved-restored: true, debug-info-variable: '',
debug-info-expression: '', debug-info-location: '' }
stack: []
callSites: []
constants: []
machineFunctionInfo: {}
body: |
bb.0.entry:
successors: %bb.1(0x80000000)
liveins: $x29, $x30
$x0 = MFLR8 implicit $lr8
CFI_INSTRUCTION def_cfa_offset 64
CFI_INSTRUCTION offset $lr8, 16
CFI_INSTRUCTION offset $x29, -24
CFI_INSTRUCTION offset $x30, -16
STD killed $x29, -24, $x1 :: (store 8 into %fixed-stack.1)
STD killed $x30, -16, $x1 :: (store 8 into %fixed-stack.0, align 16)
STD killed $x0, 16, $x1
$x1 = STDU $x1, -64, $x1
renamable $r29 = LI 10
bb.1.for.body:
successors: %bb.2(0x7ffff800), %bb.3(0x00000800)
liveins: $r29
EH_LABEL <mcsymbol .Ltmp0>
BL8_NOP @__cxa_rethrow, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
EH_LABEL <mcsymbol .Ltmp1>
bb.2..noexc:
successors:
bb.3.lpad (landing-pad):
successors: %bb.4(0x00000001), %bb.5(0x7fffffff)
liveins: $r29, $x3, $x4
EH_LABEL <mcsymbol .Ltmp2>
$x30 = OR8 killed $x4, $x4
renamable $cr0 = CMPLWI renamable $r30, 3
BCC 71, killed renamable $cr0, %bb.5
bb.4.catch4:
successors: %bb.11(0x7ffff800), %bb.6(0x00000800)
liveins: $r29, $x3
BL8_NOP @__cxa_begin_catch, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit $x2, implicit-def $r1, implicit-def dead $x3
EH_LABEL <mcsymbol .Ltmp3>
BL8_NOP @__cxa_rethrow, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
EH_LABEL <mcsymbol .Ltmp4>
B %bb.11
bb.5.catch.fallthrough:
successors: %bb.8(0x80000000)
liveins: $r29, $x3, $x30
BL8_NOP @__cxa_begin_catch, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit $x2, implicit-def $r1, implicit-def dead $x3
renamable $cr0 = CMPLWI killed renamable $r30, 2, implicit $x30
B %bb.8
bb.6.lpad6 (landing-pad):
successors: %bb.7(0x7fffffff), %bb.10(0x00000001)
liveins: $r29, $x3, $x4
EH_LABEL <mcsymbol .Ltmp5>
renamable $cr0 = CMPLWI killed renamable $r4, 4, implicit $x4
$x30 = OR8 killed $x3, $x3
BCC 70, killed renamable $cr0, %bb.10
bb.7.catch10:
successors: %bb.8(0x80000000)
liveins: $r29, $x30
$x3 = OR8 killed $x30, $x30
BL8_NOP @__cxa_begin_catch, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit-def $r1, implicit-def dead $x3
BL8_NOP @__cxa_end_catch, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
bb.8.for.inc:
successors: %bb.9(0x04000000), %bb.1(0x7c000000)
liveins: $r29
BL8_NOP @__cxa_end_catch, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
renamable $r29 = nsw ADDI killed renamable $r29, -1
renamable $cr0 = CMPLWI renamable $r29, 0
BCC 68, killed renamable $cr0, %bb.1
bb.9.for.cond.cleanup:
$x1 = ADDI8 $x1, 64
$x0 = LD 16, $x1
MTLR8 killed $x0, implicit-def $lr8
$x30 = LD -16, $x1 :: (load 8 from %fixed-stack.0, align 16)
$x29 = LD -24, $x1 :: (load 8 from %fixed-stack.1)
BLR8 implicit $lr8, implicit $rm
bb.10.ehcleanup:
successors:
liveins: $x30
BL8_NOP @__cxa_end_catch, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
$x3 = OR8 killed $x30, $x30
BL8_NOP @_Unwind_Resume, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit-def $r1
bb.11.unreachable:
; CHECK: bb.1.for.body:
; CHECK: successors: %bb.2(0x7ffff800), %bb.3(0x00000800)
; CHECK: B %bb.2
; CHECK: bb.4.catch4:
; CHECK: successors: %bb.11(0x7ffff800), %bb.6(0x00000800)
; CHECK: B %bb.11
; CHECK: bb.2..noexc:
; CHECK: bb.11.unreachable:
...