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