1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -simplifycfg -S | FileCheck %s
4 ; Test that a switch going to a switch on the same value can be merged.
5 ; All three switches in this example can be merged into one big one.
15 define void @test1(i32 %V) {
16 ; CHECK-LABEL: @test1(
17 ; CHECK-NEXT: switch i32 [[V:%.*]], label [[INFLOOP:%.*]] [
18 ; CHECK-NEXT: i32 4, label [[A:%.*]]
19 ; CHECK-NEXT: i32 17, label [[B:%.*]]
20 ; CHECK-NEXT: i32 18, label [[B]]
21 ; CHECK-NEXT: i32 42, label [[D:%.*]]
24 ; CHECK-NEXT: call void @foo1()
25 ; CHECK-NEXT: ret void
27 ; CHECK-NEXT: call void @foo2()
28 ; CHECK-NEXT: ret void
30 ; CHECK-NEXT: call void @foo4()
31 ; CHECK-NEXT: ret void
33 ; CHECK-NEXT: br label [[INFLOOP]]
35 switch i32 %V, label %F [
41 T: ; preds = %0, %0, %0
42 switch i32 %V, label %F [
50 B: ; preds = %F, %F, %T
56 F: ; preds = %F, %T, %0, %0
57 switch i32 %V, label %F [