1# RUN: not --crash llc -march=amdgcn -run-pass=legalizer -o /dev/null %s 2>&1 | FileCheck %s 2 3# CHECK: LLVM ERROR: unable to legalize instruction: %3:_(p0) = G_JUMP_TABLE %jump-table.0 (in function: jt_test) 4 5# FIXME: This could probably be smaller, but the jump table MIR parsing is very crashy. 6 7--- | 8 define i32 @jt_test(i32 %x) { 9 entry: 10 switch i32 %x, label %return [ 11 i32 75, label %sw.bb 12 i32 34, label %sw.bb 13 i32 56, label %sw.bb 14 i32 35, label %sw.bb 15 i32 40, label %sw.bb 16 i32 4, label %sw.bb1 17 i32 5, label %sw.bb1 18 i32 6, label %sw.bb1 19 ] 20 21 sw.bb: ; preds = %entry, %entry, %entry, %entry, %entry 22 %add = add nsw i32 %x, 42 23 br label %return 24 25 sw.bb1: ; preds = %entry, %entry, %entry 26 %mul = mul nsw i32 %x, 3 27 br label %return 28 29 return: ; preds = %sw.bb1, %sw.bb, %entry 30 %retval.0 = phi i32 [ %mul, %sw.bb1 ], [ %add, %sw.bb ], [ 0, %entry ] 31 ret i32 %retval.0 32 } 33 34... 35--- 36name: jt_test 37tracksRegLiveness: true 38jumpTable: 39 kind: block-address 40 entries: 41 - id: 0 42 blocks: [ '%bb.3', '%bb.3', '%bb.3', '%bb.4', '%bb.4', '%bb.4', 43 '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', 44 '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', 45 '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', 46 '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', 47 '%bb.2', '%bb.2', '%bb.4', '%bb.4', '%bb.4', '%bb.4', 48 '%bb.2', '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', 49 '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', 50 '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.2', '%bb.4', 51 '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', 52 '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', 53 '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.4', '%bb.2' ] 54body: | 55 bb.0.entry: 56 liveins: $sgpr0 57 58 %0:_(s32) = COPY $sgpr0 59 %1:_(s32) = G_CONSTANT i32 0 60 %2:_(s1) = G_ICMP intpred(ugt), %0, %1 61 %3:_(p0) = G_JUMP_TABLE %jump-table.0 62 S_NOP 0, implicit %3 63 G_BRCOND %2, %bb.4 64 65 bb.1.entry: 66 successors: %bb.3(0x2aaaaaab), %bb.4(0x2aaaaaab), %bb.2(0x2aaaaaab) 67 68 G_BR %bb.4 69 70 bb.2.sw.bb: 71 G_BR %bb.4 72 73 bb.3.sw.bb1: 74 75 bb.4.return: 76 S_ENDPGM 0 77 78... 79