1cee313d2SEric Christopher; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2*2d07414eSRoman Lebedev; RUN: opt -S -callsite-splitting -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s 3cee313d2SEric Christopher 4cee313d2SEric Christopherdefine i16 @test1() { 5cee313d2SEric Christopher; CHECK-LABEL: @test1( 6cee313d2SEric Christopher; CHECK-NEXT: entry: 7cee313d2SEric Christopher; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 undef, i16 1, i16 0 80290a77aSDavid Bolvansky; CHECK-NEXT: [[TOBOOL18:%.*]] = icmp ne i16 [[SPEC_SELECT]], 0 90290a77aSDavid Bolvansky; CHECK-NEXT: [[TMP0:%.*]] = xor i1 [[TOBOOL18]], true 100290a77aSDavid Bolvansky; CHECK-NEXT: call void @llvm.assume(i1 [[TMP0]]) 11cee313d2SEric Christopher; CHECK-NEXT: br label [[FOR_COND12:%.*]] 12cee313d2SEric Christopher; CHECK: for.cond12: 13cee313d2SEric Christopher; CHECK-NEXT: call void @callee(i16 [[SPEC_SELECT]]) 14cee313d2SEric Christopher; CHECK-NEXT: br label [[FOR_COND12]] 15cee313d2SEric Christopher; 16cee313d2SEric Christopherentry: 17cee313d2SEric Christopher %spec.select = select i1 undef, i16 1, i16 0 18cee313d2SEric Christopher %tobool18 = icmp ne i16 %spec.select, 0 19cee313d2SEric Christopher br i1 %tobool18, label %for.cond12.us, label %for.cond12 20cee313d2SEric Christopher 21cee313d2SEric Christopherfor.cond12.us: 22cee313d2SEric Christopher unreachable 23cee313d2SEric Christopher 24cee313d2SEric Christopherfor.cond12: 25cee313d2SEric Christopher call void @callee(i16 %spec.select) 26cee313d2SEric Christopher br label %for.cond12 27cee313d2SEric Christopher} 28cee313d2SEric Christopher 29cee313d2SEric Christopherdefine i16 @test2() { 30cee313d2SEric Christopher; CHECK-LABEL: @test2( 31cee313d2SEric Christopher; CHECK-NEXT: entry: 32cee313d2SEric Christopher; CHECK-NEXT: [[S:%.*]] = select i1 undef, i16 1, i16 0 330290a77aSDavid Bolvansky; CHECK-NEXT: [[TOBOOL18:%.*]] = icmp ne i16 [[S]], 0 340290a77aSDavid Bolvansky; CHECK-NEXT: [[TMP0:%.*]] = xor i1 [[TOBOOL18]], true 350290a77aSDavid Bolvansky; CHECK-NEXT: call void @llvm.assume(i1 [[TMP0]]) 36cee313d2SEric Christopher; CHECK-NEXT: br label [[FOR_COND12:%.*]] 37cee313d2SEric Christopher; CHECK: for.cond12: 38bb76cf0fSDavid Bolvansky; CHECK-NEXT: call void @callee(i16 [[S]]) 39cee313d2SEric Christopher; CHECK-NEXT: [[ADD:%.*]] = add i16 [[S]], 10 40cee313d2SEric Christopher; CHECK-NEXT: [[ADD2:%.*]] = add i16 [[S]], 10 41cee313d2SEric Christopher; CHECK-NEXT: br label [[FOR_COND12]] 42cee313d2SEric Christopher; 43cee313d2SEric Christopherentry: 44cee313d2SEric Christopher %s= select i1 undef, i16 1, i16 0 45cee313d2SEric Christopher %tobool18 = icmp ne i16 %s, 0 46cee313d2SEric Christopher br i1 %tobool18, label %for.cond12.us, label %for.cond12 47cee313d2SEric Christopher 48cee313d2SEric Christopherfor.cond12.us: 49cee313d2SEric Christopher unreachable 50cee313d2SEric Christopher 51cee313d2SEric Christopherfor.cond12: 52cee313d2SEric Christopher call void @callee(i16 %s) 53cee313d2SEric Christopher %add = add i16 %s, 10 54cee313d2SEric Christopher %add2 = add i16 %s, 10 55cee313d2SEric Christopher br label %for.cond12 56cee313d2SEric Christopher} 57cee313d2SEric Christopher 58cee313d2SEric Christopherdefine i16 @test3() { 59cee313d2SEric Christopher; CHECK-LABEL: @test3( 60cee313d2SEric Christopher; CHECK-NEXT: entry: 61cee313d2SEric Christopher; CHECK-NEXT: [[S:%.*]] = select i1 undef, i16 1, i16 0 620290a77aSDavid Bolvansky; CHECK-NEXT: [[TOBOOL18:%.*]] = icmp ne i16 [[S]], 0 630290a77aSDavid Bolvansky; CHECK-NEXT: [[TMP0:%.*]] = xor i1 [[TOBOOL18]], true 640290a77aSDavid Bolvansky; CHECK-NEXT: call void @llvm.assume(i1 [[TMP0]]) 65cee313d2SEric Christopher; CHECK-NEXT: br label [[FOR_COND12:%.*]] 66cee313d2SEric Christopher; CHECK: for.cond12: 67bb76cf0fSDavid Bolvansky; CHECK-NEXT: call void @callee(i16 [[S]]) 68cee313d2SEric Christopher; CHECK-NEXT: [[ADD:%.*]] = add i16 [[S]], 10 69cee313d2SEric Christopher; CHECK-NEXT: [[ADD2:%.*]] = add i16 [[ADD]], 10 70bb76cf0fSDavid Bolvansky; CHECK-NEXT: br i1 undef, label [[FOR_COND12]], label [[EXIT:%.*]] 71cee313d2SEric Christopher; CHECK: exit: 72cee313d2SEric Christopher; CHECK-NEXT: ret i16 [[ADD2]] 73cee313d2SEric Christopher; 74cee313d2SEric Christopherentry: 75cee313d2SEric Christopher %s= select i1 undef, i16 1, i16 0 76cee313d2SEric Christopher %tobool18 = icmp ne i16 %s, 0 77cee313d2SEric Christopher br i1 %tobool18, label %for.cond12.us, label %for.cond12 78cee313d2SEric Christopher 79cee313d2SEric Christopherfor.cond12.us: 80cee313d2SEric Christopher unreachable 81cee313d2SEric Christopher 82cee313d2SEric Christopherfor.cond12: 83cee313d2SEric Christopher call void @callee(i16 %s) 84cee313d2SEric Christopher %add = add i16 %s, 10 85cee313d2SEric Christopher %add2 = add i16 %add, 10 86cee313d2SEric Christopher br i1 undef, label %for.cond12, label %exit 87cee313d2SEric Christopher 88cee313d2SEric Christopherexit: 89cee313d2SEric Christopher ret i16 %add2 90cee313d2SEric Christopher} 91cee313d2SEric Christopher 92bb76cf0fSDavid Bolvanskydeclare void @callee(i16 %flag) 93