1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -callsite-splitting -simplifycfg < %s | FileCheck %s
7 ; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 undef, i16 1, i16 0
8 ; CHECK-NEXT: [[TOBOOL18:%.*]] = icmp ne i16 [[SPEC_SELECT]], 0
9 ; CHECK-NEXT: [[TMP0:%.*]] = xor i1 [[TOBOOL18]], true
10 ; CHECK-NEXT: call void @llvm.assume(i1 [[TMP0]])
11 ; CHECK-NEXT: br label [[FOR_COND12:%.*]]
13 ; CHECK-NEXT: call void @callee(i16 [[SPEC_SELECT]])
14 ; CHECK-NEXT: br label [[FOR_COND12]]
17 %spec.select = select i1 undef, i16 1, i16 0
18 %tobool18 = icmp ne i16 %spec.select, 0
19 br i1 %tobool18, label %for.cond12.us, label %for.cond12
25 call void @callee(i16 %spec.select)
30 ; CHECK-LABEL: @test2(
32 ; CHECK-NEXT: [[S:%.*]] = select i1 undef, i16 1, i16 0
33 ; CHECK-NEXT: [[TOBOOL18:%.*]] = icmp ne i16 [[S]], 0
34 ; CHECK-NEXT: [[TMP0:%.*]] = xor i1 [[TOBOOL18]], true
35 ; CHECK-NEXT: call void @llvm.assume(i1 [[TMP0]])
36 ; CHECK-NEXT: br label [[FOR_COND12:%.*]]
38 ; CHECK-NEXT: call void @callee(i16 [[S]])
39 ; CHECK-NEXT: [[ADD:%.*]] = add i16 [[S]], 10
40 ; CHECK-NEXT: [[ADD2:%.*]] = add i16 [[S]], 10
41 ; CHECK-NEXT: br label [[FOR_COND12]]
44 %s= select i1 undef, i16 1, i16 0
45 %tobool18 = icmp ne i16 %s, 0
46 br i1 %tobool18, label %for.cond12.us, label %for.cond12
52 call void @callee(i16 %s)
54 %add2 = add i16 %s, 10
59 ; CHECK-LABEL: @test3(
61 ; CHECK-NEXT: [[S:%.*]] = select i1 undef, i16 1, i16 0
62 ; CHECK-NEXT: [[TOBOOL18:%.*]] = icmp ne i16 [[S]], 0
63 ; CHECK-NEXT: [[TMP0:%.*]] = xor i1 [[TOBOOL18]], true
64 ; CHECK-NEXT: call void @llvm.assume(i1 [[TMP0]])
65 ; CHECK-NEXT: br label [[FOR_COND12:%.*]]
67 ; CHECK-NEXT: call void @callee(i16 [[S]])
68 ; CHECK-NEXT: [[ADD:%.*]] = add i16 [[S]], 10
69 ; CHECK-NEXT: [[ADD2:%.*]] = add i16 [[ADD]], 10
70 ; CHECK-NEXT: br i1 undef, label [[FOR_COND12]], label [[EXIT:%.*]]
72 ; CHECK-NEXT: ret i16 [[ADD2]]
75 %s= select i1 undef, i16 1, i16 0
76 %tobool18 = icmp ne i16 %s, 0
77 br i1 %tobool18, label %for.cond12.us, label %for.cond12
83 call void @callee(i16 %s)
85 %add2 = add i16 %add, 10
86 br i1 undef, label %for.cond12, label %exit
92 declare void @callee(i16 %flag)