1 ; NOTE: Assertions have been autogenerated by update_test_checks.py
2 ; RUN: opt < %s -simplifycfg -S | FileCheck %s
8 ; CHECK-NEXT: ret i32 1234
10 switch i32 5, label %Default [
28 ; Test folding to default dest
30 ; CHECK-LABEL: @test2(
31 ; CHECK-NEXT: Default:
32 ; CHECK-NEXT: ret i32 1234
34 switch i32 3, label %Default [
52 ; Test folding all to same dest
53 define i32 @test3(i1 %C) {
54 ; CHECK-LABEL: @test3(
55 ; CHECK-NEXT: TheDest:
56 ; CHECK-NEXT: ret i32 1234
58 br i1 %C, label %Start, label %TheDest
60 switch i32 3, label %TheDest [
70 ; Test folding switch -> branch
71 define i32 @test4(i32 %C) {
72 ; CHECK-LABEL: @test4(
74 ; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 %C, 0
75 ; CHECK-NEXT: [[DOT:%.*]] = select i1 [[COND]], i32 1, i32 0
76 ; CHECK-NEXT: ret i32 [[DOT]]
78 switch i32 %C, label %L1 [
87 ; Can fold into a cond branch!
88 define i32 @test5(i32 %C) {
89 ; CHECK-LABEL: @test5(
91 ; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 %C, 0
92 ; CHECK-NEXT: [[DOT:%.*]] = select i1 [[COND]], i32 1, i32 0
93 ; CHECK-NEXT: ret i32 [[DOT]]
95 switch i32 %C, label %L1 [