1 ; RUN: llc -mtriple=x86_64-linux-gnu %s -o - -jump-table-density=25 | FileCheck %s --check-prefix=DENSE --check-prefix=CHECK
2 ; RUN: llc -mtriple=x86_64-linux-gnu %s -o - -jump-table-density=10 | FileCheck %s --check-prefix=SPARSE --check-prefix=CHECK
6 define void @sparse(i32 %x) {
8 switch i32 %x, label %return [
14 bb0: tail call void @g(i32 0) br label %return
15 bb1: tail call void @g(i32 1) br label %return
16 bb2: tail call void @g(i32 1) br label %return
19 ; Should pivot around 400 for two subtrees with two jump tables each.
29 define void @med(i32 %x) {
31 switch i32 %x, label %return [
38 bb0: tail call void @g(i32 0) br label %return
39 bb1: tail call void @g(i32 1) br label %return
40 bb2: tail call void @g(i32 1) br label %return
41 bb3: tail call void @g(i32 2) br label %return
44 ; Lowered as a jump table when sparse, and branches when dense.
60 define void @dense(i32 %x) {
62 switch i32 %x, label %return [
69 bb0: tail call void @g(i32 0) br label %return
70 bb1: tail call void @g(i32 1) br label %return
71 bb2: tail call void @g(i32 1) br label %return
72 bb3: tail call void @g(i32 2) br label %return
75 ; Lowered as a jump table when sparse, and branches when dense.