1 # RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple powerpc64le-unknown-linux-gnu \
2 # RUN: -run-pass=block-placement -o - %s | FileCheck %s
5 source_filename = "test.ll"
6 target datalayout = "e-m:e-i64:64-n32:64"
8 @_ZTIl = external constant ptr
9 @_ZTIi = external constant ptr
10 @_ZTIc = external constant ptr
12 define dso_local void @_Z6calleev() local_unnamed_addr {
14 tail call void @__cxa_rethrow()
18 declare void @__cxa_rethrow() local_unnamed_addr
20 define dso_local void @_Z14TestSinglePredv() local_unnamed_addr personality ptr @__gxx_personality_v0 {
24 for.cond.cleanup: ; preds = %for.inc
27 for.body: ; preds = %for.inc, %entry
28 %lsr.iv = phi i32 [ %lsr.iv.next, %for.inc ], [ 10, %entry ]
29 invoke void @__cxa_rethrow()
30 to label %.noexc unwind label %lpad
32 .noexc: ; preds = %for.body
35 lpad: ; preds = %for.body
36 %0 = landingpad { ptr, i32 }
40 %1 = extractvalue { ptr, i32 } %0, 0
41 %2 = extractvalue { ptr, i32 } %0, 1
42 %3 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIl)
43 %matches = icmp eq i32 %2, %3
44 br i1 %matches, label %catch4, label %catch.fallthrough
46 catch4: ; preds = %lpad
47 %4 = tail call ptr @__cxa_begin_catch(ptr %1)
48 invoke void @__cxa_rethrow()
49 to label %unreachable unwind label %lpad6
51 catch.fallthrough: ; preds = %lpad
52 %5 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi)
53 %matches1 = icmp eq i32 %2, %5
54 %6 = tail call ptr @__cxa_begin_catch(ptr %1)
55 br i1 %matches1, label %catch2, label %catch
57 catch2: ; preds = %catch.fallthrough
58 tail call void @__cxa_end_catch()
61 catch: ; preds = %catch.fallthrough
62 tail call void @__cxa_end_catch()
65 lpad6: ; preds = %catch4
66 %7 = landingpad { ptr, i32 }
69 %8 = extractvalue { ptr, i32 } %7, 1
70 %9 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIc)
71 %matches9 = icmp eq i32 %8, %9
72 br i1 %matches9, label %catch10, label %ehcleanup
74 catch10: ; preds = %lpad6
75 %10 = extractvalue { ptr, i32 } %7, 0
76 %11 = tail call ptr @__cxa_begin_catch(ptr %10)
77 tail call void @__cxa_end_catch()
78 tail call void @__cxa_end_catch()
81 for.inc: ; preds = %catch10, %catch, %catch2
82 %lsr.iv.next = add nsw i32 %lsr.iv, -1
83 %exitcond = icmp eq i32 %lsr.iv.next, 0
84 br i1 %exitcond, label %for.cond.cleanup, label %for.body
86 ehcleanup: ; preds = %lpad6
87 tail call void @__cxa_end_catch()
88 %exn.obj = extractvalue { ptr, i32 } %7, 0
89 call void @_Unwind_Resume(ptr %exn.obj)
92 unreachable: ; preds = %catch4
96 declare i32 @__gxx_personality_v0(...)
98 ; Function Attrs: nounwind readnone
99 declare i32 @llvm.eh.typeid.for(ptr) #0
101 declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr
103 declare void @__cxa_end_catch() local_unnamed_addr
105 ; Function Attrs: nounwind
106 declare void @llvm.stackprotector(ptr, ptr) #1
108 declare void @_Unwind_Resume(ptr)
110 attributes #0 = { nounwind readnone }
111 attributes #1 = { nounwind }
117 exposesReturnsTwice: false
119 regBankSelected: false
122 tracksRegLiveness: true
127 isFrameAddressTaken: false
128 isReturnAddressTaken: false
138 cvBytesOfCalleeSavedRegisters: 0
139 hasOpaqueSPAdjustment: false
141 hasMustTailInVarArgFunc: false
149 machineFunctionInfo: {}
152 $x0 = MFLR8 implicit $lr8
153 STD killed $x0, 16, $x1
154 $x1 = STDU $x1, -32, $x1
155 CFI_INSTRUCTION def_cfa_offset 32
156 CFI_INSTRUCTION offset $lr8, 16
157 BL8_NOP @__cxa_rethrow, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
161 name: _Z14TestSinglePredv
163 exposesReturnsTwice: false
165 regBankSelected: false
168 tracksRegLiveness: true
173 isFrameAddressTaken: false
174 isReturnAddressTaken: false
184 cvBytesOfCalleeSavedRegisters: 0
185 hasOpaqueSPAdjustment: false
187 hasMustTailInVarArgFunc: false
192 - { id: 0, type: spill-slot, offset: -80, size: 8, alignment: 16, stack-id: default,
193 callee-saved-register: '$x30', callee-saved-restored: true, debug-info-variable: '',
194 debug-info-expression: '', debug-info-location: '' }
195 - { id: 1, type: spill-slot, offset: -88, size: 8, alignment: 8, stack-id: default,
196 callee-saved-register: '$x29', callee-saved-restored: true, debug-info-variable: '',
197 debug-info-expression: '', debug-info-location: '' }
201 machineFunctionInfo: {}
204 successors: %bb.1(0x80000000)
207 $x0 = MFLR8 implicit $lr8
208 CFI_INSTRUCTION def_cfa_offset 64
209 CFI_INSTRUCTION offset $lr8, 16
210 CFI_INSTRUCTION offset $x29, -24
211 CFI_INSTRUCTION offset $x30, -16
212 STD killed $x29, -24, $x1 :: (store (s64) into %fixed-stack.1)
213 STD killed $x30, -16, $x1 :: (store (s64) into %fixed-stack.0, align 16)
214 STD killed $x0, 16, $x1
215 $x1 = STDU $x1, -64, $x1
216 renamable $r29 = LI 10
219 successors: %bb.2(0x7ffff800), %bb.3(0x00000800)
222 EH_LABEL <mcsymbol .Ltmp0>
223 BL8_NOP @__cxa_rethrow, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
224 EH_LABEL <mcsymbol .Ltmp1>
230 bb.3.lpad (landing-pad):
231 successors: %bb.4(0x00000001), %bb.5(0x7fffffff)
232 liveins: $r29, $x3, $x4
234 EH_LABEL <mcsymbol .Ltmp2>
235 $x30 = OR8 killed $x4, $x4
236 renamable $cr0 = CMPLWI renamable $r30, 3
237 BCC 71, killed renamable $cr0, %bb.5
240 successors: %bb.11(0x7ffff800), %bb.6(0x00000800)
243 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
244 EH_LABEL <mcsymbol .Ltmp3>
245 BL8_NOP @__cxa_rethrow, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
246 EH_LABEL <mcsymbol .Ltmp4>
249 bb.5.catch.fallthrough:
250 successors: %bb.8(0x80000000)
251 liveins: $r29, $x3, $x30
253 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
254 renamable $cr0 = CMPLWI killed renamable $r30, 2, implicit $x30
257 bb.6.lpad6 (landing-pad):
258 successors: %bb.7(0x7fffffff), %bb.10(0x00000001)
259 liveins: $r29, $x3, $x4
261 EH_LABEL <mcsymbol .Ltmp5>
262 renamable $cr0 = CMPLWI killed renamable $r4, 4, implicit $x4
263 $x30 = OR8 killed $x3, $x3
264 BCC 70, killed renamable $cr0, %bb.10
267 successors: %bb.8(0x80000000)
270 $x3 = OR8 killed $x30, $x30
271 BL8_NOP @__cxa_begin_catch, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit-def $r1, implicit-def dead $x3
272 BL8_NOP @__cxa_end_catch, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
275 successors: %bb.9(0x04000000), %bb.1(0x7c000000)
278 BL8_NOP @__cxa_end_catch, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
279 renamable $r29 = nsw ADDI killed renamable $r29, -1
280 renamable $cr0 = CMPLWI renamable $r29, 0
281 BCC 68, killed renamable $cr0, %bb.1
283 bb.9.for.cond.cleanup:
286 MTLR8 killed $x0, implicit-def $lr8
287 $x30 = LD -16, $x1 :: (load (s64) from %fixed-stack.0, align 16)
288 $x29 = LD -24, $x1 :: (load (s64) from %fixed-stack.1)
289 BLR8 implicit $lr8, implicit $rm
295 BL8_NOP @__cxa_end_catch, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit-def $r1
296 $x3 = OR8 killed $x30, $x30
297 BL8_NOP @_Unwind_Resume, csr_ppc64_altivec, implicit-def dead $lr8, implicit $rm, implicit killed $x3, implicit-def $r1
301 ; CHECK: bb.1.for.body:
302 ; CHECK: successors: %bb.2(0x7ffff800), %bb.3(0x00000800)
305 ; CHECK: bb.4.catch4:
306 ; CHECK: successors: %bb.11(0x7ffff800), %bb.6(0x00000800)
309 ; CHECK: bb.2..noexc:
311 ; CHECK: bb.11.unreachable: