xref: /llvm-project/llvm/test/MachineVerifier/test_g_brjt_is_indirect_branch.mir (revision cc9ba5600e540fd4e059d20591917962a6df043d)
1# RUN: llc -mtriple=riscv32 -o - -run-pass=none -verify-machineinstrs %s | FileCheck %s
2# REQUIRES: riscv-registered-target
3
4# This test checks that the G_BRJT is an indirect branch by leveraging RISCV's
5# version of analyzeBranch. If G_BRJT would not be an indirect branch, this
6# test would crash.
7
8---
9name:            test_jump_table
10legalized:       true
11tracksRegLiveness: true
12jumpTable:
13  kind:            block-address
14  entries:
15    - id:              0
16      blocks:          [ '%bb.0' ]
17body:             |
18  bb.0:
19    liveins: $x0
20    %0:_(s32) = COPY $x0
21    %1:_(p0) = COPY $x0
22
23    ; CHECK-NOT: Branch instruction is missing a basic block operand or isIndirectBranch property
24    G_BRJT %1, %jump-table.0, %0
25
26...
27