xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/switch-default-only.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -fast-isel=false -march=x86 < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; No need for branching when the default and only destination follows
4*9880d681SAndroid Build Coastguard Worker; immediately after the switch.
5*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: no_branch:
6*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: jmp
7*9880d681SAndroid Build Coastguard Worker; CHECK: ret
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdefine void @no_branch(i32 %x) {
10*9880d681SAndroid Build Coastguard Workerentry:
11*9880d681SAndroid Build Coastguard Worker  switch i32 %x, label %exit [ ]
12*9880d681SAndroid Build Coastguard Workerexit:
13*9880d681SAndroid Build Coastguard Worker  ret void
14*9880d681SAndroid Build Coastguard Worker}
15