1 ; RUN: opt < %s -simplifycfg -S | FileCheck %s 2 3 ; int foo1_with_default(int a) { 4 ; switch(a) { 5 ; case 10: 6 ; return 10; 7 ; case 20: 8 ; return 2; 9 ; } 10 ; return 4; 11 ; } 12 13 define i32 @foo1_with_default(i32 %a) { 14 ; CHECK-LABEL: @foo1_with_default 15 ; CHECK: %switch.selectcmp = icmp eq i32 %a, 20 16 ; CHECK-NEXT: %switch.select = select i1 %switch.selectcmp, i32 2, i32 4 17 ; CHECK-NEXT: %switch.selectcmp1 = icmp eq i32 %a, 10 18 ; CHECK-NEXT: %switch.select2 = select i1 %switch.selectcmp1, i32 10, i32 %switch.select 19 entry: 20 switch i32 %a, label %sw.epilog [ 21 i32 10, label %sw.bb 22 i32 20, label %sw.bb1 23 ] 24 25 sw.bb: 26 br label %return 27 28 sw.bb1: 29 br label %return 30 31 sw.epilog: 32 br label %return 33 34 return: 35 %retval.0 = phi i32 [ 4, %sw.epilog ], [ 2, %sw.bb1 ], [ 10, %sw.bb ] 36 ret i32 %retval.0 37 } 38