1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -callsite-splitting -simplifycfg < %s | FileCheck %s 3 4define i16 @test1() { 5; CHECK-LABEL: @test1( 6; CHECK-NEXT: entry: 7; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 undef, i16 1, i16 0 8; CHECK-NEXT: call void @callee(i16 0) 9; CHECK-NEXT: br label [[FOR_COND12:%.*]] 10; CHECK: for.cond12: 11; CHECK-NEXT: call void @callee(i16 [[SPEC_SELECT]]) 12; CHECK-NEXT: br label [[FOR_COND12]] 13; 14entry: 15 %spec.select = select i1 undef, i16 1, i16 0 16 %tobool18 = icmp ne i16 %spec.select, 0 17 br i1 %tobool18, label %for.cond12.us, label %for.cond12 18 19for.cond12.us: 20 unreachable 21 22for.cond12: 23 call void @callee(i16 %spec.select) 24 br label %for.cond12 25} 26 27define i16 @test2() { 28; CHECK-LABEL: @test2( 29; CHECK-NEXT: entry: 30; CHECK-NEXT: [[S:%.*]] = select i1 undef, i16 1, i16 0 31; CHECK-NEXT: call void @callee(i16 0) 32; CHECK-NEXT: br label [[FOR_COND12:%.*]] 33; CHECK: for.cond12: 34; CHECK-NEXT: [[ADD:%.*]] = add i16 [[S]], 10 35; CHECK-NEXT: [[ADD2:%.*]] = add i16 [[S]], 10 36; CHECK-NEXT: call void @callee(i16 [[S]]) 37; CHECK-NEXT: br label [[FOR_COND12]] 38; 39entry: 40 %s= select i1 undef, i16 1, i16 0 41 %tobool18 = icmp ne i16 %s, 0 42 br i1 %tobool18, label %for.cond12.us, label %for.cond12 43 44for.cond12.us: 45 unreachable 46 47for.cond12: 48 call void @callee(i16 %s) 49 %add = add i16 %s, 10 50 %add2 = add i16 %s, 10 51 br label %for.cond12 52} 53 54define i16 @test3() { 55; CHECK-LABEL: @test3( 56; CHECK-NEXT: entry: 57; CHECK-NEXT: [[S:%.*]] = select i1 undef, i16 1, i16 0 58; CHECK-NEXT: call void @callee(i16 0) 59; CHECK-NEXT: br label [[FOR_COND12:%.*]] 60; CHECK: for.cond12: 61; CHECK-NEXT: [[ADD:%.*]] = add i16 [[S]], 10 62; CHECK-NEXT: [[ADD2:%.*]] = add i16 [[ADD]], 10 63; CHECK-NEXT: br i1 undef, label [[FOR_COND12_SPLIT:%.*]], label [[EXIT:%.*]] 64; CHECK: for.cond12.split: 65; CHECK-NEXT: call void @callee(i16 [[S]]) 66; CHECK-NEXT: br label [[FOR_COND12]] 67; CHECK: exit: 68; CHECK-NEXT: ret i16 [[ADD2]] 69; 70entry: 71 %s= select i1 undef, i16 1, i16 0 72 %tobool18 = icmp ne i16 %s, 0 73 br i1 %tobool18, label %for.cond12.us, label %for.cond12 74 75for.cond12.us: 76 unreachable 77 78for.cond12: 79 call void @callee(i16 %s) 80 %add = add i16 %s, 10 81 %add2 = add i16 %add, 10 82 br i1 undef, label %for.cond12, label %exit 83 84exit: 85 ret i16 %add2 86} 87 88define internal void @callee(i16 %flag) { 89 ret void 90} 91