179 lines · plain
1# RUN: not --crash llc -run-pass=none -verify-machineinstrs %s -o /dev/null 2>&1 \2# RUN: | FileCheck %s3# REQUIRES: powerpc-registered-target4 5# Test for a case we observed after the initial implementation of D1299976# landed, in which case we observed a crash while building the ppc64le Linux7# kernel. In that case, we had one block with two exits, both to the same8# successor. Removing one of the exits corrupted the successor/predecessor9# lists.10 11# CHECK: *** Bad machine code: INLINEASM_BR indirect target missing from successor list ***12# CHECK-NEXT: - function: ceph_con_v2_try_read13# CHECK-NEXT: - basic block: %bb.3 if.else.i.i14# CHECK-NEXT: - instruction: INLINEASM_BR &"" [sideeffect] [attdialect], $0:[imm], %bb.515# CHECK-NEXT: - operand 3: %bb.516 17# CHECK: *** Bad machine code: INLINEASM_BR indirect target predecessor list missing parent ***18# CHECK-NEXT: - function: ceph_con_v2_try_read19# CHECK-NEXT: - basic block: %bb.3 if.else.i.i20# CHECK-NEXT: - instruction: INLINEASM_BR &"" [sideeffect] [attdialect], $0:[imm], %bb.521# CHECK-NEXT: - operand 3: %bb.522 23--- |24 target datalayout = "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512"25 target triple = "powerpc64le-unknown-linux-gnu"26 27 ; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn28 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #029 30 define void @ceph_con_v2_try_read(i32 %__trans_tmp_3.sroa.0.0.copyload, i1 %tobool.not.i.i) {31 entry:32 %skip.i.i = alloca i32, i32 0, align 433 %cond = icmp eq i32 %__trans_tmp_3.sroa.0.0.copyload, 034 br label %for.cond35 36 for.cond: ; preds = %for.cond, %process_message_header.exit.i, %if.end.i, %entry37 br i1 %cond, label %sw.bb, label %for.cond38 39 sw.bb: ; preds = %for.cond40 %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.i42 43 if.else.i.i: ; preds = %sw.bb44 callbr void asm sideeffect "", "!i"()45 to label %if.end.i [label %if.end.i]46 47 process_message_header.exit.i: ; preds = %sw.bb48 call void @llvm.lifetime.end.p0(i64 0, ptr %skip.i.i)49 br label %for.cond50 51 if.end.i: ; preds = %if.else.i.i, %if.else.i.i52 call void @llvm.lifetime.end.p0(i64 0, ptr %skip.i.i)53 br label %for.cond54 }55 56 attributes #0 = { argmemonly nocallback nofree nosync nounwind willreturn }57 58...59---60name: ceph_con_v2_try_read61alignment: 1662exposesReturnsTwice: false63legalized: false64regBankSelected: false65selected: false66failedISel: false67tracksRegLiveness: true68hasWinCFI: false69callsEHReturn: false70callsUnwindInit: false71hasEHContTarget: false72hasEHScopes: false73hasEHFunclets: false74failsVerification: false75tracksDebugUserValues: false76registers: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: '' }88liveins:89 - { reg: '$x3', virtual-reg: '%1' }90 - { reg: '$x4', virtual-reg: '%2' }91frameInfo:92 isFrameAddressTaken: false93 isReturnAddressTaken: false94 hasStackMap: false95 hasPatchPoint: false96 stackSize: 097 offsetAdjustment: 098 maxAlignment: 499 adjustsStack: false100 hasCalls: true101 stackProtector: ''102 functionContext: ''103 maxCallFrameSize: 4294967295104 cvBytesOfCalleeSavedRegisters: 0105 hasOpaqueSPAdjustment: false106 hasVAStart: false107 hasMustTailInVarArgFunc: false108 hasTailCall: false109 localFrameSize: 0110 savePoint: []111 restorePoint: []112fixedStack: []113stack: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: '' }117callSites: []118debugValueSubstitutions: []119constants: []120machineFunctionInfo: {}121body: |122 bb.0.entry:123 successors: %bb.1(0x80000000)124 liveins: $x3, $x4125 126 %2:g8rc = COPY $x4127 %1:g8rc = COPY $x3128 %10:g8rc = ANDI8_rec %2, 1, implicit-def $cr0129 %3:crbitrc = COPY $cr0gt130 %4:gprc = COPY %1.sub_32131 %5:crrc = CMPWI killed %4, 0132 %0:crbitrc = COPY %5.sub_eq133 134 bb.1.for.cond:135 successors: %bb.2(0x30000000), %bb.1(0x50000000)136 137 BCn %0, %bb.1138 B %bb.2139 140 bb.2.sw.bb:141 successors: %bb.3(0x40000000), %bb.4(0x40000000)142 143 ADJCALLSTACKDOWN 32, 0, implicit-def dead $r1, implicit $r1144 %6:g8rc = COPY $x2145 STD %6, 24, $x1 :: (store (s64) into stack + 24)146 %7:g8rc = ADDI8 %stack.0.skip.i.i, 0147 %8:g8rc = LI8 0148 $x3 = COPY %7149 $x12 = COPY %8150 MTCTR8 %8, implicit-def $ctr8151 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 $x3152 ADJCALLSTACKUP 32, 0, implicit-def dead $r1, implicit $r1153 %9:g8rc = COPY $x3154 BCn %3, %bb.4155 B %bb.3156 157 ; Oops, should have %bb.5 in the successor list!158 bb.3.if.else.i.i:159 successors: %bb.1(0x80000000)160 161 INLINEASM_BR &"", 1 /* sideeffect attdialect */, 13 /* imm */, %bb.5162 LIFETIME_END %stack.0.skip.i.i163 B %bb.1164 165 bb.4.process_message_header.exit.i:166 successors: %bb.1(0x80000000)167 168 LIFETIME_END %stack.0.skip.i.i169 B %bb.1170 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)174 175 LIFETIME_END %stack.0.skip.i.i176 B %bb.1177 178...179