1 # RUN: not --crash llc -run-pass=none -verify-machineinstrs %s 2>&1 \
3 # REQUIRES: powerpc-registered-target
5 # Test for a case we observed after the initial implementation of D129997
6 # landed, in which case we observed a crash while building the ppc64le Linux
7 # kernel. In that case, we had one block with two exits, both to the same
8 # successor. Removing one of the exits corrupted the successor/predecessor
11 # CHECK: *** Bad machine code: INLINEASM_BR indirect target missing from successor list ***
12 # CHECK-NEXT: - function: ceph_con_v2_try_read
13 # CHECK-NEXT: - basic block: %bb.3 if.else.i.i
14 # CHECK-NEXT: - instruction: INLINEASM_BR &"" [sideeffect] [attdialect], $0:[imm], %bb.5
15 # CHECK-NEXT: - operand 3: %bb.5
17 # CHECK: *** Bad machine code: INLINEASM_BR indirect target predecessor list missing parent ***
18 # CHECK-NEXT: - function: ceph_con_v2_try_read
19 # CHECK-NEXT: - basic block: %bb.3 if.else.i.i
20 # CHECK-NEXT: - instruction: INLINEASM_BR &"" [sideeffect] [attdialect], $0:[imm], %bb.5
21 # CHECK-NEXT: - operand 3: %bb.5
24 target datalayout = "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512"
25 target triple = "powerpc64le-unknown-linux-gnu"
27 ; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn
28 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0
30 define void @ceph_con_v2_try_read(i32 %__trans_tmp_3.sroa.0.0.copyload, i1 %tobool.not.i.i) {
32 %skip.i.i = alloca i32, i32 0, align 4
33 %cond = icmp eq i32 %__trans_tmp_3.sroa.0.0.copyload, 0
36 for.cond: ; preds = %for.cond, %process_message_header.exit.i, %if.end.i, %entry
37 br i1 %cond, label %sw.bb, label %for.cond
39 sw.bb: ; preds = %for.cond
40 %call.i.i2 = call i32 null(ptr %skip.i.i)
41 br i1 %tobool.not.i.i, label %if.else.i.i, label %process_message_header.exit.i
43 if.else.i.i: ; preds = %sw.bb
44 callbr void asm sideeffect "", "!i"()
45 to label %if.end.i [label %if.end.i]
47 process_message_header.exit.i: ; preds = %sw.bb
48 call void @llvm.lifetime.end.p0(i64 0, ptr %skip.i.i)
51 if.end.i: ; preds = %if.else.i.i, %if.else.i.i
52 call void @llvm.lifetime.end.p0(i64 0, ptr %skip.i.i)
56 attributes #0 = { argmemonly nocallback nofree nosync nounwind willreturn }
60 name: ceph_con_v2_try_read
62 exposesReturnsTwice: false
64 regBankSelected: false
67 tracksRegLiveness: true
70 callsUnwindInit: false
74 failsVerification: false
75 tracksDebugUserValues: false
77 - { id: 0, class: crbitrc, preferred-register: '' }
78 - { id: 1, class: g8rc, preferred-register: '' }
79 - { id: 2, class: g8rc, preferred-register: '' }
80 - { id: 3, class: crbitrc, preferred-register: '' }
81 - { id: 4, class: gprc, preferred-register: '' }
82 - { id: 5, class: crrc, preferred-register: '' }
83 - { id: 6, class: g8rc, preferred-register: '' }
84 - { id: 7, class: g8rc, preferred-register: '' }
85 - { id: 8, class: g8rc, preferred-register: '' }
86 - { id: 9, class: g8rc, preferred-register: '' }
87 - { id: 10, class: g8rc, preferred-register: '' }
89 - { reg: '$x3', virtual-reg: '%1' }
90 - { reg: '$x4', virtual-reg: '%2' }
92 isFrameAddressTaken: false
93 isReturnAddressTaken: false
103 maxCallFrameSize: 4294967295
104 cvBytesOfCalleeSavedRegisters: 0
105 hasOpaqueSPAdjustment: false
107 hasMustTailInVarArgFunc: false
114 - { id: 0, name: skip.i.i, type: default, offset: 0, size: 1, alignment: 4,
115 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
116 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
118 debugValueSubstitutions: []
120 machineFunctionInfo: {}
123 successors: %bb.1(0x80000000)
128 %10:g8rc = ANDI8_rec %2, 1, implicit-def $cr0
129 %3:crbitrc = COPY $cr0gt
130 %4:gprc = COPY %1.sub_32
131 %5:crrc = CMPWI killed %4, 0
132 %0:crbitrc = COPY %5.sub_eq
135 successors: %bb.2(0x30000000), %bb.1(0x50000000)
141 successors: %bb.3(0x40000000), %bb.4(0x40000000)
143 ADJCALLSTACKDOWN 32, 0, implicit-def dead $r1, implicit $r1
145 STD %6, 24, $x1 :: (store (s64) into stack + 24)
146 %7:g8rc = ADDI8 %stack.0.skip.i.i, 0
150 MTCTR8 %8, implicit-def $ctr8
151 BCTRL8_LDinto_toc 24, $x1, csr_ppc64_altivec, implicit-def dead $lr8, implicit-def dead $x2, implicit $ctr8, implicit $rm, implicit $x3, implicit $x12, implicit $x2, implicit-def $r1, implicit-def $x3
152 ADJCALLSTACKUP 32, 0, implicit-def dead $r1, implicit $r1
157 ; Oops, should have %bb.5 in the successor list!
159 successors: %bb.1(0x80000000)
161 INLINEASM_BR &"", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.5
162 LIFETIME_END %stack.0.skip.i.i
165 bb.4.process_message_header.exit.i:
166 successors: %bb.1(0x80000000)
168 LIFETIME_END %stack.0.skip.i.i
171 ; Oops, should have %bb.3 in the predecessor list!
172 bb.5.if.end.i (machine-block-address-taken, inlineasm-br-indirect-target):
173 successors: %bb.1(0x80000000)
175 LIFETIME_END %stack.0.skip.i.i