1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=23 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=27 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
6
7; FIXME: CGSCC is not looking at callees and calleers even though it could be allowed.
8
9define i32 @test0(i32* %p) {
10; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn
11; IS__TUNIT____-LABEL: define {{[^@]+}}@test0
12; IS__TUNIT____-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0:[0-9]+]] {
13; IS__TUNIT____-NEXT:    [[A:%.*]] = load i32, i32* [[P]], align 4, !range [[RNG0:![0-9]+]]
14; IS__TUNIT____-NEXT:    ret i32 [[A]]
15;
16; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn
17; IS__CGSCC____-LABEL: define {{[^@]+}}@test0
18; IS__CGSCC____-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0:[0-9]+]] {
19; IS__CGSCC____-NEXT:    [[A:%.*]] = load i32, i32* [[P]], align 4, !range [[RNG0:![0-9]+]]
20; IS__CGSCC____-NEXT:    ret i32 [[A]]
21;
22  %a = load i32, i32* %p, !range !0
23  ret i32 %a
24}
25
26define i32 @test0-range-check(i32* %p) {
27; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn
28; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test0-range-check
29; IS__TUNIT_OPM-SAME: (i32* nocapture nofree readonly align 4 [[P:%.*]]) #[[ATTR0]] {
30; IS__TUNIT_OPM-NEXT:    [[A:%.*]] = tail call i32 @test0(i32* nocapture nofree readonly align 4 [[P]]) #[[ATTR3:[0-9]+]], !range [[RNG0]]
31; IS__TUNIT_OPM-NEXT:    ret i32 [[A]]
32;
33; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn
34; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test0-range-check
35; IS__TUNIT_NPM-SAME: (i32* nocapture nofree readonly align 4 [[P:%.*]]) #[[ATTR0]] {
36; IS__TUNIT_NPM-NEXT:    [[A:%.*]] = tail call i32 @test0(i32* nocapture nofree readonly align 4 [[P]]) #[[ATTR2:[0-9]+]], !range [[RNG0]]
37; IS__TUNIT_NPM-NEXT:    ret i32 [[A]]
38;
39; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn
40; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test0-range-check
41; IS__CGSCC_OPM-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
42; IS__CGSCC_OPM-NEXT:    [[A:%.*]] = tail call i32 @test0(i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P]]) #[[ATTR3:[0-9]+]], !range [[RNG0]]
43; IS__CGSCC_OPM-NEXT:    ret i32 [[A]]
44;
45; IS__CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn
46; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test0-range-check
47; IS__CGSCC_NPM-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
48; IS__CGSCC_NPM-NEXT:    [[A:%.*]] = tail call i32 @test0(i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P]]) #[[ATTR2:[0-9]+]], !range [[RNG0]]
49; IS__CGSCC_NPM-NEXT:    ret i32 [[A]]
50;
51  %a = tail call i32 @test0(i32* %p)
52  ret i32 %a
53}
54
55declare void @use3-dummy(i1, i1, i1)
56define void @use3(i1, i1, i1) {
57; CHECK-LABEL: define {{[^@]+}}@use3
58; CHECK-SAME: (i1 [[TMP0:%.*]], i1 [[TMP1:%.*]], i1 [[TMP2:%.*]]) {
59; CHECK-NEXT:    tail call void @use3-dummy(i1 [[TMP0]], i1 [[TMP1]], i1 [[TMP2]])
60; CHECK-NEXT:    ret void
61;
62  tail call void @use3-dummy(i1 %0, i1 %1, i1 %2)
63  ret void
64}
65
66; TEST0 icmp test
67define void @test0-icmp-check(i32* %p){
68  ; ret = [0, 10)
69; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test0-icmp-check
70; IS__TUNIT_OPM-SAME: (i32* nocapture nofree readonly align 4 [[P:%.*]]) {
71; IS__TUNIT_OPM-NEXT:    [[RET:%.*]] = tail call i32 @test0(i32* nocapture nofree readonly align 4 [[P]]) #[[ATTR3]], !range [[RNG0]]
72; IS__TUNIT_OPM-NEXT:    [[CMP_EQ_2:%.*]] = icmp eq i32 [[RET]], 9
73; IS__TUNIT_OPM-NEXT:    [[CMP_EQ_3:%.*]] = icmp eq i32 [[RET]], 8
74; IS__TUNIT_OPM-NEXT:    [[CMP_EQ_4:%.*]] = icmp eq i32 [[RET]], 1
75; IS__TUNIT_OPM-NEXT:    [[CMP_EQ_5:%.*]] = icmp eq i32 [[RET]], 0
76; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_EQ_2]], i1 [[CMP_EQ_3]])
77; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 [[CMP_EQ_4]], i1 [[CMP_EQ_5]], i1 noundef false)
78; IS__TUNIT_OPM-NEXT:    [[CMP_NE_2:%.*]] = icmp ne i32 [[RET]], 9
79; IS__TUNIT_OPM-NEXT:    [[CMP_NE_3:%.*]] = icmp ne i32 [[RET]], 8
80; IS__TUNIT_OPM-NEXT:    [[CMP_NE_4:%.*]] = icmp ne i32 [[RET]], 1
81; IS__TUNIT_OPM-NEXT:    [[CMP_NE_5:%.*]] = icmp ne i32 [[RET]], 0
82; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 noundef true, i1 [[CMP_NE_2]], i1 [[CMP_NE_3]])
83; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 [[CMP_NE_4]], i1 [[CMP_NE_5]], i1 noundef true)
84; IS__TUNIT_OPM-NEXT:    [[CMP_UGT_3:%.*]] = icmp ugt i32 [[RET]], 8
85; IS__TUNIT_OPM-NEXT:    [[CMP_UGT_4:%.*]] = icmp ugt i32 [[RET]], 1
86; IS__TUNIT_OPM-NEXT:    [[CMP_UGT_5:%.*]] = icmp ugt i32 [[RET]], 0
87; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 noundef false, i1 noundef false, i1 [[CMP_UGT_3]])
88; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 [[CMP_UGT_4]], i1 [[CMP_UGT_5]], i1 noundef false)
89; IS__TUNIT_OPM-NEXT:    [[CMP_UGE_2:%.*]] = icmp uge i32 [[RET]], 9
90; IS__TUNIT_OPM-NEXT:    [[CMP_UGE_3:%.*]] = icmp uge i32 [[RET]], 8
91; IS__TUNIT_OPM-NEXT:    [[CMP_UGE_4:%.*]] = icmp uge i32 [[RET]], 1
92; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_UGE_2]], i1 [[CMP_UGE_3]])
93; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 [[CMP_UGE_4]], i1 noundef true, i1 noundef false)
94; IS__TUNIT_OPM-NEXT:    [[CMP_SGT_3:%.*]] = icmp sgt i32 [[RET]], 8
95; IS__TUNIT_OPM-NEXT:    [[CMP_SGT_4:%.*]] = icmp sgt i32 [[RET]], 1
96; IS__TUNIT_OPM-NEXT:    [[CMP_SGT_5:%.*]] = icmp sgt i32 [[RET]], 0
97; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 noundef false, i1 noundef false, i1 [[CMP_SGT_3]])
98; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 [[CMP_SGT_4]], i1 [[CMP_SGT_5]], i1 noundef true)
99; IS__TUNIT_OPM-NEXT:    [[CMP_GTE_2:%.*]] = icmp sge i32 [[RET]], 9
100; IS__TUNIT_OPM-NEXT:    [[CMP_GTE_3:%.*]] = icmp sge i32 [[RET]], 8
101; IS__TUNIT_OPM-NEXT:    [[CMP_GTE_4:%.*]] = icmp sge i32 [[RET]], 1
102; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_GTE_2]], i1 [[CMP_GTE_3]])
103; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 [[CMP_GTE_4]], i1 noundef true, i1 noundef true)
104; IS__TUNIT_OPM-NEXT:    [[CMP_SLT_2:%.*]] = icmp slt i32 [[RET]], 9
105; IS__TUNIT_OPM-NEXT:    [[CMP_SLT_3:%.*]] = icmp slt i32 [[RET]], 8
106; IS__TUNIT_OPM-NEXT:    [[CMP_SLT_4:%.*]] = icmp slt i32 [[RET]], 1
107; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 noundef true, i1 [[CMP_SLT_2]], i1 [[CMP_SLT_3]])
108; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 [[CMP_SLT_4]], i1 noundef false, i1 noundef false)
109; IS__TUNIT_OPM-NEXT:    [[CMP_LTE_3:%.*]] = icmp sle i32 [[RET]], 8
110; IS__TUNIT_OPM-NEXT:    [[CMP_LTE_4:%.*]] = icmp sle i32 [[RET]], 1
111; IS__TUNIT_OPM-NEXT:    [[CMP_LTE_5:%.*]] = icmp sle i32 [[RET]], 0
112; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 noundef true, i1 noundef true, i1 [[CMP_LTE_3]])
113; IS__TUNIT_OPM-NEXT:    tail call void @use3(i1 [[CMP_LTE_4]], i1 [[CMP_LTE_5]], i1 noundef false)
114; IS__TUNIT_OPM-NEXT:    ret void
115;
116; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test0-icmp-check
117; IS__TUNIT_NPM-SAME: (i32* nocapture nofree readonly align 4 [[P:%.*]]) {
118; IS__TUNIT_NPM-NEXT:    [[RET:%.*]] = tail call i32 @test0(i32* nocapture nofree readonly align 4 [[P]]) #[[ATTR2]], !range [[RNG0]]
119; IS__TUNIT_NPM-NEXT:    [[CMP_EQ_2:%.*]] = icmp eq i32 [[RET]], 9
120; IS__TUNIT_NPM-NEXT:    [[CMP_EQ_3:%.*]] = icmp eq i32 [[RET]], 8
121; IS__TUNIT_NPM-NEXT:    [[CMP_EQ_4:%.*]] = icmp eq i32 [[RET]], 1
122; IS__TUNIT_NPM-NEXT:    [[CMP_EQ_5:%.*]] = icmp eq i32 [[RET]], 0
123; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_EQ_2]], i1 [[CMP_EQ_3]])
124; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 [[CMP_EQ_4]], i1 [[CMP_EQ_5]], i1 noundef false)
125; IS__TUNIT_NPM-NEXT:    [[CMP_NE_2:%.*]] = icmp ne i32 [[RET]], 9
126; IS__TUNIT_NPM-NEXT:    [[CMP_NE_3:%.*]] = icmp ne i32 [[RET]], 8
127; IS__TUNIT_NPM-NEXT:    [[CMP_NE_4:%.*]] = icmp ne i32 [[RET]], 1
128; IS__TUNIT_NPM-NEXT:    [[CMP_NE_5:%.*]] = icmp ne i32 [[RET]], 0
129; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 noundef true, i1 [[CMP_NE_2]], i1 [[CMP_NE_3]])
130; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 [[CMP_NE_4]], i1 [[CMP_NE_5]], i1 noundef true)
131; IS__TUNIT_NPM-NEXT:    [[CMP_UGT_3:%.*]] = icmp ugt i32 [[RET]], 8
132; IS__TUNIT_NPM-NEXT:    [[CMP_UGT_4:%.*]] = icmp ugt i32 [[RET]], 1
133; IS__TUNIT_NPM-NEXT:    [[CMP_UGT_5:%.*]] = icmp ugt i32 [[RET]], 0
134; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 noundef false, i1 noundef false, i1 [[CMP_UGT_3]])
135; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 [[CMP_UGT_4]], i1 [[CMP_UGT_5]], i1 noundef false)
136; IS__TUNIT_NPM-NEXT:    [[CMP_UGE_2:%.*]] = icmp uge i32 [[RET]], 9
137; IS__TUNIT_NPM-NEXT:    [[CMP_UGE_3:%.*]] = icmp uge i32 [[RET]], 8
138; IS__TUNIT_NPM-NEXT:    [[CMP_UGE_4:%.*]] = icmp uge i32 [[RET]], 1
139; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_UGE_2]], i1 [[CMP_UGE_3]])
140; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 [[CMP_UGE_4]], i1 noundef true, i1 noundef false)
141; IS__TUNIT_NPM-NEXT:    [[CMP_SGT_3:%.*]] = icmp sgt i32 [[RET]], 8
142; IS__TUNIT_NPM-NEXT:    [[CMP_SGT_4:%.*]] = icmp sgt i32 [[RET]], 1
143; IS__TUNIT_NPM-NEXT:    [[CMP_SGT_5:%.*]] = icmp sgt i32 [[RET]], 0
144; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 noundef false, i1 noundef false, i1 [[CMP_SGT_3]])
145; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 [[CMP_SGT_4]], i1 [[CMP_SGT_5]], i1 noundef true)
146; IS__TUNIT_NPM-NEXT:    [[CMP_GTE_2:%.*]] = icmp sge i32 [[RET]], 9
147; IS__TUNIT_NPM-NEXT:    [[CMP_GTE_3:%.*]] = icmp sge i32 [[RET]], 8
148; IS__TUNIT_NPM-NEXT:    [[CMP_GTE_4:%.*]] = icmp sge i32 [[RET]], 1
149; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_GTE_2]], i1 [[CMP_GTE_3]])
150; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 [[CMP_GTE_4]], i1 noundef true, i1 noundef true)
151; IS__TUNIT_NPM-NEXT:    [[CMP_SLT_2:%.*]] = icmp slt i32 [[RET]], 9
152; IS__TUNIT_NPM-NEXT:    [[CMP_SLT_3:%.*]] = icmp slt i32 [[RET]], 8
153; IS__TUNIT_NPM-NEXT:    [[CMP_SLT_4:%.*]] = icmp slt i32 [[RET]], 1
154; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 noundef true, i1 [[CMP_SLT_2]], i1 [[CMP_SLT_3]])
155; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 [[CMP_SLT_4]], i1 noundef false, i1 noundef false)
156; IS__TUNIT_NPM-NEXT:    [[CMP_LTE_3:%.*]] = icmp sle i32 [[RET]], 8
157; IS__TUNIT_NPM-NEXT:    [[CMP_LTE_4:%.*]] = icmp sle i32 [[RET]], 1
158; IS__TUNIT_NPM-NEXT:    [[CMP_LTE_5:%.*]] = icmp sle i32 [[RET]], 0
159; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 noundef true, i1 noundef true, i1 [[CMP_LTE_3]])
160; IS__TUNIT_NPM-NEXT:    tail call void @use3(i1 [[CMP_LTE_4]], i1 [[CMP_LTE_5]], i1 noundef false)
161; IS__TUNIT_NPM-NEXT:    ret void
162;
163; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test0-icmp-check
164; IS__CGSCC_OPM-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) {
165; IS__CGSCC_OPM-NEXT:    [[RET:%.*]] = tail call i32 @test0(i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P]]) #[[ATTR3]], !range [[RNG0]]
166; IS__CGSCC_OPM-NEXT:    [[CMP_EQ_2:%.*]] = icmp eq i32 [[RET]], 9
167; IS__CGSCC_OPM-NEXT:    [[CMP_EQ_3:%.*]] = icmp eq i32 [[RET]], 8
168; IS__CGSCC_OPM-NEXT:    [[CMP_EQ_4:%.*]] = icmp eq i32 [[RET]], 1
169; IS__CGSCC_OPM-NEXT:    [[CMP_EQ_5:%.*]] = icmp eq i32 [[RET]], 0
170; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_EQ_2]], i1 [[CMP_EQ_3]])
171; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 [[CMP_EQ_4]], i1 [[CMP_EQ_5]], i1 noundef false)
172; IS__CGSCC_OPM-NEXT:    [[CMP_NE_2:%.*]] = icmp ne i32 [[RET]], 9
173; IS__CGSCC_OPM-NEXT:    [[CMP_NE_3:%.*]] = icmp ne i32 [[RET]], 8
174; IS__CGSCC_OPM-NEXT:    [[CMP_NE_4:%.*]] = icmp ne i32 [[RET]], 1
175; IS__CGSCC_OPM-NEXT:    [[CMP_NE_5:%.*]] = icmp ne i32 [[RET]], 0
176; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 noundef true, i1 [[CMP_NE_2]], i1 [[CMP_NE_3]])
177; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 [[CMP_NE_4]], i1 [[CMP_NE_5]], i1 noundef true)
178; IS__CGSCC_OPM-NEXT:    [[CMP_UGT_3:%.*]] = icmp ugt i32 [[RET]], 8
179; IS__CGSCC_OPM-NEXT:    [[CMP_UGT_4:%.*]] = icmp ugt i32 [[RET]], 1
180; IS__CGSCC_OPM-NEXT:    [[CMP_UGT_5:%.*]] = icmp ugt i32 [[RET]], 0
181; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 noundef false, i1 noundef false, i1 [[CMP_UGT_3]])
182; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 [[CMP_UGT_4]], i1 [[CMP_UGT_5]], i1 noundef false)
183; IS__CGSCC_OPM-NEXT:    [[CMP_UGE_2:%.*]] = icmp uge i32 [[RET]], 9
184; IS__CGSCC_OPM-NEXT:    [[CMP_UGE_3:%.*]] = icmp uge i32 [[RET]], 8
185; IS__CGSCC_OPM-NEXT:    [[CMP_UGE_4:%.*]] = icmp uge i32 [[RET]], 1
186; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_UGE_2]], i1 [[CMP_UGE_3]])
187; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 [[CMP_UGE_4]], i1 noundef true, i1 noundef false)
188; IS__CGSCC_OPM-NEXT:    [[CMP_SGT_3:%.*]] = icmp sgt i32 [[RET]], 8
189; IS__CGSCC_OPM-NEXT:    [[CMP_SGT_4:%.*]] = icmp sgt i32 [[RET]], 1
190; IS__CGSCC_OPM-NEXT:    [[CMP_SGT_5:%.*]] = icmp sgt i32 [[RET]], 0
191; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 noundef false, i1 noundef false, i1 [[CMP_SGT_3]])
192; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 [[CMP_SGT_4]], i1 [[CMP_SGT_5]], i1 noundef true)
193; IS__CGSCC_OPM-NEXT:    [[CMP_GTE_2:%.*]] = icmp sge i32 [[RET]], 9
194; IS__CGSCC_OPM-NEXT:    [[CMP_GTE_3:%.*]] = icmp sge i32 [[RET]], 8
195; IS__CGSCC_OPM-NEXT:    [[CMP_GTE_4:%.*]] = icmp sge i32 [[RET]], 1
196; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_GTE_2]], i1 [[CMP_GTE_3]])
197; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 [[CMP_GTE_4]], i1 noundef true, i1 noundef true)
198; IS__CGSCC_OPM-NEXT:    [[CMP_SLT_2:%.*]] = icmp slt i32 [[RET]], 9
199; IS__CGSCC_OPM-NEXT:    [[CMP_SLT_3:%.*]] = icmp slt i32 [[RET]], 8
200; IS__CGSCC_OPM-NEXT:    [[CMP_SLT_4:%.*]] = icmp slt i32 [[RET]], 1
201; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 noundef true, i1 [[CMP_SLT_2]], i1 [[CMP_SLT_3]])
202; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 [[CMP_SLT_4]], i1 noundef false, i1 noundef false)
203; IS__CGSCC_OPM-NEXT:    [[CMP_LTE_3:%.*]] = icmp sle i32 [[RET]], 8
204; IS__CGSCC_OPM-NEXT:    [[CMP_LTE_4:%.*]] = icmp sle i32 [[RET]], 1
205; IS__CGSCC_OPM-NEXT:    [[CMP_LTE_5:%.*]] = icmp sle i32 [[RET]], 0
206; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 noundef true, i1 noundef true, i1 [[CMP_LTE_3]])
207; IS__CGSCC_OPM-NEXT:    tail call void @use3(i1 [[CMP_LTE_4]], i1 [[CMP_LTE_5]], i1 noundef false)
208; IS__CGSCC_OPM-NEXT:    ret void
209;
210; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test0-icmp-check
211; IS__CGSCC_NPM-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) {
212; IS__CGSCC_NPM-NEXT:    [[RET:%.*]] = tail call i32 @test0(i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P]]) #[[ATTR2]], !range [[RNG0]]
213; IS__CGSCC_NPM-NEXT:    [[CMP_EQ_2:%.*]] = icmp eq i32 [[RET]], 9
214; IS__CGSCC_NPM-NEXT:    [[CMP_EQ_3:%.*]] = icmp eq i32 [[RET]], 8
215; IS__CGSCC_NPM-NEXT:    [[CMP_EQ_4:%.*]] = icmp eq i32 [[RET]], 1
216; IS__CGSCC_NPM-NEXT:    [[CMP_EQ_5:%.*]] = icmp eq i32 [[RET]], 0
217; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_EQ_2]], i1 [[CMP_EQ_3]])
218; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 [[CMP_EQ_4]], i1 [[CMP_EQ_5]], i1 noundef false)
219; IS__CGSCC_NPM-NEXT:    [[CMP_NE_2:%.*]] = icmp ne i32 [[RET]], 9
220; IS__CGSCC_NPM-NEXT:    [[CMP_NE_3:%.*]] = icmp ne i32 [[RET]], 8
221; IS__CGSCC_NPM-NEXT:    [[CMP_NE_4:%.*]] = icmp ne i32 [[RET]], 1
222; IS__CGSCC_NPM-NEXT:    [[CMP_NE_5:%.*]] = icmp ne i32 [[RET]], 0
223; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 noundef true, i1 [[CMP_NE_2]], i1 [[CMP_NE_3]])
224; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 [[CMP_NE_4]], i1 [[CMP_NE_5]], i1 noundef true)
225; IS__CGSCC_NPM-NEXT:    [[CMP_UGT_3:%.*]] = icmp ugt i32 [[RET]], 8
226; IS__CGSCC_NPM-NEXT:    [[CMP_UGT_4:%.*]] = icmp ugt i32 [[RET]], 1
227; IS__CGSCC_NPM-NEXT:    [[CMP_UGT_5:%.*]] = icmp ugt i32 [[RET]], 0
228; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 noundef false, i1 noundef false, i1 [[CMP_UGT_3]])
229; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 [[CMP_UGT_4]], i1 [[CMP_UGT_5]], i1 noundef false)
230; IS__CGSCC_NPM-NEXT:    [[CMP_UGE_2:%.*]] = icmp uge i32 [[RET]], 9
231; IS__CGSCC_NPM-NEXT:    [[CMP_UGE_3:%.*]] = icmp uge i32 [[RET]], 8
232; IS__CGSCC_NPM-NEXT:    [[CMP_UGE_4:%.*]] = icmp uge i32 [[RET]], 1
233; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_UGE_2]], i1 [[CMP_UGE_3]])
234; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 [[CMP_UGE_4]], i1 noundef true, i1 noundef false)
235; IS__CGSCC_NPM-NEXT:    [[CMP_SGT_3:%.*]] = icmp sgt i32 [[RET]], 8
236; IS__CGSCC_NPM-NEXT:    [[CMP_SGT_4:%.*]] = icmp sgt i32 [[RET]], 1
237; IS__CGSCC_NPM-NEXT:    [[CMP_SGT_5:%.*]] = icmp sgt i32 [[RET]], 0
238; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 noundef false, i1 noundef false, i1 [[CMP_SGT_3]])
239; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 [[CMP_SGT_4]], i1 [[CMP_SGT_5]], i1 noundef true)
240; IS__CGSCC_NPM-NEXT:    [[CMP_GTE_2:%.*]] = icmp sge i32 [[RET]], 9
241; IS__CGSCC_NPM-NEXT:    [[CMP_GTE_3:%.*]] = icmp sge i32 [[RET]], 8
242; IS__CGSCC_NPM-NEXT:    [[CMP_GTE_4:%.*]] = icmp sge i32 [[RET]], 1
243; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 noundef false, i1 [[CMP_GTE_2]], i1 [[CMP_GTE_3]])
244; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 [[CMP_GTE_4]], i1 noundef true, i1 noundef true)
245; IS__CGSCC_NPM-NEXT:    [[CMP_SLT_2:%.*]] = icmp slt i32 [[RET]], 9
246; IS__CGSCC_NPM-NEXT:    [[CMP_SLT_3:%.*]] = icmp slt i32 [[RET]], 8
247; IS__CGSCC_NPM-NEXT:    [[CMP_SLT_4:%.*]] = icmp slt i32 [[RET]], 1
248; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 noundef true, i1 [[CMP_SLT_2]], i1 [[CMP_SLT_3]])
249; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 [[CMP_SLT_4]], i1 noundef false, i1 noundef false)
250; IS__CGSCC_NPM-NEXT:    [[CMP_LTE_3:%.*]] = icmp sle i32 [[RET]], 8
251; IS__CGSCC_NPM-NEXT:    [[CMP_LTE_4:%.*]] = icmp sle i32 [[RET]], 1
252; IS__CGSCC_NPM-NEXT:    [[CMP_LTE_5:%.*]] = icmp sle i32 [[RET]], 0
253; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 noundef true, i1 noundef true, i1 [[CMP_LTE_3]])
254; IS__CGSCC_NPM-NEXT:    tail call void @use3(i1 [[CMP_LTE_4]], i1 [[CMP_LTE_5]], i1 noundef false)
255; IS__CGSCC_NPM-NEXT:    ret void
256;
257  %ret = tail call i32 @test0(i32 *%p)
258
259  ; ret = [0, 10), eq
260  %cmp-eq-1 = icmp eq i32 %ret, 10
261  %cmp-eq-2 = icmp eq i32 %ret, 9
262  %cmp-eq-3 = icmp eq i32 %ret, 8
263  %cmp-eq-4 = icmp eq i32 %ret, 1
264  %cmp-eq-5 = icmp eq i32 %ret, 0
265  %cmp-eq-6 = icmp eq i32 %ret, -1
266  tail call void @use3(i1 %cmp-eq-1, i1 %cmp-eq-2, i1 %cmp-eq-3)
267  tail call void @use3(i1 %cmp-eq-4, i1 %cmp-eq-5, i1 %cmp-eq-6)
268
269  ; ret = [0, 10), ne
270  %cmp-ne-1 = icmp ne i32 %ret, 10
271  %cmp-ne-2 = icmp ne i32 %ret, 9
272  %cmp-ne-3 = icmp ne i32 %ret, 8
273  %cmp-ne-4 = icmp ne i32 %ret, 1
274  %cmp-ne-5 = icmp ne i32 %ret, 0
275  %cmp-ne-6 = icmp ne i32 %ret, -1
276  tail call void @use3(i1 %cmp-ne-1, i1 %cmp-ne-2, i1 %cmp-ne-3)
277  tail call void @use3(i1 %cmp-ne-4, i1 %cmp-ne-5, i1 %cmp-ne-6)
278
279  ; ret = [0, 10), ugt
280  %cmp-ugt-1 = icmp ugt i32 %ret, 10
281  %cmp-ugt-2 = icmp ugt i32 %ret, 9
282  %cmp-ugt-3 = icmp ugt i32 %ret, 8
283  %cmp-ugt-4 = icmp ugt i32 %ret, 1
284  %cmp-ugt-5 = icmp ugt i32 %ret, 0
285  %cmp-ugt-6 = icmp ugt i32 %ret, -1
286  tail call void @use3(i1 %cmp-ugt-1, i1 %cmp-ugt-2, i1 %cmp-ugt-3)
287  tail call void @use3(i1 %cmp-ugt-4, i1 %cmp-ugt-5, i1 %cmp-ugt-6)
288
289  ; ret = [0, 10), uge
290  %cmp-uge-1 = icmp uge i32 %ret, 10
291  %cmp-uge-2 = icmp uge i32 %ret, 9
292  %cmp-uge-3 = icmp uge i32 %ret, 8
293  %cmp-uge-4 = icmp uge i32 %ret, 1
294  %cmp-uge-5 = icmp uge i32 %ret, 0
295  %cmp-uge-6 = icmp uge i32 %ret, -1
296  tail call void @use3(i1 %cmp-uge-1, i1 %cmp-uge-2, i1 %cmp-uge-3)
297  tail call void @use3(i1 %cmp-uge-4, i1 %cmp-uge-5, i1 %cmp-uge-6)
298
299  ; ret = [0, 10), sgt
300  %cmp-sgt-1 = icmp sgt i32 %ret, 10
301  %cmp-sgt-2 = icmp sgt i32 %ret, 9
302  %cmp-sgt-3 = icmp sgt i32 %ret, 8
303  %cmp-sgt-4 = icmp sgt i32 %ret, 1
304  %cmp-sgt-5 = icmp sgt i32 %ret, 0
305  %cmp-sgt-6 = icmp sgt i32 %ret, -1
306  tail call void @use3(i1 %cmp-sgt-1, i1 %cmp-sgt-2, i1 %cmp-sgt-3)
307  tail call void @use3(i1 %cmp-sgt-4, i1 %cmp-sgt-5, i1 %cmp-sgt-6)
308
309  ; ret = [0, 10), sge
310  %cmp-gte-1 = icmp sge i32 %ret, 10
311  %cmp-gte-2 = icmp sge i32 %ret, 9
312  %cmp-gte-3 = icmp sge i32 %ret, 8
313  %cmp-gte-4 = icmp sge i32 %ret, 1
314  %cmp-gte-5 = icmp sge i32 %ret, 0
315  %cmp-gte-6 = icmp sge i32 %ret, -1
316  tail call void @use3(i1 %cmp-gte-1, i1 %cmp-gte-2, i1 %cmp-gte-3)
317  tail call void @use3(i1 %cmp-gte-4, i1 %cmp-gte-5, i1 %cmp-gte-6)
318
319  ; ret = [0, 10), slt
320  %cmp-slt-1 = icmp slt i32 %ret, 10
321  %cmp-slt-2 = icmp slt i32 %ret, 9
322  %cmp-slt-3 = icmp slt i32 %ret, 8
323  %cmp-slt-4 = icmp slt i32 %ret, 1
324  %cmp-slt-5 = icmp slt i32 %ret, 0
325  %cmp-slt-6 = icmp slt i32 %ret, -1
326  tail call void @use3(i1 %cmp-slt-1, i1 %cmp-slt-2, i1 %cmp-slt-3)
327  tail call void @use3(i1 %cmp-slt-4, i1 %cmp-slt-5, i1 %cmp-slt-6)
328
329  ; ret = [0, 10), sle
330  %cmp-lte-1 = icmp sle i32 %ret, 10
331  %cmp-lte-2 = icmp sle i32 %ret, 9
332  %cmp-lte-3 = icmp sle i32 %ret, 8
333  %cmp-lte-4 = icmp sle i32 %ret, 1
334  %cmp-lte-5 = icmp sle i32 %ret, 0
335  %cmp-lte-6 = icmp sle i32 %ret, -1
336  tail call void @use3(i1 %cmp-lte-1, i1 %cmp-lte-2, i1 %cmp-lte-3)
337  tail call void @use3(i1 %cmp-lte-4, i1 %cmp-lte-5, i1 %cmp-lte-6)
338
339  ret void
340}
341define i32 @test1(i32* %p) {
342; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn
343; IS__TUNIT____-LABEL: define {{[^@]+}}@test1
344; IS__TUNIT____-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
345; IS__TUNIT____-NEXT:    [[LOAD_10_100:%.*]] = load i32, i32* [[P]], align 4, !range [[RNG1:![0-9]+]]
346; IS__TUNIT____-NEXT:    [[ADD_10_THEN_20_110:%.*]] = add i32 [[LOAD_10_100]], 10
347; IS__TUNIT____-NEXT:    [[MUL_10_THEN_200_1091:%.*]] = mul i32 [[ADD_10_THEN_20_110]], 10
348; IS__TUNIT____-NEXT:    ret i32 [[MUL_10_THEN_200_1091]]
349;
350; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn
351; IS__CGSCC____-LABEL: define {{[^@]+}}@test1
352; IS__CGSCC____-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
353; IS__CGSCC____-NEXT:    [[LOAD_10_100:%.*]] = load i32, i32* [[P]], align 4, !range [[RNG1:![0-9]+]]
354; IS__CGSCC____-NEXT:    [[ADD_10_THEN_20_110:%.*]] = add i32 [[LOAD_10_100]], 10
355; IS__CGSCC____-NEXT:    [[MUL_10_THEN_200_1091:%.*]] = mul i32 [[ADD_10_THEN_20_110]], 10
356; IS__CGSCC____-NEXT:    ret i32 [[MUL_10_THEN_200_1091]]
357;
358  %load-10-100 = load i32, i32* %p, !range !1
359  %add-10-then-20-110 = add i32 %load-10-100, 10
360  %mul-10-then-200-1091 = mul i32 %add-10-then-20-110, 10
361  ret i32 %mul-10-then-200-1091
362}
363
364define i1 @test1-check(i32* %p) {
365;
366; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn
367; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test1-check
368; IS__TUNIT_OPM-SAME: (i32* nocapture nofree readonly align 4 [[P:%.*]]) #[[ATTR0]] {
369; IS__TUNIT_OPM-NEXT:    [[RES:%.*]] = tail call i32 @test1(i32* nocapture nofree readonly align 4 [[P]]) #[[ATTR3]], !range [[RNG2:![0-9]+]]
370; IS__TUNIT_OPM-NEXT:    [[CMP:%.*]] = icmp eq i32 [[RES]], 500
371; IS__TUNIT_OPM-NEXT:    ret i1 [[CMP]]
372;
373; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn
374; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test1-check
375; IS__TUNIT_NPM-SAME: (i32* nocapture nofree readonly align 4 [[P:%.*]]) #[[ATTR0]] {
376; IS__TUNIT_NPM-NEXT:    [[RES:%.*]] = tail call i32 @test1(i32* nocapture nofree readonly align 4 [[P]]) #[[ATTR2]], !range [[RNG2:![0-9]+]]
377; IS__TUNIT_NPM-NEXT:    [[CMP:%.*]] = icmp eq i32 [[RES]], 500
378; IS__TUNIT_NPM-NEXT:    ret i1 [[CMP]]
379;
380; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn
381; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test1-check
382; IS__CGSCC_OPM-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
383; IS__CGSCC_OPM-NEXT:    [[RES:%.*]] = tail call i32 @test1(i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P]]) #[[ATTR3]], !range [[RNG2:![0-9]+]]
384; IS__CGSCC_OPM-NEXT:    [[CMP:%.*]] = icmp eq i32 [[RES]], 500
385; IS__CGSCC_OPM-NEXT:    ret i1 [[CMP]]
386;
387; IS__CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn
388; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test1-check
389; IS__CGSCC_NPM-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
390; IS__CGSCC_NPM-NEXT:    [[RES:%.*]] = tail call i32 @test1(i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P]]) #[[ATTR2]], !range [[RNG2:![0-9]+]]
391; IS__CGSCC_NPM-NEXT:    [[CMP:%.*]] = icmp eq i32 [[RES]], 500
392; IS__CGSCC_NPM-NEXT:    ret i1 [[CMP]]
393;
394  %res = tail call i32 @test1(i32* %p)
395  %cmp = icmp eq i32 %res, 500
396  ret i1 %cmp
397}
398
399;  TEST2
400;  int test2(int *p) { return *p == 0 ? 4 : 3; }
401;  int test2_check(int *p) {
402;    int call = test2(p);
403;    if (call == 5) {
404;      // dead block
405;      return 2;
406;    } else {
407;      return 3;
408;    }
409;  }
410
411define i32 @test2(i32* %p) {
412; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn
413; IS__TUNIT____-LABEL: define {{[^@]+}}@test2
414; IS__TUNIT____-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
415; IS__TUNIT____-NEXT:  entry:
416; IS__TUNIT____-NEXT:    [[TMP0:%.*]] = load i32, i32* [[P]], align 4
417; IS__TUNIT____-NEXT:    [[TOBOOL:%.*]] = icmp eq i32 [[TMP0]], 0
418; IS__TUNIT____-NEXT:    [[COND:%.*]] = select i1 [[TOBOOL]], i32 4, i32 3
419; IS__TUNIT____-NEXT:    ret i32 [[COND]]
420;
421; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn
422; IS__CGSCC____-LABEL: define {{[^@]+}}@test2
423; IS__CGSCC____-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
424; IS__CGSCC____-NEXT:  entry:
425; IS__CGSCC____-NEXT:    [[TMP0:%.*]] = load i32, i32* [[P]], align 4
426; IS__CGSCC____-NEXT:    [[TOBOOL:%.*]] = icmp eq i32 [[TMP0]], 0
427; IS__CGSCC____-NEXT:    [[COND:%.*]] = select i1 [[TOBOOL]], i32 4, i32 3
428; IS__CGSCC____-NEXT:    ret i32 [[COND]]
429;
430entry:
431  %0 = load i32, i32* %p, align 4
432  %tobool = icmp eq i32 %0, 0
433  %cond = select i1 %tobool, i32 4, i32 3
434  ret i32 %cond
435}
436
437define i32 @test2_check(i32* %p) {
438; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn
439; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_check
440; IS__TUNIT____-SAME: (i32* nocapture nofree readonly align 4 [[P:%.*]]) #[[ATTR0]] {
441; IS__TUNIT____-NEXT:  entry:
442; IS__TUNIT____-NEXT:    br label [[IF_THEN:%.*]]
443; IS__TUNIT____:       if.then:
444; IS__TUNIT____-NEXT:    br label [[RETURN:%.*]]
445; IS__TUNIT____:       if.end:
446; IS__TUNIT____-NEXT:    unreachable
447; IS__TUNIT____:       return:
448; IS__TUNIT____-NEXT:    ret i32 2
449;
450; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn
451; IS__CGSCC____-LABEL: define {{[^@]+}}@test2_check
452; IS__CGSCC____-SAME: (i32* nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
453; IS__CGSCC____-NEXT:  entry:
454; IS__CGSCC____-NEXT:    br label [[IF_THEN:%.*]]
455; IS__CGSCC____:       if.then:
456; IS__CGSCC____-NEXT:    br label [[RETURN:%.*]]
457; IS__CGSCC____:       if.end:
458; IS__CGSCC____-NEXT:    unreachable
459; IS__CGSCC____:       return:
460; IS__CGSCC____-NEXT:    ret i32 2
461;
462entry:
463  %call = tail call i32 @test2(i32* %p)
464  %cmp = icmp slt i32 %call, 5
465  br i1 %cmp, label %if.then, label %if.end
466
467if.then:                                          ; preds = %entry
468  br label %return
469
470if.end:                                           ; preds = %entry
471  br label %return
472
473return:                                           ; preds = %if.end, %if.then
474  %retval.0 = phi i32 [ 2, %if.then ], [ 3, %if.end ]
475  ret i32 %retval.0
476}
477
478; TEST 3 SECV test
479
480; void unkown();
481; int r1(unsigned int u){
482;   int sum = 0;
483;   for(int i = 0; i<100;i++){
484;     sum += i;
485;   }
486;   // sum = 50 * 49 / 2
487;   if(sum > 10000){
488;   // dead block
489;     return 20;
490;   }else {
491;     return 10;
492;   }
493; }
494; void f1(int u){
495;   if(r1(u) > 15){
496;   // deadblock
497;     unkown();
498;   }else {
499;     return;
500;   }
501; }
502
503declare dso_local void @unkown()
504
505define internal i32 @r1(i32) local_unnamed_addr {
506; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone
507; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@r1
508; IS__TUNIT_OPM-SAME: () local_unnamed_addr #[[ATTR1:[0-9]+]] {
509; IS__TUNIT_OPM-NEXT:    br label [[TMP4:%.*]]
510; IS__TUNIT_OPM:       1:
511; IS__TUNIT_OPM-NEXT:    [[TMP2:%.*]] = icmp sgt i32 [[TMP7:%.*]], 10000
512; IS__TUNIT_OPM-NEXT:    br i1 [[TMP2]], label [[TMP3:%.*]], label [[F:%.*]]
513; IS__TUNIT_OPM:       3:
514; IS__TUNIT_OPM-NEXT:    ret i32 20
515; IS__TUNIT_OPM:       f:
516; IS__TUNIT_OPM-NEXT:    ret i32 10
517; IS__TUNIT_OPM:       4:
518; IS__TUNIT_OPM-NEXT:    [[TMP5:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP8:%.*]], [[TMP4]] ]
519; IS__TUNIT_OPM-NEXT:    [[TMP6:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP7]], [[TMP4]] ]
520; IS__TUNIT_OPM-NEXT:    [[TMP7]] = add nuw nsw i32 [[TMP5]], [[TMP6]]
521; IS__TUNIT_OPM-NEXT:    [[TMP8]] = add nuw nsw i32 [[TMP5]], 1
522; IS__TUNIT_OPM-NEXT:    [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 100
523; IS__TUNIT_OPM-NEXT:    br i1 [[TMP9]], label [[TMP1:%.*]], label [[TMP4]]
524;
525; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone
526; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@r1
527; IS__CGSCC_OPM-SAME: () local_unnamed_addr #[[ATTR1:[0-9]+]] {
528; IS__CGSCC_OPM-NEXT:    br label [[TMP4:%.*]]
529; IS__CGSCC_OPM:       1:
530; IS__CGSCC_OPM-NEXT:    [[TMP2:%.*]] = icmp sgt i32 [[TMP7:%.*]], 10000
531; IS__CGSCC_OPM-NEXT:    br i1 [[TMP2]], label [[TMP3:%.*]], label [[F:%.*]]
532; IS__CGSCC_OPM:       3:
533; IS__CGSCC_OPM-NEXT:    ret i32 20
534; IS__CGSCC_OPM:       f:
535; IS__CGSCC_OPM-NEXT:    ret i32 10
536; IS__CGSCC_OPM:       4:
537; IS__CGSCC_OPM-NEXT:    [[TMP5:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP8:%.*]], [[TMP4]] ]
538; IS__CGSCC_OPM-NEXT:    [[TMP6:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP7]], [[TMP4]] ]
539; IS__CGSCC_OPM-NEXT:    [[TMP7]] = add nuw nsw i32 [[TMP5]], [[TMP6]]
540; IS__CGSCC_OPM-NEXT:    [[TMP8]] = add nuw nsw i32 [[TMP5]], 1
541; IS__CGSCC_OPM-NEXT:    [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 100
542; IS__CGSCC_OPM-NEXT:    br i1 [[TMP9]], label [[TMP1:%.*]], label [[TMP4]]
543;
544; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
545; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@r1
546; IS__CGSCC_NPM-SAME: () local_unnamed_addr #[[ATTR1:[0-9]+]] {
547; IS__CGSCC_NPM-NEXT:    br label [[TMP3:%.*]]
548; IS__CGSCC_NPM:       1:
549; IS__CGSCC_NPM-NEXT:    br label [[F:%.*]]
550; IS__CGSCC_NPM:       2:
551; IS__CGSCC_NPM-NEXT:    unreachable
552; IS__CGSCC_NPM:       f:
553; IS__CGSCC_NPM-NEXT:    ret i32 undef
554; IS__CGSCC_NPM:       3:
555; IS__CGSCC_NPM-NEXT:    [[TMP4:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP7:%.*]], [[TMP3]] ]
556; IS__CGSCC_NPM-NEXT:    [[TMP5:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP6:%.*]], [[TMP3]] ]
557; IS__CGSCC_NPM-NEXT:    [[TMP6]] = add nuw nsw i32 [[TMP4]], [[TMP5]]
558; IS__CGSCC_NPM-NEXT:    [[TMP7]] = add nuw nsw i32 [[TMP4]], 1
559; IS__CGSCC_NPM-NEXT:    [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 100
560; IS__CGSCC_NPM-NEXT:    br i1 [[TMP8]], label [[TMP1:%.*]], label [[TMP3]]
561;
562  br label %5
563
5642:                                                ; preds = %5
565  %3 = icmp sgt i32 %8, 10000
566  br i1 %3, label %4, label %f
5674:
568  ret i32 20
569f:
570  ret i32 10
5715:                                                ; preds = %5, %1
572  %6 = phi i32 [ 0, %1 ], [ %9, %5 ]
573  %7 = phi i32 [ 0, %1 ], [ %8, %5 ]
574  %8 = add nuw nsw i32 %6, %7
575  %9 = add nuw nsw i32 %6, 1
576  %10 = icmp eq i32 %9, 100
577  br i1 %10, label %2, label %5
578}
579
580define void @f1(i32){
581; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@f1
582; IS__TUNIT_OPM-SAME: (i32 [[TMP0:%.*]]) {
583; IS__TUNIT_OPM-NEXT:    [[TMP2:%.*]] = tail call i32 @r1() #[[ATTR1]]
584; IS__TUNIT_OPM-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 15
585; IS__TUNIT_OPM-NEXT:    br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP5:%.*]]
586; IS__TUNIT_OPM:       4:
587; IS__TUNIT_OPM-NEXT:    tail call void @unkown()
588; IS__TUNIT_OPM-NEXT:    br label [[TMP5]]
589; IS__TUNIT_OPM:       5:
590; IS__TUNIT_OPM-NEXT:    ret void
591;
592; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
593; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@f1
594; IS__TUNIT_NPM-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1:[0-9]+]] {
595; IS__TUNIT_NPM-NEXT:    br label [[TMP3:%.*]]
596; IS__TUNIT_NPM:       2:
597; IS__TUNIT_NPM-NEXT:    unreachable
598; IS__TUNIT_NPM:       3:
599; IS__TUNIT_NPM-NEXT:    ret void
600;
601; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f1
602; IS__CGSCC_OPM-SAME: (i32 [[TMP0:%.*]]) {
603; IS__CGSCC_OPM-NEXT:    [[TMP2:%.*]] = tail call i32 @r1() #[[ATTR4:[0-9]+]], !range [[RNG3:![0-9]+]]
604; IS__CGSCC_OPM-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 15
605; IS__CGSCC_OPM-NEXT:    br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP5:%.*]]
606; IS__CGSCC_OPM:       4:
607; IS__CGSCC_OPM-NEXT:    tail call void @unkown()
608; IS__CGSCC_OPM-NEXT:    br label [[TMP5]]
609; IS__CGSCC_OPM:       5:
610; IS__CGSCC_OPM-NEXT:    ret void
611;
612; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
613; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f1
614; IS__CGSCC_NPM-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1]] {
615; IS__CGSCC_NPM-NEXT:    br label [[TMP3:%.*]]
616; IS__CGSCC_NPM:       2:
617; IS__CGSCC_NPM-NEXT:    unreachable
618; IS__CGSCC_NPM:       3:
619; IS__CGSCC_NPM-NEXT:    ret void
620;
621  %2 = tail call i32 @r1(i32 %0)
622  %3 = icmp sgt i32 %2, 15
623  br i1 %3, label %4, label %5
624
6254:                                                ; preds = %1
626  tail call void @unkown()
627  br label %5
628
6295:                                                ; preds = %1, %4
630  ret void
631}
632
633; TEST4 LVI test
634
635; f1
636; int test4-f1(int u){
637;   if(u>=0) {
638;     return u;
639;   }else{
640;     return 0;
641;   }
642; }
643define dso_local i32 @test4-f1(i32 %u) {
644; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
645; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test4-f1
646; IS__TUNIT_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2:[0-9]+]] {
647; IS__TUNIT_OPM-NEXT:  entry:
648; IS__TUNIT_OPM-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[U]], -1
649; IS__TUNIT_OPM-NEXT:    br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
650; IS__TUNIT_OPM:       if.then:
651; IS__TUNIT_OPM-NEXT:    br label [[RETURN]]
652; IS__TUNIT_OPM:       return:
653; IS__TUNIT_OPM-NEXT:    [[RETVAL_0:%.*]] = phi i32 [ [[U]], [[IF_THEN]] ], [ 0, [[ENTRY:%.*]] ]
654; IS__TUNIT_OPM-NEXT:    ret i32 [[RETVAL_0]]
655;
656; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
657; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test4-f1
658; IS__TUNIT_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] {
659; IS__TUNIT_NPM-NEXT:  entry:
660; IS__TUNIT_NPM-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[U]], -1
661; IS__TUNIT_NPM-NEXT:    br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
662; IS__TUNIT_NPM:       if.then:
663; IS__TUNIT_NPM-NEXT:    br label [[RETURN]]
664; IS__TUNIT_NPM:       return:
665; IS__TUNIT_NPM-NEXT:    [[RETVAL_0:%.*]] = phi i32 [ [[U]], [[IF_THEN]] ], [ 0, [[ENTRY:%.*]] ]
666; IS__TUNIT_NPM-NEXT:    ret i32 [[RETVAL_0]]
667;
668; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
669; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test4-f1
670; IS__CGSCC_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2:[0-9]+]] {
671; IS__CGSCC_OPM-NEXT:  entry:
672; IS__CGSCC_OPM-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[U]], -1
673; IS__CGSCC_OPM-NEXT:    br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
674; IS__CGSCC_OPM:       if.then:
675; IS__CGSCC_OPM-NEXT:    br label [[RETURN]]
676; IS__CGSCC_OPM:       return:
677; IS__CGSCC_OPM-NEXT:    [[RETVAL_0:%.*]] = phi i32 [ [[U]], [[IF_THEN]] ], [ 0, [[ENTRY:%.*]] ]
678; IS__CGSCC_OPM-NEXT:    ret i32 [[RETVAL_0]]
679;
680; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
681; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test4-f1
682; IS__CGSCC_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] {
683; IS__CGSCC_NPM-NEXT:  entry:
684; IS__CGSCC_NPM-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[U]], -1
685; IS__CGSCC_NPM-NEXT:    br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
686; IS__CGSCC_NPM:       if.then:
687; IS__CGSCC_NPM-NEXT:    br label [[RETURN]]
688; IS__CGSCC_NPM:       return:
689; IS__CGSCC_NPM-NEXT:    [[RETVAL_0:%.*]] = phi i32 [ [[U]], [[IF_THEN]] ], [ 0, [[ENTRY:%.*]] ]
690; IS__CGSCC_NPM-NEXT:    ret i32 [[RETVAL_0]]
691;
692; FIXME: RETVAL_0 >= 0
693entry:
694  %cmp = icmp sgt i32 %u, -1
695  br i1 %cmp, label %if.then, label %return
696
697if.then:                                          ; preds = %entry
698  br label %return
699
700return:                                           ; preds = %entry, %if.then
701  %retval.0 = phi i32 [ %u, %if.then ], [ 0, %entry ]
702  ret i32 %retval.0
703}
704
705
706define dso_local i32 @test4-g1(i32 %u) {
707; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
708; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test4-g1
709; IS__TUNIT_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2]] {
710; IS__TUNIT_OPM-NEXT:  entry:
711; IS__TUNIT_OPM-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f1(i32 [[U]]) #[[ATTR2]]
712; IS__TUNIT_OPM-NEXT:    ret i32 [[CALL]]
713;
714; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
715; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test4-g1
716; IS__TUNIT_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] {
717; IS__TUNIT_NPM-NEXT:  entry:
718; IS__TUNIT_NPM-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f1(i32 [[U]]) #[[ATTR1]]
719; IS__TUNIT_NPM-NEXT:    ret i32 [[CALL]]
720;
721; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
722; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test4-g1
723; IS__CGSCC_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2]] {
724; IS__CGSCC_OPM-NEXT:  entry:
725; IS__CGSCC_OPM-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f1(i32 [[U]]) #[[ATTR5:[0-9]+]]
726; IS__CGSCC_OPM-NEXT:    ret i32 [[CALL]]
727;
728; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
729; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test4-g1
730; IS__CGSCC_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] {
731; IS__CGSCC_NPM-NEXT:  entry:
732; IS__CGSCC_NPM-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f1(i32 [[U]]) #[[ATTR3:[0-9]+]]
733; IS__CGSCC_NPM-NEXT:    ret i32 [[CALL]]
734;
735; FIXME: %call should have range [0, inf]
736
737entry:
738  %call = tail call i32 @test4-f1(i32 %u)
739  ret i32 %call
740}
741
742; f2
743; int test4-f1(int u){
744;   if(u>-1) {
745;     return u+1;
746;   }else{
747;     return 1;
748;   }
749; }
750define dso_local i32 @test4-f2(i32 %u) {
751; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
752; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test4-f2
753; IS__TUNIT_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2]] {
754; IS__TUNIT_OPM-NEXT:  entry:
755; IS__TUNIT_OPM-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[U]], -1
756; IS__TUNIT_OPM-NEXT:    br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
757; IS__TUNIT_OPM:       if.then:
758; IS__TUNIT_OPM-NEXT:    [[ADD:%.*]] = add nuw nsw i32 [[U]], 1
759; IS__TUNIT_OPM-NEXT:    br label [[RETURN:%.*]]
760; IS__TUNIT_OPM:       if.else:
761; IS__TUNIT_OPM-NEXT:    br label [[RETURN]]
762; IS__TUNIT_OPM:       return:
763; IS__TUNIT_OPM-NEXT:    [[RETVAL_0:%.*]] = phi i32 [ [[ADD]], [[IF_THEN]] ], [ 1, [[IF_ELSE]] ]
764; IS__TUNIT_OPM-NEXT:    ret i32 [[RETVAL_0]]
765;
766; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
767; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test4-f2
768; IS__TUNIT_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] {
769; IS__TUNIT_NPM-NEXT:  entry:
770; IS__TUNIT_NPM-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[U]], -1
771; IS__TUNIT_NPM-NEXT:    br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
772; IS__TUNIT_NPM:       if.then:
773; IS__TUNIT_NPM-NEXT:    [[ADD:%.*]] = add nuw nsw i32 [[U]], 1
774; IS__TUNIT_NPM-NEXT:    br label [[RETURN:%.*]]
775; IS__TUNIT_NPM:       if.else:
776; IS__TUNIT_NPM-NEXT:    br label [[RETURN]]
777; IS__TUNIT_NPM:       return:
778; IS__TUNIT_NPM-NEXT:    [[RETVAL_0:%.*]] = phi i32 [ [[ADD]], [[IF_THEN]] ], [ 1, [[IF_ELSE]] ]
779; IS__TUNIT_NPM-NEXT:    ret i32 [[RETVAL_0]]
780;
781; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
782; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test4-f2
783; IS__CGSCC_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2]] {
784; IS__CGSCC_OPM-NEXT:  entry:
785; IS__CGSCC_OPM-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[U]], -1
786; IS__CGSCC_OPM-NEXT:    br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
787; IS__CGSCC_OPM:       if.then:
788; IS__CGSCC_OPM-NEXT:    [[ADD:%.*]] = add nuw nsw i32 [[U]], 1
789; IS__CGSCC_OPM-NEXT:    br label [[RETURN:%.*]]
790; IS__CGSCC_OPM:       if.else:
791; IS__CGSCC_OPM-NEXT:    br label [[RETURN]]
792; IS__CGSCC_OPM:       return:
793; IS__CGSCC_OPM-NEXT:    [[RETVAL_0:%.*]] = phi i32 [ [[ADD]], [[IF_THEN]] ], [ 1, [[IF_ELSE]] ]
794; IS__CGSCC_OPM-NEXT:    ret i32 [[RETVAL_0]]
795;
796; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
797; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test4-f2
798; IS__CGSCC_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] {
799; IS__CGSCC_NPM-NEXT:  entry:
800; IS__CGSCC_NPM-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[U]], -1
801; IS__CGSCC_NPM-NEXT:    br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
802; IS__CGSCC_NPM:       if.then:
803; IS__CGSCC_NPM-NEXT:    [[ADD:%.*]] = add nuw nsw i32 [[U]], 1
804; IS__CGSCC_NPM-NEXT:    br label [[RETURN:%.*]]
805; IS__CGSCC_NPM:       if.else:
806; IS__CGSCC_NPM-NEXT:    br label [[RETURN]]
807; IS__CGSCC_NPM:       return:
808; IS__CGSCC_NPM-NEXT:    [[RETVAL_0:%.*]] = phi i32 [ [[ADD]], [[IF_THEN]] ], [ 1, [[IF_ELSE]] ]
809; IS__CGSCC_NPM-NEXT:    ret i32 [[RETVAL_0]]
810;
811entry:
812  %cmp = icmp sgt i32 %u, -1
813  br i1 %cmp, label %if.then, label %if.else
814
815if.then:                                          ; preds = %entry
816  %add = add nuw nsw i32 %u, 1
817  br label %return
818
819if.else:                                          ; preds = %entry
820  br label %return
821
822return:                                           ; preds = %if.else, %if.then
823  %retval.0 = phi i32 [ %add, %if.then ], [ 1, %if.else ]
824  ret i32 %retval.0
825}
826
827
828define dso_local i32 @test4-g2(i32 %u) {
829; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
830; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test4-g2
831; IS__TUNIT_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2]] {
832; IS__TUNIT_OPM-NEXT:  entry:
833; IS__TUNIT_OPM-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f2(i32 [[U]]) #[[ATTR2]]
834; IS__TUNIT_OPM-NEXT:    ret i32 [[CALL]]
835;
836; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
837; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test4-g2
838; IS__TUNIT_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] {
839; IS__TUNIT_NPM-NEXT:  entry:
840; IS__TUNIT_NPM-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f2(i32 [[U]]) #[[ATTR1]], !range [[RNG3:![0-9]+]]
841; IS__TUNIT_NPM-NEXT:    ret i32 [[CALL]]
842;
843; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
844; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test4-g2
845; IS__CGSCC_OPM-SAME: (i32 [[U:%.*]]) #[[ATTR2]] {
846; IS__CGSCC_OPM-NEXT:  entry:
847; IS__CGSCC_OPM-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f2(i32 [[U]]) #[[ATTR5]]
848; IS__CGSCC_OPM-NEXT:    ret i32 [[CALL]]
849;
850; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
851; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test4-g2
852; IS__CGSCC_NPM-SAME: (i32 [[U:%.*]]) #[[ATTR1]] {
853; IS__CGSCC_NPM-NEXT:  entry:
854; IS__CGSCC_NPM-NEXT:    [[CALL:%.*]] = tail call i32 @test4-f2(i32 [[U]]) #[[ATTR3]], !range [[RNG3:![0-9]+]]
855; IS__CGSCC_NPM-NEXT:    ret i32 [[CALL]]
856;
857entry:
858  %call = tail call i32 @test4-f2(i32 %u)
859  ret i32 %call
860}
861
862define dso_local i32 @test-5() {
863; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test-5() {
864; IS__TUNIT_OPM-NEXT:  entry:
865; IS__TUNIT_OPM-NEXT:    [[CALL:%.*]] = call i32 @rec(i32 noundef 0), !range [[RNG3:![0-9]+]]
866; IS__TUNIT_OPM-NEXT:    ret i32 [[CALL]]
867;
868; NOT_TUNIT_OPM-LABEL: define {{[^@]+}}@test-5() {
869; NOT_TUNIT_OPM-NEXT:  entry:
870; NOT_TUNIT_OPM-NEXT:    [[CALL:%.*]] = call i32 @rec(i32 noundef 0), !range [[RNG4:![0-9]+]]
871; NOT_TUNIT_OPM-NEXT:    ret i32 [[CALL]]
872;
873entry:
874  %call = call i32 @rec(i32 0)
875  ret i32 %call
876}
877define internal i32 @rec(i32 %depth) {
878; CHECK-LABEL: define {{[^@]+}}@rec
879; CHECK-SAME: (i32 [[DEPTH:%.*]]) {
880; CHECK-NEXT:  entry:
881; CHECK-NEXT:    [[CALL:%.*]] = call i32 @foo(i32 [[DEPTH]])
882; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp ne i32 [[CALL]], 0
883; CHECK-NEXT:    br i1 [[TOBOOL]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
884; CHECK:       if.then:
885; CHECK-NEXT:    br label [[RETURN:%.*]]
886; CHECK:       if.end:
887; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 [[DEPTH]], 10
888; CHECK-NEXT:    br i1 [[CMP]], label [[IF_THEN1:%.*]], label [[IF_END3:%.*]]
889; CHECK:       if.then1:
890; CHECK-NEXT:    [[ADD:%.*]] = add nsw i32 [[DEPTH]], 1
891; CHECK-NEXT:    [[CALL2:%.*]] = call i32 @rec(i32 [[ADD]])
892; CHECK-NEXT:    br label [[IF_END3]]
893; CHECK:       if.end3:
894; CHECK-NEXT:    br label [[RETURN]]
895; CHECK:       return:
896; CHECK-NEXT:    [[RETVAL_0:%.*]] = phi i32 [ 0, [[IF_THEN]] ], [ 1, [[IF_END3]] ]
897; CHECK-NEXT:    ret i32 [[RETVAL_0]]
898;
899entry:
900  %call = call i32 @foo(i32 %depth)
901  %tobool = icmp ne i32 %call, 0
902  br i1 %tobool, label %if.then, label %if.end
903
904if.then:                                          ; preds = %entry
905  br label %return
906
907if.end:                                           ; preds = %entry
908  %cmp = icmp slt i32 %depth, 10
909  br i1 %cmp, label %if.then1, label %if.end3
910
911if.then1:                                         ; preds = %if.end
912  %add = add nsw i32 %depth, 1
913  %call2 = call i32 @rec(i32 %add)
914  br label %if.end3
915
916if.end3:                                          ; preds = %if.then1, %if.end
917  br label %return
918
919return:                                           ; preds = %if.end3, %if.then
920  %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end3 ]
921  ret i32 %retval.0
922}
923declare dso_local i32 @foo(i32)
924
925
926; Examples taken from https://llvm.discourse.group/t/impossible-condition-optimization/461/1
927;
928; The important part is that we return a constant (false)
929;
930; {
931
932; FIXME: All but the return is not needed anymore
933define dso_local zeroext i1 @phi(i32 %arg) {
934; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
935; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@phi
936; IS__TUNIT_OPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {
937; IS__TUNIT_OPM-NEXT:  bb:
938; IS__TUNIT_OPM-NEXT:    [[TMP:%.*]] = icmp sgt i32 [[ARG]], 5
939; IS__TUNIT_OPM-NEXT:    br i1 [[TMP]], label [[BB1:%.*]], label [[BB2:%.*]]
940; IS__TUNIT_OPM:       bb1:
941; IS__TUNIT_OPM-NEXT:    br label [[BB3:%.*]]
942; IS__TUNIT_OPM:       bb2:
943; IS__TUNIT_OPM-NEXT:    br label [[BB3]]
944; IS__TUNIT_OPM:       bb3:
945; IS__TUNIT_OPM-NEXT:    [[TMP4:%.*]] = icmp sgt i32 [[ARG]], 10
946; IS__TUNIT_OPM-NEXT:    br i1 [[TMP4]], label [[BB5:%.*]], label [[BB7:%.*]]
947; IS__TUNIT_OPM:       bb5:
948; IS__TUNIT_OPM-NEXT:    br label [[BB9:%.*]]
949; IS__TUNIT_OPM:       bb7:
950; IS__TUNIT_OPM-NEXT:    br label [[BB9]]
951; IS__TUNIT_OPM:       bb9:
952; IS__TUNIT_OPM-NEXT:    br label [[BB12:%.*]]
953; IS__TUNIT_OPM:       bb11:
954; IS__TUNIT_OPM-NEXT:    unreachable
955; IS__TUNIT_OPM:       bb12:
956; IS__TUNIT_OPM-NEXT:    br label [[BB13:%.*]]
957; IS__TUNIT_OPM:       bb13:
958; IS__TUNIT_OPM-NEXT:    ret i1 false
959;
960; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
961; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@phi
962; IS__TUNIT_NPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
963; IS__TUNIT_NPM-NEXT:  bb:
964; IS__TUNIT_NPM-NEXT:    [[TMP:%.*]] = icmp sgt i32 [[ARG]], 5
965; IS__TUNIT_NPM-NEXT:    br i1 [[TMP]], label [[BB1:%.*]], label [[BB2:%.*]]
966; IS__TUNIT_NPM:       bb1:
967; IS__TUNIT_NPM-NEXT:    br label [[BB3:%.*]]
968; IS__TUNIT_NPM:       bb2:
969; IS__TUNIT_NPM-NEXT:    br label [[BB3]]
970; IS__TUNIT_NPM:       bb3:
971; IS__TUNIT_NPM-NEXT:    [[TMP4:%.*]] = icmp sgt i32 [[ARG]], 10
972; IS__TUNIT_NPM-NEXT:    br i1 [[TMP4]], label [[BB5:%.*]], label [[BB7:%.*]]
973; IS__TUNIT_NPM:       bb5:
974; IS__TUNIT_NPM-NEXT:    br label [[BB9:%.*]]
975; IS__TUNIT_NPM:       bb7:
976; IS__TUNIT_NPM-NEXT:    br label [[BB9]]
977; IS__TUNIT_NPM:       bb9:
978; IS__TUNIT_NPM-NEXT:    br label [[BB12:%.*]]
979; IS__TUNIT_NPM:       bb11:
980; IS__TUNIT_NPM-NEXT:    unreachable
981; IS__TUNIT_NPM:       bb12:
982; IS__TUNIT_NPM-NEXT:    br label [[BB13:%.*]]
983; IS__TUNIT_NPM:       bb13:
984; IS__TUNIT_NPM-NEXT:    ret i1 false
985;
986; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
987; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@phi
988; IS__CGSCC_OPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {
989; IS__CGSCC_OPM-NEXT:  bb:
990; IS__CGSCC_OPM-NEXT:    [[TMP:%.*]] = icmp sgt i32 [[ARG]], 5
991; IS__CGSCC_OPM-NEXT:    br i1 [[TMP]], label [[BB1:%.*]], label [[BB2:%.*]]
992; IS__CGSCC_OPM:       bb1:
993; IS__CGSCC_OPM-NEXT:    br label [[BB3:%.*]]
994; IS__CGSCC_OPM:       bb2:
995; IS__CGSCC_OPM-NEXT:    br label [[BB3]]
996; IS__CGSCC_OPM:       bb3:
997; IS__CGSCC_OPM-NEXT:    [[TMP4:%.*]] = icmp sgt i32 [[ARG]], 10
998; IS__CGSCC_OPM-NEXT:    br i1 [[TMP4]], label [[BB5:%.*]], label [[BB7:%.*]]
999; IS__CGSCC_OPM:       bb5:
1000; IS__CGSCC_OPM-NEXT:    br label [[BB9:%.*]]
1001; IS__CGSCC_OPM:       bb7:
1002; IS__CGSCC_OPM-NEXT:    br label [[BB9]]
1003; IS__CGSCC_OPM:       bb9:
1004; IS__CGSCC_OPM-NEXT:    br label [[BB12:%.*]]
1005; IS__CGSCC_OPM:       bb11:
1006; IS__CGSCC_OPM-NEXT:    unreachable
1007; IS__CGSCC_OPM:       bb12:
1008; IS__CGSCC_OPM-NEXT:    br label [[BB13:%.*]]
1009; IS__CGSCC_OPM:       bb13:
1010; IS__CGSCC_OPM-NEXT:    ret i1 false
1011;
1012; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1013; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@phi
1014; IS__CGSCC_NPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
1015; IS__CGSCC_NPM-NEXT:  bb:
1016; IS__CGSCC_NPM-NEXT:    [[TMP:%.*]] = icmp sgt i32 [[ARG]], 5
1017; IS__CGSCC_NPM-NEXT:    br i1 [[TMP]], label [[BB1:%.*]], label [[BB2:%.*]]
1018; IS__CGSCC_NPM:       bb1:
1019; IS__CGSCC_NPM-NEXT:    br label [[BB3:%.*]]
1020; IS__CGSCC_NPM:       bb2:
1021; IS__CGSCC_NPM-NEXT:    br label [[BB3]]
1022; IS__CGSCC_NPM:       bb3:
1023; IS__CGSCC_NPM-NEXT:    [[TMP4:%.*]] = icmp sgt i32 [[ARG]], 10
1024; IS__CGSCC_NPM-NEXT:    br i1 [[TMP4]], label [[BB5:%.*]], label [[BB7:%.*]]
1025; IS__CGSCC_NPM:       bb5:
1026; IS__CGSCC_NPM-NEXT:    br label [[BB9:%.*]]
1027; IS__CGSCC_NPM:       bb7:
1028; IS__CGSCC_NPM-NEXT:    br label [[BB9]]
1029; IS__CGSCC_NPM:       bb9:
1030; IS__CGSCC_NPM-NEXT:    br label [[BB12:%.*]]
1031; IS__CGSCC_NPM:       bb11:
1032; IS__CGSCC_NPM-NEXT:    unreachable
1033; IS__CGSCC_NPM:       bb12:
1034; IS__CGSCC_NPM-NEXT:    br label [[BB13:%.*]]
1035; IS__CGSCC_NPM:       bb13:
1036; IS__CGSCC_NPM-NEXT:    ret i1 false
1037;
1038bb:
1039  %tmp = icmp sgt i32 %arg, 5
1040  br i1 %tmp, label %bb1, label %bb2
1041
1042bb1:                                              ; preds = %bb
1043  br label %bb3
1044
1045bb2:                                              ; preds = %bb
1046  br label %bb3
1047
1048bb3:                                              ; preds = %bb2, %bb1
1049  %.02 = phi i32 [ 1, %bb1 ], [ 2, %bb2 ]
1050  %tmp4 = icmp sgt i32 %arg, 10
1051  br i1 %tmp4, label %bb5, label %bb7
1052
1053bb5:                                              ; preds = %bb3
1054  %tmp6 = add nsw i32 %.02, 1
1055  br label %bb9
1056
1057bb7:                                              ; preds = %bb3
1058  %tmp8 = add nsw i32 %.02, 2
1059  br label %bb9
1060
1061bb9:                                              ; preds = %bb7, %bb5
1062  %.01 = phi i32 [ %tmp6, %bb5 ], [ %tmp8, %bb7 ]
1063  %tmp10 = icmp eq i32 %.01, 5
1064  br i1 %tmp10, label %bb11, label %bb12
1065
1066bb11:                                             ; preds = %bb9
1067  br label %bb13
1068
1069bb12:                                             ; preds = %bb9
1070  br label %bb13
1071
1072bb13:                                             ; preds = %bb12, %bb11
1073  %.0 = phi i1 [ true, %bb11 ], [ false, %bb12 ]
1074  ret i1 %.0
1075}
1076
1077define dso_local i1 @select(i32 %a) local_unnamed_addr #0 {
1078; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1079; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@select
1080; IS__TUNIT_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
1081; IS__TUNIT_OPM-NEXT:  entry:
1082; IS__TUNIT_OPM-NEXT:    ret i1 false
1083;
1084; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1085; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@select
1086; IS__TUNIT_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] {
1087; IS__TUNIT_NPM-NEXT:  entry:
1088; IS__TUNIT_NPM-NEXT:    ret i1 false
1089;
1090; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1091; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@select
1092; IS__CGSCC_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
1093; IS__CGSCC_OPM-NEXT:  entry:
1094; IS__CGSCC_OPM-NEXT:    ret i1 false
1095;
1096; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1097; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@select
1098; IS__CGSCC_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] {
1099; IS__CGSCC_NPM-NEXT:  entry:
1100; IS__CGSCC_NPM-NEXT:    ret i1 false
1101;
1102entry:
1103  %cmp = icmp sgt i32 %a, 5
1104  %. = select i1 %cmp, i32 1, i32 2
1105  %cmp1 = icmp sgt i32 %a, 10
1106  %y.0.v = select i1 %cmp1, i32 1, i32 2
1107  %y.0 = add nuw nsw i32 %., %y.0.v
1108  %cmp6 = icmp eq i32 %y.0, 5
1109  ret i1 %cmp6
1110}
1111
1112define dso_local i32 @select_zext(i32 %a) local_unnamed_addr #0 {
1113; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1114; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@select_zext
1115; IS__TUNIT_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
1116; IS__TUNIT_OPM-NEXT:  entry:
1117; IS__TUNIT_OPM-NEXT:    ret i32 0
1118;
1119; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1120; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@select_zext
1121; IS__TUNIT_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] {
1122; IS__TUNIT_NPM-NEXT:  entry:
1123; IS__TUNIT_NPM-NEXT:    ret i32 0
1124;
1125; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1126; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@select_zext
1127; IS__CGSCC_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
1128; IS__CGSCC_OPM-NEXT:  entry:
1129; IS__CGSCC_OPM-NEXT:    ret i32 0
1130;
1131; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1132; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@select_zext
1133; IS__CGSCC_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] {
1134; IS__CGSCC_NPM-NEXT:  entry:
1135; IS__CGSCC_NPM-NEXT:    ret i32 0
1136;
1137entry:
1138  %cmp = icmp sgt i32 %a, 5
1139  %. = select i1 %cmp, i32 1, i32 2
1140  %cmp1 = icmp sgt i32 %a, 10
1141  %y.0.v = select i1 %cmp1, i32 1, i32 2
1142  %y.0 = add nuw nsw i32 %., %y.0.v
1143  %cmp6 = icmp eq i32 %y.0, 5
1144  %.13 = zext i1 %cmp6 to i32
1145  ret i32 %.13
1146}
1147
1148; FIXME: We do not look through the ptr casts here.
1149define dso_local i64 @select_int2ptr_bitcast_ptr2int(i32 %a) local_unnamed_addr #0 {
1150; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1151; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@select_int2ptr_bitcast_ptr2int
1152; IS__TUNIT_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
1153; IS__TUNIT_OPM-NEXT:  entry:
1154; IS__TUNIT_OPM-NEXT:    [[I2P:%.*]] = inttoptr i1 false to i1*
1155; IS__TUNIT_OPM-NEXT:    [[BC:%.*]] = bitcast i1* [[I2P]] to i32*
1156; IS__TUNIT_OPM-NEXT:    [[P2I:%.*]] = ptrtoint i32* [[BC]] to i64
1157; IS__TUNIT_OPM-NEXT:    ret i64 [[P2I]]
1158;
1159; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1160; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@select_int2ptr_bitcast_ptr2int
1161; IS__TUNIT_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] {
1162; IS__TUNIT_NPM-NEXT:  entry:
1163; IS__TUNIT_NPM-NEXT:    [[I2P:%.*]] = inttoptr i1 false to i1*
1164; IS__TUNIT_NPM-NEXT:    [[BC:%.*]] = bitcast i1* [[I2P]] to i32*
1165; IS__TUNIT_NPM-NEXT:    [[P2I:%.*]] = ptrtoint i32* [[BC]] to i64
1166; IS__TUNIT_NPM-NEXT:    ret i64 [[P2I]]
1167;
1168; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1169; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@select_int2ptr_bitcast_ptr2int
1170; IS__CGSCC_OPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
1171; IS__CGSCC_OPM-NEXT:  entry:
1172; IS__CGSCC_OPM-NEXT:    [[I2P:%.*]] = inttoptr i1 false to i1*
1173; IS__CGSCC_OPM-NEXT:    [[BC:%.*]] = bitcast i1* [[I2P]] to i32*
1174; IS__CGSCC_OPM-NEXT:    [[P2I:%.*]] = ptrtoint i32* [[BC]] to i64
1175; IS__CGSCC_OPM-NEXT:    ret i64 [[P2I]]
1176;
1177; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1178; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@select_int2ptr_bitcast_ptr2int
1179; IS__CGSCC_NPM-SAME: (i32 [[A:%.*]]) local_unnamed_addr #[[ATTR1]] {
1180; IS__CGSCC_NPM-NEXT:  entry:
1181; IS__CGSCC_NPM-NEXT:    [[I2P:%.*]] = inttoptr i1 false to i1*
1182; IS__CGSCC_NPM-NEXT:    [[BC:%.*]] = bitcast i1* [[I2P]] to i32*
1183; IS__CGSCC_NPM-NEXT:    [[P2I:%.*]] = ptrtoint i32* [[BC]] to i64
1184; IS__CGSCC_NPM-NEXT:    ret i64 [[P2I]]
1185;
1186entry:
1187  %cmp = icmp sgt i32 %a, 5
1188  %. = select i1 %cmp, i32 1, i32 2
1189  %cmp1 = icmp sgt i32 %a, 10
1190  %y.0.v = select i1 %cmp1, i32 1, i32 2
1191  %y.0 = add nuw nsw i32 %., %y.0.v
1192  %cmp6 = icmp eq i32 %y.0, 5
1193  %i2p = inttoptr i1 %cmp6 to i1*
1194  %bc = bitcast i1* %i2p to i32*
1195  %p2i = ptrtoint i32* %bc to i64
1196  ret i64 %p2i
1197}
1198
1199; }
1200
1201define i1 @f_fcmp(float %a, float %b) {
1202; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1203; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@f_fcmp
1204; IS__TUNIT_OPM-SAME: (float [[A:%.*]], float [[B:%.*]]) #[[ATTR2]] {
1205; IS__TUNIT_OPM-NEXT:    [[R:%.*]] = fcmp uge float [[A]], [[B]]
1206; IS__TUNIT_OPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1207; IS__TUNIT_OPM-NEXT:    ret i1 [[S]]
1208;
1209; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1210; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@f_fcmp
1211; IS__TUNIT_NPM-SAME: (float [[A:%.*]], float [[B:%.*]]) #[[ATTR1]] {
1212; IS__TUNIT_NPM-NEXT:    [[R:%.*]] = fcmp uge float [[A]], [[B]]
1213; IS__TUNIT_NPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1214; IS__TUNIT_NPM-NEXT:    ret i1 [[S]]
1215;
1216; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1217; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f_fcmp
1218; IS__CGSCC_OPM-SAME: (float [[A:%.*]], float [[B:%.*]]) #[[ATTR2]] {
1219; IS__CGSCC_OPM-NEXT:    [[R:%.*]] = fcmp uge float [[A]], [[B]]
1220; IS__CGSCC_OPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1221; IS__CGSCC_OPM-NEXT:    ret i1 [[S]]
1222;
1223; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1224; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f_fcmp
1225; IS__CGSCC_NPM-SAME: (float [[A:%.*]], float [[B:%.*]]) #[[ATTR1]] {
1226; IS__CGSCC_NPM-NEXT:    [[R:%.*]] = fcmp uge float [[A]], [[B]]
1227; IS__CGSCC_NPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1228; IS__CGSCC_NPM-NEXT:    ret i1 [[S]]
1229;
1230  %r = fcmp uge float %a, %b
1231  %s = select i1 %r, i1 %r, i1 0
1232  ret i1 %s
1233}
1234define i1 @d_fcmp(double %a, double %b) {
1235; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1236; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@d_fcmp
1237; IS__TUNIT_OPM-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[ATTR2]] {
1238; IS__TUNIT_OPM-NEXT:    [[R:%.*]] = fcmp oeq double [[A]], [[B]]
1239; IS__TUNIT_OPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1240; IS__TUNIT_OPM-NEXT:    ret i1 [[S]]
1241;
1242; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1243; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@d_fcmp
1244; IS__TUNIT_NPM-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[ATTR1]] {
1245; IS__TUNIT_NPM-NEXT:    [[R:%.*]] = fcmp oeq double [[A]], [[B]]
1246; IS__TUNIT_NPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1247; IS__TUNIT_NPM-NEXT:    ret i1 [[S]]
1248;
1249; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1250; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@d_fcmp
1251; IS__CGSCC_OPM-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[ATTR2]] {
1252; IS__CGSCC_OPM-NEXT:    [[R:%.*]] = fcmp oeq double [[A]], [[B]]
1253; IS__CGSCC_OPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1254; IS__CGSCC_OPM-NEXT:    ret i1 [[S]]
1255;
1256; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1257; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@d_fcmp
1258; IS__CGSCC_NPM-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[ATTR1]] {
1259; IS__CGSCC_NPM-NEXT:    [[R:%.*]] = fcmp oeq double [[A]], [[B]]
1260; IS__CGSCC_NPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1261; IS__CGSCC_NPM-NEXT:    ret i1 [[S]]
1262;
1263  %r = fcmp oeq double %a, %b
1264  %s = select i1 %r, i1 %r, i1 0
1265  ret i1 %s
1266}
1267define i1 @dp_icmp(double* %a, double* %b) {
1268; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1269; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@dp_icmp
1270; IS__TUNIT_OPM-SAME: (double* nofree readnone [[A:%.*]], double* nofree readnone [[B:%.*]]) #[[ATTR2]] {
1271; IS__TUNIT_OPM-NEXT:    [[R:%.*]] = icmp sge double* [[A]], [[B]]
1272; IS__TUNIT_OPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1273; IS__TUNIT_OPM-NEXT:    ret i1 [[S]]
1274;
1275; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1276; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@dp_icmp
1277; IS__TUNIT_NPM-SAME: (double* nofree readnone [[A:%.*]], double* nofree readnone [[B:%.*]]) #[[ATTR1]] {
1278; IS__TUNIT_NPM-NEXT:    [[R:%.*]] = icmp sge double* [[A]], [[B]]
1279; IS__TUNIT_NPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1280; IS__TUNIT_NPM-NEXT:    ret i1 [[S]]
1281;
1282; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1283; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@dp_icmp
1284; IS__CGSCC_OPM-SAME: (double* nofree readnone [[A:%.*]], double* nofree readnone [[B:%.*]]) #[[ATTR2]] {
1285; IS__CGSCC_OPM-NEXT:    [[R:%.*]] = icmp sge double* [[A]], [[B]]
1286; IS__CGSCC_OPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1287; IS__CGSCC_OPM-NEXT:    ret i1 [[S]]
1288;
1289; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1290; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@dp_icmp
1291; IS__CGSCC_NPM-SAME: (double* nofree readnone [[A:%.*]], double* nofree readnone [[B:%.*]]) #[[ATTR1]] {
1292; IS__CGSCC_NPM-NEXT:    [[R:%.*]] = icmp sge double* [[A]], [[B]]
1293; IS__CGSCC_NPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1294; IS__CGSCC_NPM-NEXT:    ret i1 [[S]]
1295;
1296  %r = icmp sge double* %a, %b
1297  %s = select i1 %r, i1 %r, i1 0
1298  ret i1 %s
1299}
1300define i1 @ip_icmp(i8* %a, i8* %b) {
1301; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1302; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ip_icmp
1303; IS__TUNIT_OPM-SAME: (i8* nofree readnone [[A:%.*]], i8* nofree readnone [[B:%.*]]) #[[ATTR2]] {
1304; IS__TUNIT_OPM-NEXT:    [[R:%.*]] = icmp ult i8* [[A]], [[B]]
1305; IS__TUNIT_OPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1306; IS__TUNIT_OPM-NEXT:    ret i1 [[S]]
1307;
1308; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1309; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ip_icmp
1310; IS__TUNIT_NPM-SAME: (i8* nofree readnone [[A:%.*]], i8* nofree readnone [[B:%.*]]) #[[ATTR1]] {
1311; IS__TUNIT_NPM-NEXT:    [[R:%.*]] = icmp ult i8* [[A]], [[B]]
1312; IS__TUNIT_NPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1313; IS__TUNIT_NPM-NEXT:    ret i1 [[S]]
1314;
1315; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1316; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ip_icmp
1317; IS__CGSCC_OPM-SAME: (i8* nofree readnone [[A:%.*]], i8* nofree readnone [[B:%.*]]) #[[ATTR2]] {
1318; IS__CGSCC_OPM-NEXT:    [[R:%.*]] = icmp ult i8* [[A]], [[B]]
1319; IS__CGSCC_OPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1320; IS__CGSCC_OPM-NEXT:    ret i1 [[S]]
1321;
1322; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1323; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@ip_icmp
1324; IS__CGSCC_NPM-SAME: (i8* nofree readnone [[A:%.*]], i8* nofree readnone [[B:%.*]]) #[[ATTR1]] {
1325; IS__CGSCC_NPM-NEXT:    [[R:%.*]] = icmp ult i8* [[A]], [[B]]
1326; IS__CGSCC_NPM-NEXT:    [[S:%.*]] = select i1 [[R]], i1 [[R]], i1 false
1327; IS__CGSCC_NPM-NEXT:    ret i1 [[S]]
1328;
1329  %r = icmp ult i8* %a, %b
1330  %s = select i1 %r, i1 %r, i1 0
1331  ret i1 %s
1332}
1333define i1 @fcmp_caller(float %fa, float %fb, double %da, double %db, double* %dpa, double* %dpb, i8* %ipa, i8* %ipb) {
1334; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1335; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@fcmp_caller
1336; IS__TUNIT_OPM-SAME: (float [[FA:%.*]], float [[FB:%.*]], double [[DA:%.*]], double [[DB:%.*]], double* nofree readnone [[DPA:%.*]], double* nofree readnone [[DPB:%.*]], i8* nofree readnone [[IPA:%.*]], i8* nofree readnone [[IPB:%.*]]) #[[ATTR2]] {
1337; IS__TUNIT_OPM-NEXT:    [[R1:%.*]] = call i1 @f_fcmp(float [[FA]], float [[FB]]) #[[ATTR2]]
1338; IS__TUNIT_OPM-NEXT:    [[R2:%.*]] = call i1 @d_fcmp(double [[DA]], double [[DB]]) #[[ATTR2]]
1339; IS__TUNIT_OPM-NEXT:    [[R3:%.*]] = call i1 @dp_icmp(double* noalias nofree readnone [[DPA]], double* noalias nofree readnone [[DPB]]) #[[ATTR2]]
1340; IS__TUNIT_OPM-NEXT:    [[R4:%.*]] = call i1 @ip_icmp(i8* noalias nofree readnone [[IPA]], i8* noalias nofree readnone [[IPB]]) #[[ATTR2]]
1341; IS__TUNIT_OPM-NEXT:    [[O1:%.*]] = or i1 [[R1]], [[R2]]
1342; IS__TUNIT_OPM-NEXT:    [[O2:%.*]] = or i1 [[R3]], [[R4]]
1343; IS__TUNIT_OPM-NEXT:    [[O3:%.*]] = or i1 [[O1]], [[O2]]
1344; IS__TUNIT_OPM-NEXT:    ret i1 [[O3]]
1345;
1346; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1347; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@fcmp_caller
1348; IS__TUNIT_NPM-SAME: (float [[FA:%.*]], float [[FB:%.*]], double [[DA:%.*]], double [[DB:%.*]], double* nofree readnone [[DPA:%.*]], double* nofree readnone [[DPB:%.*]], i8* nofree readnone [[IPA:%.*]], i8* nofree readnone [[IPB:%.*]]) #[[ATTR1]] {
1349; IS__TUNIT_NPM-NEXT:    [[R1:%.*]] = call i1 @f_fcmp(float [[FA]], float [[FB]]) #[[ATTR1]]
1350; IS__TUNIT_NPM-NEXT:    [[R2:%.*]] = call i1 @d_fcmp(double [[DA]], double [[DB]]) #[[ATTR1]]
1351; IS__TUNIT_NPM-NEXT:    [[R3:%.*]] = call i1 @dp_icmp(double* noalias nofree readnone [[DPA]], double* noalias nofree readnone [[DPB]]) #[[ATTR1]]
1352; IS__TUNIT_NPM-NEXT:    [[R4:%.*]] = call i1 @ip_icmp(i8* noalias nofree readnone [[IPA]], i8* noalias nofree readnone [[IPB]]) #[[ATTR1]]
1353; IS__TUNIT_NPM-NEXT:    [[O1:%.*]] = or i1 [[R1]], [[R2]]
1354; IS__TUNIT_NPM-NEXT:    [[O2:%.*]] = or i1 [[R3]], [[R4]]
1355; IS__TUNIT_NPM-NEXT:    [[O3:%.*]] = or i1 [[O1]], [[O2]]
1356; IS__TUNIT_NPM-NEXT:    ret i1 [[O3]]
1357;
1358; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1359; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@fcmp_caller
1360; IS__CGSCC_OPM-SAME: (float [[FA:%.*]], float [[FB:%.*]], double [[DA:%.*]], double [[DB:%.*]], double* nofree readnone [[DPA:%.*]], double* nofree readnone [[DPB:%.*]], i8* nofree readnone [[IPA:%.*]], i8* nofree readnone [[IPB:%.*]]) #[[ATTR2]] {
1361; IS__CGSCC_OPM-NEXT:    [[R1:%.*]] = call i1 @f_fcmp(float [[FA]], float [[FB]]) #[[ATTR5]]
1362; IS__CGSCC_OPM-NEXT:    [[R2:%.*]] = call i1 @d_fcmp(double [[DA]], double [[DB]]) #[[ATTR5]]
1363; IS__CGSCC_OPM-NEXT:    [[R3:%.*]] = call i1 @dp_icmp(double* noalias nofree readnone [[DPA]], double* noalias nofree readnone [[DPB]]) #[[ATTR5]]
1364; IS__CGSCC_OPM-NEXT:    [[R4:%.*]] = call i1 @ip_icmp(i8* noalias nofree readnone [[IPA]], i8* noalias nofree readnone [[IPB]]) #[[ATTR5]]
1365; IS__CGSCC_OPM-NEXT:    [[O1:%.*]] = or i1 [[R1]], [[R2]]
1366; IS__CGSCC_OPM-NEXT:    [[O2:%.*]] = or i1 [[R3]], [[R4]]
1367; IS__CGSCC_OPM-NEXT:    [[O3:%.*]] = or i1 [[O1]], [[O2]]
1368; IS__CGSCC_OPM-NEXT:    ret i1 [[O3]]
1369;
1370; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1371; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@fcmp_caller
1372; IS__CGSCC_NPM-SAME: (float [[FA:%.*]], float [[FB:%.*]], double [[DA:%.*]], double [[DB:%.*]], double* nofree readnone [[DPA:%.*]], double* nofree readnone [[DPB:%.*]], i8* nofree readnone [[IPA:%.*]], i8* nofree readnone [[IPB:%.*]]) #[[ATTR1]] {
1373; IS__CGSCC_NPM-NEXT:    [[R1:%.*]] = call i1 @f_fcmp(float [[FA]], float [[FB]]) #[[ATTR3]]
1374; IS__CGSCC_NPM-NEXT:    [[R2:%.*]] = call i1 @d_fcmp(double [[DA]], double [[DB]]) #[[ATTR3]]
1375; IS__CGSCC_NPM-NEXT:    [[R3:%.*]] = call i1 @dp_icmp(double* noalias nofree readnone [[DPA]], double* noalias nofree readnone [[DPB]]) #[[ATTR3]]
1376; IS__CGSCC_NPM-NEXT:    [[R4:%.*]] = call i1 @ip_icmp(i8* noalias nofree readnone [[IPA]], i8* noalias nofree readnone [[IPB]]) #[[ATTR3]]
1377; IS__CGSCC_NPM-NEXT:    [[O1:%.*]] = or i1 [[R1]], [[R2]]
1378; IS__CGSCC_NPM-NEXT:    [[O2:%.*]] = or i1 [[R3]], [[R4]]
1379; IS__CGSCC_NPM-NEXT:    [[O3:%.*]] = or i1 [[O1]], [[O2]]
1380; IS__CGSCC_NPM-NEXT:    ret i1 [[O3]]
1381;
1382  %r1 = call i1 @f_fcmp(float %fa, float %fb)
1383  %r2 = call i1 @d_fcmp(double %da, double %db)
1384  %r3 = call i1 @dp_icmp(double* %dpa, double* %dpb)
1385  %r4 = call i1 @ip_icmp(i8* %ipa, i8* %ipb)
1386  %o1 = or i1 %r1, %r2
1387  %o2 = or i1 %r3, %r4
1388  %o3 = or i1 %o1, %o2
1389  ret i1 %o3
1390}
1391
1392define i8 @ret_two() {
1393; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1394; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ret_two
1395; IS__TUNIT_OPM-SAME: () #[[ATTR2]] {
1396; IS__TUNIT_OPM-NEXT:    ret i8 2
1397;
1398; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1399; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ret_two
1400; IS__TUNIT_NPM-SAME: () #[[ATTR1]] {
1401; IS__TUNIT_NPM-NEXT:    ret i8 2
1402;
1403; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1404; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ret_two
1405; IS__CGSCC_OPM-SAME: () #[[ATTR2]] {
1406; IS__CGSCC_OPM-NEXT:    ret i8 2
1407;
1408; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1409; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@ret_two
1410; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
1411; IS__CGSCC_NPM-NEXT:    ret i8 2
1412;
1413  ret i8 2
1414}
1415define i8 @ret_undef() {
1416; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1417; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ret_undef
1418; IS__TUNIT_OPM-SAME: () #[[ATTR2]] {
1419; IS__TUNIT_OPM-NEXT:    ret i8 undef
1420;
1421; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1422; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ret_undef
1423; IS__TUNIT_NPM-SAME: () #[[ATTR1]] {
1424; IS__TUNIT_NPM-NEXT:    ret i8 undef
1425;
1426; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1427; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ret_undef
1428; IS__CGSCC_OPM-SAME: () #[[ATTR2]] {
1429; IS__CGSCC_OPM-NEXT:    ret i8 undef
1430;
1431; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1432; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@ret_undef
1433; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
1434; IS__CGSCC_NPM-NEXT:    ret i8 undef
1435;
1436  ret i8 undef
1437}
1438
1439; Verify we collapse undef to a value and return something non-undef here.
1440define i8 @undef_collapse_1() {
1441; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1442; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@undef_collapse_1
1443; IS__TUNIT_OPM-SAME: () #[[ATTR2]] {
1444; IS__TUNIT_OPM-NEXT:    ret i8 0
1445;
1446; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1447; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@undef_collapse_1
1448; IS__TUNIT_NPM-SAME: () #[[ATTR1]] {
1449; IS__TUNIT_NPM-NEXT:    ret i8 0
1450;
1451; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1452; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@undef_collapse_1
1453; IS__CGSCC_OPM-SAME: () #[[ATTR2]] {
1454; IS__CGSCC_OPM-NEXT:    ret i8 0
1455;
1456; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1457; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@undef_collapse_1
1458; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
1459; IS__CGSCC_NPM-NEXT:    ret i8 0
1460;
1461  %c = call i8 @ret_undef()
1462  %s = shl i8 %c, 2
1463  ret i8 %s
1464}
1465
1466; Verify we collapse undef to a value and return something non-undef here.
1467define i8 @undef_collapse_2() {
1468; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1469; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@undef_collapse_2
1470; IS__TUNIT_OPM-SAME: () #[[ATTR2]] {
1471; IS__TUNIT_OPM-NEXT:    ret i8 0
1472;
1473; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1474; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@undef_collapse_2
1475; IS__TUNIT_NPM-SAME: () #[[ATTR1]] {
1476; IS__TUNIT_NPM-NEXT:    ret i8 0
1477;
1478; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1479; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@undef_collapse_2
1480; IS__CGSCC_OPM-SAME: () #[[ATTR2]] {
1481; IS__CGSCC_OPM-NEXT:    ret i8 0
1482;
1483; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1484; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@undef_collapse_2
1485; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
1486; IS__CGSCC_NPM-NEXT:    ret i8 0
1487;
1488  %c = call i8 @ret_two()
1489  %s = shl i8 undef, %c
1490  ret i8 %s
1491}
1492
1493define i8 @undef_collapse_caller() {
1494;
1495; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1496; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@undef_collapse_caller
1497; IS__TUNIT_OPM-SAME: () #[[ATTR2]] {
1498; IS__TUNIT_OPM-NEXT:    ret i8 0
1499;
1500; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1501; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@undef_collapse_caller
1502; IS__TUNIT_NPM-SAME: () #[[ATTR1]] {
1503; IS__TUNIT_NPM-NEXT:    ret i8 0
1504;
1505; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1506; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@undef_collapse_caller
1507; IS__CGSCC_OPM-SAME: () #[[ATTR2]] {
1508; IS__CGSCC_OPM-NEXT:    ret i8 0
1509;
1510; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1511; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@undef_collapse_caller
1512; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
1513; IS__CGSCC_NPM-NEXT:    ret i8 0
1514;
1515  %c1 = call i8 @undef_collapse_1()
1516  %c2 = call i8 @undef_collapse_2()
1517  %a = add i8 %c1, %c2
1518  ret i8 %a
1519}
1520
1521define i32 @ret1or2(i1 %c) {
1522; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1523; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ret1or2
1524; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] {
1525; IS__TUNIT_OPM-NEXT:    [[S:%.*]] = select i1 [[C]], i32 1, i32 2
1526; IS__TUNIT_OPM-NEXT:    ret i32 [[S]]
1527;
1528; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1529; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ret1or2
1530; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1531; IS__TUNIT_NPM-NEXT:    [[S:%.*]] = select i1 [[C]], i32 1, i32 2
1532; IS__TUNIT_NPM-NEXT:    ret i32 [[S]]
1533;
1534; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1535; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ret1or2
1536; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] {
1537; IS__CGSCC_OPM-NEXT:    [[S:%.*]] = select i1 [[C]], i32 1, i32 2
1538; IS__CGSCC_OPM-NEXT:    ret i32 [[S]]
1539;
1540; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1541; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@ret1or2
1542; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1543; IS__CGSCC_NPM-NEXT:    [[S:%.*]] = select i1 [[C]], i32 1, i32 2
1544; IS__CGSCC_NPM-NEXT:    ret i32 [[S]]
1545;
1546  %s = select i1 %c, i32 1, i32 2
1547  ret i32 %s
1548}
1549define i1 @callee_range_1(i1 %c1, i1 %c2, i1 %c3) {
1550;
1551; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1552; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@callee_range_1
1553; IS__TUNIT_OPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR2]] {
1554; IS__TUNIT_OPM-NEXT:    ret i1 true
1555;
1556; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1557; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@callee_range_1
1558; IS__TUNIT_NPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR1]] {
1559; IS__TUNIT_NPM-NEXT:    ret i1 true
1560;
1561; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1562; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@callee_range_1
1563; IS__CGSCC_OPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR2]] {
1564; IS__CGSCC_OPM-NEXT:    ret i1 true
1565;
1566; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1567; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@callee_range_1
1568; IS__CGSCC_NPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR1]] {
1569; IS__CGSCC_NPM-NEXT:    ret i1 true
1570;
1571  %r1 = call i32 @ret1or2(i1 %c1)
1572  %r2 = call i32 @ret1or2(i1 %c2)
1573  %indirection = select i1 %c3, i32 %r1, i32 %r2
1574  %a = add i32 %r1, %indirection
1575  %i1 = icmp sle i32 %a, 4
1576  %i2 = icmp sge i32 %a, 2
1577  %f = and i1 %i1, %i2
1578  ret i1 %f
1579}
1580
1581define i1 @callee_range_2(i1 %c1, i1 %c2) {
1582;
1583; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1584; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@callee_range_2
1585; IS__TUNIT_OPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR2]] {
1586; IS__TUNIT_OPM-NEXT:    [[R1:%.*]] = call i32 @ret1or2(i1 [[C1]]) #[[ATTR2]], !range [[RNG4:![0-9]+]]
1587; IS__TUNIT_OPM-NEXT:    [[R2:%.*]] = call i32 @ret1or2(i1 [[C2]]) #[[ATTR2]], !range [[RNG4]]
1588; IS__TUNIT_OPM-NEXT:    [[A:%.*]] = add i32 [[R1]], [[R2]]
1589; IS__TUNIT_OPM-NEXT:    [[I1:%.*]] = icmp sle i32 [[A]], 3
1590; IS__TUNIT_OPM-NEXT:    [[I2:%.*]] = icmp sge i32 [[A]], 2
1591; IS__TUNIT_OPM-NEXT:    [[F:%.*]] = and i1 [[I1]], [[I2]]
1592; IS__TUNIT_OPM-NEXT:    ret i1 [[F]]
1593;
1594; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1595; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@callee_range_2
1596; IS__TUNIT_NPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR1]] {
1597; IS__TUNIT_NPM-NEXT:    [[R1:%.*]] = call i32 @ret1or2(i1 [[C1]]) #[[ATTR1]], !range [[RNG5:![0-9]+]]
1598; IS__TUNIT_NPM-NEXT:    [[R2:%.*]] = call i32 @ret1or2(i1 [[C2]]) #[[ATTR1]], !range [[RNG5]]
1599; IS__TUNIT_NPM-NEXT:    [[A:%.*]] = add i32 [[R1]], [[R2]]
1600; IS__TUNIT_NPM-NEXT:    [[I1:%.*]] = icmp sle i32 [[A]], 3
1601; IS__TUNIT_NPM-NEXT:    [[I2:%.*]] = icmp sge i32 [[A]], 2
1602; IS__TUNIT_NPM-NEXT:    [[F:%.*]] = and i1 [[I1]], [[I2]]
1603; IS__TUNIT_NPM-NEXT:    ret i1 [[F]]
1604;
1605; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1606; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@callee_range_2
1607; IS__CGSCC_OPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR2]] {
1608; IS__CGSCC_OPM-NEXT:    [[R1:%.*]] = call i32 @ret1or2(i1 [[C1]]) #[[ATTR5]], !range [[RNG5:![0-9]+]]
1609; IS__CGSCC_OPM-NEXT:    [[R2:%.*]] = call i32 @ret1or2(i1 [[C2]]) #[[ATTR5]], !range [[RNG5]]
1610; IS__CGSCC_OPM-NEXT:    [[A:%.*]] = add i32 [[R1]], [[R2]]
1611; IS__CGSCC_OPM-NEXT:    [[I1:%.*]] = icmp sle i32 [[A]], 3
1612; IS__CGSCC_OPM-NEXT:    [[I2:%.*]] = icmp sge i32 [[A]], 2
1613; IS__CGSCC_OPM-NEXT:    [[F:%.*]] = and i1 [[I1]], [[I2]]
1614; IS__CGSCC_OPM-NEXT:    ret i1 [[F]]
1615;
1616; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1617; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@callee_range_2
1618; IS__CGSCC_NPM-SAME: (i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR1]] {
1619; IS__CGSCC_NPM-NEXT:    [[R1:%.*]] = call i32 @ret1or2(i1 [[C1]]) #[[ATTR3]], !range [[RNG5:![0-9]+]]
1620; IS__CGSCC_NPM-NEXT:    [[R2:%.*]] = call i32 @ret1or2(i1 [[C2]]) #[[ATTR3]], !range [[RNG5]]
1621; IS__CGSCC_NPM-NEXT:    [[A:%.*]] = add i32 [[R1]], [[R2]]
1622; IS__CGSCC_NPM-NEXT:    [[I1:%.*]] = icmp sle i32 [[A]], 3
1623; IS__CGSCC_NPM-NEXT:    [[I2:%.*]] = icmp sge i32 [[A]], 2
1624; IS__CGSCC_NPM-NEXT:    [[F:%.*]] = and i1 [[I1]], [[I2]]
1625; IS__CGSCC_NPM-NEXT:    ret i1 [[F]]
1626;
1627  %r1 = call i32 @ret1or2(i1 %c1)
1628  %r2 = call i32 @ret1or2(i1 %c2)
1629  %a = add i32 %r1, %r2
1630  %i1 = icmp sle i32 %a, 3
1631  %i2 = icmp sge i32 %a, 2
1632  %f = and i1 %i1, %i2
1633  ret i1 %f
1634}
1635
1636
1637define i32 @ret100() {
1638; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1639; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ret100
1640; IS__TUNIT_OPM-SAME: () #[[ATTR2]] {
1641; IS__TUNIT_OPM-NEXT:    ret i32 100
1642;
1643; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1644; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ret100
1645; IS__TUNIT_NPM-SAME: () #[[ATTR1]] {
1646; IS__TUNIT_NPM-NEXT:    ret i32 100
1647;
1648; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1649; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ret100
1650; IS__CGSCC_OPM-SAME: () #[[ATTR2]] {
1651; IS__CGSCC_OPM-NEXT:    ret i32 100
1652;
1653; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1654; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@ret100
1655; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
1656; IS__CGSCC_NPM-NEXT:    ret i32 100
1657;
1658  ret i32 100
1659}
1660
1661define i1 @ctx_adjustment(i32 %V) {
1662;
1663; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1664; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@ctx_adjustment
1665; IS__TUNIT_OPM-SAME: (i32 [[V:%.*]]) #[[ATTR2]] {
1666; IS__TUNIT_OPM-NEXT:    [[C1:%.*]] = icmp sge i32 [[V]], 100
1667; IS__TUNIT_OPM-NEXT:    br i1 [[C1]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
1668; IS__TUNIT_OPM:       if.true:
1669; IS__TUNIT_OPM-NEXT:    br label [[END:%.*]]
1670; IS__TUNIT_OPM:       if.false:
1671; IS__TUNIT_OPM-NEXT:    br label [[END]]
1672; IS__TUNIT_OPM:       end:
1673; IS__TUNIT_OPM-NEXT:    [[PHI:%.*]] = phi i32 [ [[V]], [[IF_TRUE]] ], [ 100, [[IF_FALSE]] ]
1674; IS__TUNIT_OPM-NEXT:    [[C2:%.*]] = icmp sge i32 [[PHI]], 100
1675; IS__TUNIT_OPM-NEXT:    ret i1 [[C2]]
1676;
1677; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1678; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@ctx_adjustment
1679; IS__TUNIT_NPM-SAME: (i32 [[V:%.*]]) #[[ATTR1]] {
1680; IS__TUNIT_NPM-NEXT:    [[C1:%.*]] = icmp sge i32 [[V]], 100
1681; IS__TUNIT_NPM-NEXT:    br i1 [[C1]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
1682; IS__TUNIT_NPM:       if.true:
1683; IS__TUNIT_NPM-NEXT:    br label [[END:%.*]]
1684; IS__TUNIT_NPM:       if.false:
1685; IS__TUNIT_NPM-NEXT:    br label [[END]]
1686; IS__TUNIT_NPM:       end:
1687; IS__TUNIT_NPM-NEXT:    ret i1 true
1688;
1689; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1690; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@ctx_adjustment
1691; IS__CGSCC_OPM-SAME: (i32 [[V:%.*]]) #[[ATTR2]] {
1692; IS__CGSCC_OPM-NEXT:    [[C1:%.*]] = icmp sge i32 [[V]], 100
1693; IS__CGSCC_OPM-NEXT:    br i1 [[C1]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
1694; IS__CGSCC_OPM:       if.true:
1695; IS__CGSCC_OPM-NEXT:    br label [[END:%.*]]
1696; IS__CGSCC_OPM:       if.false:
1697; IS__CGSCC_OPM-NEXT:    br label [[END]]
1698; IS__CGSCC_OPM:       end:
1699; IS__CGSCC_OPM-NEXT:    [[PHI:%.*]] = phi i32 [ [[V]], [[IF_TRUE]] ], [ 100, [[IF_FALSE]] ]
1700; IS__CGSCC_OPM-NEXT:    [[C2:%.*]] = icmp sge i32 [[PHI]], 100
1701; IS__CGSCC_OPM-NEXT:    ret i1 [[C2]]
1702;
1703; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1704; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@ctx_adjustment
1705; IS__CGSCC_NPM-SAME: (i32 [[V:%.*]]) #[[ATTR1]] {
1706; IS__CGSCC_NPM-NEXT:    [[C1:%.*]] = icmp sge i32 [[V]], 100
1707; IS__CGSCC_NPM-NEXT:    br i1 [[C1]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
1708; IS__CGSCC_NPM:       if.true:
1709; IS__CGSCC_NPM-NEXT:    br label [[END:%.*]]
1710; IS__CGSCC_NPM:       if.false:
1711; IS__CGSCC_NPM-NEXT:    br label [[END]]
1712; IS__CGSCC_NPM:       end:
1713; IS__CGSCC_NPM-NEXT:    ret i1 true
1714;
1715  %c1 = icmp sge i32 %V, 100
1716  br i1 %c1, label %if.true, label %if.false
1717if.true:
1718  br label %end
1719if.false:
1720  %call = call i32 @ret100()
1721  br label %end
1722end:
1723  %phi = phi i32 [ %V, %if.true ], [ %call, %if.false ]
1724  %c2 = icmp sge i32 %phi, 100
1725  ret i1 %c2
1726}
1727
1728
1729define i32 @func(i1 %c) {
1730; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1731; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@func
1732; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] {
1733; IS__TUNIT_OPM-NEXT:    [[RET:%.*]] = select i1 [[C]], i32 0, i32 1
1734; IS__TUNIT_OPM-NEXT:    ret i32 [[RET]]
1735;
1736; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1737; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@func
1738; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1739; IS__TUNIT_NPM-NEXT:    [[RET:%.*]] = select i1 [[C]], i32 0, i32 1
1740; IS__TUNIT_NPM-NEXT:    ret i32 [[RET]]
1741;
1742; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1743; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@func
1744; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] {
1745; IS__CGSCC_OPM-NEXT:    [[RET:%.*]] = select i1 [[C]], i32 0, i32 1
1746; IS__CGSCC_OPM-NEXT:    ret i32 [[RET]]
1747;
1748; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1749; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@func
1750; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1751; IS__CGSCC_NPM-NEXT:    [[RET:%.*]] = select i1 [[C]], i32 0, i32 1
1752; IS__CGSCC_NPM-NEXT:    ret i32 [[RET]]
1753;
1754  %ret = select i1 %c, i32 0, i32 1
1755  ret i32 %ret
1756}
1757
1758define i32 @simplify_callsite_argument(i1 %d) {
1759; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1760; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@simplify_callsite_argument
1761; IS__TUNIT_OPM-SAME: (i1 [[D:%.*]]) #[[ATTR2]] {
1762; IS__TUNIT_OPM-NEXT:    [[C:%.*]] = select i1 [[D]], i1 true, i1 false
1763; IS__TUNIT_OPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1764; IS__TUNIT_OPM:       t:
1765; IS__TUNIT_OPM-NEXT:    [[RET1:%.*]] = call i32 @func(i1 noundef [[C]]) #[[ATTR2]], !range [[RNG3]]
1766; IS__TUNIT_OPM-NEXT:    ret i32 [[RET1]]
1767; IS__TUNIT_OPM:       f:
1768; IS__TUNIT_OPM-NEXT:    [[RET2:%.*]] = call i32 @func(i1 noundef false) #[[ATTR2]], !range [[RNG3]]
1769; IS__TUNIT_OPM-NEXT:    ret i32 [[RET2]]
1770;
1771; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1772; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@simplify_callsite_argument
1773; IS__TUNIT_NPM-SAME: (i1 [[D:%.*]]) #[[ATTR1]] {
1774; IS__TUNIT_NPM-NEXT:    [[C:%.*]] = select i1 [[D]], i1 true, i1 false
1775; IS__TUNIT_NPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1776; IS__TUNIT_NPM:       t:
1777; IS__TUNIT_NPM-NEXT:    [[RET1:%.*]] = call i32 @func(i1 noundef true) #[[ATTR1]], !range [[RNG4]]
1778; IS__TUNIT_NPM-NEXT:    ret i32 [[RET1]]
1779; IS__TUNIT_NPM:       f:
1780; IS__TUNIT_NPM-NEXT:    [[RET2:%.*]] = call i32 @func(i1 noundef false) #[[ATTR1]], !range [[RNG4]]
1781; IS__TUNIT_NPM-NEXT:    ret i32 [[RET2]]
1782;
1783; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1784; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@simplify_callsite_argument
1785; IS__CGSCC_OPM-SAME: (i1 [[D:%.*]]) #[[ATTR2]] {
1786; IS__CGSCC_OPM-NEXT:    [[C:%.*]] = select i1 [[D]], i1 true, i1 false
1787; IS__CGSCC_OPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1788; IS__CGSCC_OPM:       t:
1789; IS__CGSCC_OPM-NEXT:    [[RET1:%.*]] = call i32 @func(i1 noundef [[C]]) #[[ATTR5]], !range [[RNG4]]
1790; IS__CGSCC_OPM-NEXT:    ret i32 [[RET1]]
1791; IS__CGSCC_OPM:       f:
1792; IS__CGSCC_OPM-NEXT:    [[RET2:%.*]] = call i32 @func(i1 noundef false) #[[ATTR5]], !range [[RNG4]]
1793; IS__CGSCC_OPM-NEXT:    ret i32 [[RET2]]
1794;
1795; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1796; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@simplify_callsite_argument
1797; IS__CGSCC_NPM-SAME: (i1 [[D:%.*]]) #[[ATTR1]] {
1798; IS__CGSCC_NPM-NEXT:    [[C:%.*]] = select i1 [[D]], i1 true, i1 false
1799; IS__CGSCC_NPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
1800; IS__CGSCC_NPM:       t:
1801; IS__CGSCC_NPM-NEXT:    [[RET1:%.*]] = call i32 @func(i1 noundef true) #[[ATTR3]], !range [[RNG4]]
1802; IS__CGSCC_NPM-NEXT:    ret i32 [[RET1]]
1803; IS__CGSCC_NPM:       f:
1804; IS__CGSCC_NPM-NEXT:    [[RET2:%.*]] = call i32 @func(i1 noundef false) #[[ATTR3]], !range [[RNG4]]
1805; IS__CGSCC_NPM-NEXT:    ret i32 [[RET2]]
1806;
1807  %c = select i1 %d, i1 true, i1 false
1808  br i1 %c, label %t, label %f
1809t:
1810  %ret1 = call i32 @func(i1 %c)
1811  ret i32 %ret1
1812f:
1813  %ret2 = call i32 @func(i1 false)
1814  ret i32 %ret2
1815}
1816
1817define internal i32 @less_than_65536(i32 %arg) {
1818; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1819; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@less_than_65536
1820; IS__TUNIT_OPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {
1821; IS__TUNIT_OPM-NEXT:    [[SHRINKED:%.*]] = udiv i32 [[ARG]], 65536
1822; IS__TUNIT_OPM-NEXT:    ret i32 [[SHRINKED]]
1823;
1824; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1825; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@less_than_65536
1826; IS__TUNIT_NPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
1827; IS__TUNIT_NPM-NEXT:    [[SHRINKED:%.*]] = udiv i32 [[ARG]], 65536
1828; IS__TUNIT_NPM-NEXT:    ret i32 [[SHRINKED]]
1829;
1830; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1831; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@less_than_65536
1832; IS__CGSCC_OPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {
1833; IS__CGSCC_OPM-NEXT:    [[SHRINKED:%.*]] = udiv i32 [[ARG]], 65536
1834; IS__CGSCC_OPM-NEXT:    ret i32 [[SHRINKED]]
1835;
1836; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1837; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@less_than_65536
1838; IS__CGSCC_NPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
1839; IS__CGSCC_NPM-NEXT:    [[SHRINKED:%.*]] = udiv i32 [[ARG]], 65536
1840; IS__CGSCC_NPM-NEXT:    ret i32 [[SHRINKED]]
1841;
1842  %shrinked = udiv i32 %arg, 65536
1843  ret i32 %shrinked
1844}
1845
1846define internal i1 @is_less_than_65536(i32 %arg) {
1847; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1848; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@is_less_than_65536
1849; IS__TUNIT_OPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {
1850; IS__TUNIT_OPM-NEXT:    [[CMP:%.*]] = icmp ult i32 [[ARG]], 65536
1851; IS__TUNIT_OPM-NEXT:    ret i1 [[CMP]]
1852;
1853; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1854; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@is_less_than_65536
1855; IS__TUNIT_NPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
1856; IS__TUNIT_NPM-NEXT:    [[CMP:%.*]] = icmp ult i32 [[ARG]], 65536
1857; IS__TUNIT_NPM-NEXT:    ret i1 [[CMP]]
1858;
1859; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1860; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@is_less_than_65536
1861; IS__CGSCC_OPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {
1862; IS__CGSCC_OPM-NEXT:    [[CMP:%.*]] = icmp ult i32 [[ARG]], 65536
1863; IS__CGSCC_OPM-NEXT:    ret i1 [[CMP]]
1864;
1865; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1866; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@is_less_than_65536
1867; IS__CGSCC_NPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
1868; IS__CGSCC_NPM-NEXT:    [[CMP:%.*]] = icmp ult i32 [[ARG]], 65536
1869; IS__CGSCC_NPM-NEXT:    ret i1 [[CMP]]
1870;
1871  %cmp = icmp ult i32 %arg, 65536
1872  ret i1 %cmp
1873}
1874
1875; FIXME: returned value can be simplified to i1 true
1876define i1 @check_divided_range(i32 %arg) {
1877; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1878; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@check_divided_range
1879; IS__TUNIT_OPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {
1880; IS__TUNIT_OPM-NEXT:    [[CSRET1:%.*]] = call i32 @less_than_65536(i32 noundef 0) #[[ATTR2]]
1881; IS__TUNIT_OPM-NEXT:    [[CSRET2:%.*]] = call i32 @less_than_65536(i32 [[ARG]]) #[[ATTR2]]
1882; IS__TUNIT_OPM-NEXT:    [[TRUE1:%.*]] = call i1 @is_less_than_65536(i32 [[CSRET1]]) #[[ATTR2]]
1883; IS__TUNIT_OPM-NEXT:    [[TRUE2:%.*]] = call i1 @is_less_than_65536(i32 [[CSRET2]]) #[[ATTR2]]
1884; IS__TUNIT_OPM-NEXT:    [[RET:%.*]] = and i1 [[TRUE1]], [[TRUE2]]
1885; IS__TUNIT_OPM-NEXT:    ret i1 [[RET]]
1886;
1887; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1888; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@check_divided_range
1889; IS__TUNIT_NPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
1890; IS__TUNIT_NPM-NEXT:    [[CSRET1:%.*]] = call i32 @less_than_65536(i32 noundef 0) #[[ATTR1]], !range [[RNG6:![0-9]+]]
1891; IS__TUNIT_NPM-NEXT:    [[CSRET2:%.*]] = call i32 @less_than_65536(i32 [[ARG]]) #[[ATTR1]], !range [[RNG6]]
1892; IS__TUNIT_NPM-NEXT:    [[TRUE1:%.*]] = call i1 @is_less_than_65536(i32 [[CSRET1]]) #[[ATTR1]]
1893; IS__TUNIT_NPM-NEXT:    [[TRUE2:%.*]] = call i1 @is_less_than_65536(i32 [[CSRET2]]) #[[ATTR1]]
1894; IS__TUNIT_NPM-NEXT:    [[RET:%.*]] = and i1 [[TRUE1]], [[TRUE2]]
1895; IS__TUNIT_NPM-NEXT:    ret i1 [[RET]]
1896;
1897; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1898; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@check_divided_range
1899; IS__CGSCC_OPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {
1900; IS__CGSCC_OPM-NEXT:    [[CSRET1:%.*]] = call i32 @less_than_65536(i32 noundef 0) #[[ATTR5]]
1901; IS__CGSCC_OPM-NEXT:    [[CSRET2:%.*]] = call i32 @less_than_65536(i32 [[ARG]]) #[[ATTR5]]
1902; IS__CGSCC_OPM-NEXT:    [[TRUE1:%.*]] = call i1 @is_less_than_65536(i32 [[CSRET1]]) #[[ATTR5]]
1903; IS__CGSCC_OPM-NEXT:    [[TRUE2:%.*]] = call i1 @is_less_than_65536(i32 [[CSRET2]]) #[[ATTR5]]
1904; IS__CGSCC_OPM-NEXT:    [[RET:%.*]] = and i1 [[TRUE1]], [[TRUE2]]
1905; IS__CGSCC_OPM-NEXT:    ret i1 [[RET]]
1906;
1907; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1908; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@check_divided_range
1909; IS__CGSCC_NPM-SAME: (i32 [[ARG:%.*]]) #[[ATTR1]] {
1910; IS__CGSCC_NPM-NEXT:    [[CSRET1:%.*]] = call i32 @less_than_65536(i32 noundef 0) #[[ATTR3]], !range [[RNG6:![0-9]+]]
1911; IS__CGSCC_NPM-NEXT:    [[CSRET2:%.*]] = call i32 @less_than_65536(i32 [[ARG]]) #[[ATTR3]], !range [[RNG6]]
1912; IS__CGSCC_NPM-NEXT:    [[TRUE1:%.*]] = call i1 @is_less_than_65536(i32 [[CSRET1]]) #[[ATTR3]]
1913; IS__CGSCC_NPM-NEXT:    [[TRUE2:%.*]] = call i1 @is_less_than_65536(i32 [[CSRET2]]) #[[ATTR3]]
1914; IS__CGSCC_NPM-NEXT:    [[RET:%.*]] = and i1 [[TRUE1]], [[TRUE2]]
1915; IS__CGSCC_NPM-NEXT:    ret i1 [[RET]]
1916;
1917  %csret1 = call i32 @less_than_65536(i32 0)
1918  %csret2 = call i32 @less_than_65536(i32 %arg)
1919  %true1 = call i1 @is_less_than_65536(i32 %csret1)
1920  %true2 = call i1 @is_less_than_65536(i32 %csret2)
1921  %ret = and i1 %true1, %true2
1922  ret i1 %ret
1923}
1924
1925define internal i32 @cast_and_return(i1 %c) {
1926; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1927; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@cast_and_return
1928; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] {
1929; IS__TUNIT_OPM-NEXT:    [[RET:%.*]] = zext i1 [[C]] to i32
1930; IS__TUNIT_OPM-NEXT:    ret i32 [[RET]]
1931;
1932; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1933; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@cast_and_return
1934; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] {
1935; IS__CGSCC_OPM-NEXT:    ret i32 undef
1936;
1937; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1938; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@cast_and_return
1939; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1940; IS__CGSCC_NPM-NEXT:    ret i32 undef
1941;
1942  %ret = zext i1 %c to i32
1943  ret i32 %ret
1944}
1945
1946define internal i1 @is_less_than_3(i32 %c) {
1947; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1948; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@is_less_than_3
1949; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] {
1950; IS__TUNIT_OPM-NEXT:    [[CMP:%.*]] = icmp slt i32 [[C]], 3
1951; IS__TUNIT_OPM-NEXT:    ret i1 [[CMP]]
1952;
1953; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1954; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@is_less_than_3
1955; IS__CGSCC_OPM-SAME: () #[[ATTR2]] {
1956; IS__CGSCC_OPM-NEXT:    ret i1 undef
1957;
1958; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1959; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@is_less_than_3
1960; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
1961; IS__CGSCC_NPM-NEXT:    ret i1 undef
1962;
1963  %cmp = icmp slt i32 %c, 3
1964  ret i1 %cmp
1965}
1966
1967; FIXME: returned value can be simplified to i1 true
1968define i1 @check_casted_range(i1 %c) {
1969; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
1970; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@check_casted_range
1971; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] {
1972; IS__TUNIT_OPM-NEXT:    [[CSRET1:%.*]] = call i32 @cast_and_return(i1 noundef true) #[[ATTR2]]
1973; IS__TUNIT_OPM-NEXT:    [[CSRET2:%.*]] = call i32 @cast_and_return(i1 [[C]]) #[[ATTR2]]
1974; IS__TUNIT_OPM-NEXT:    [[ADD:%.*]] = add i32 [[CSRET1]], [[CSRET2]]
1975; IS__TUNIT_OPM-NEXT:    [[RET:%.*]] = call i1 @is_less_than_3(i32 [[ADD]]) #[[ATTR2]]
1976; IS__TUNIT_OPM-NEXT:    ret i1 [[RET]]
1977;
1978; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
1979; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@check_casted_range
1980; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1981; IS__TUNIT_NPM-NEXT:    ret i1 true
1982;
1983; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1984; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@check_casted_range
1985; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR2]] {
1986; IS__CGSCC_OPM-NEXT:    ret i1 true
1987;
1988; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1989; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@check_casted_range
1990; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
1991; IS__CGSCC_NPM-NEXT:    ret i1 true
1992;
1993  %csret1 = call i32 @cast_and_return(i1 true)
1994  %csret2 = call i32 @cast_and_return(i1 %c)
1995  %add = add i32 %csret1, %csret2
1996  %ret = call i1 @is_less_than_3(i32 %add)
1997  ret i1 %ret
1998}
1999
2000define internal i32 @less_than_100_1(i32 %c) {
2001; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2002; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@less_than_100_1
2003; IS__CGSCC_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] {
2004; IS__CGSCC_OPM-NEXT:    switch i32 [[C]], label [[OTHERWISE:%.*]] [
2005; IS__CGSCC_OPM-NEXT:    i32 0, label [[ONZERO:%.*]]
2006; IS__CGSCC_OPM-NEXT:    i32 1, label [[ONONE:%.*]]
2007; IS__CGSCC_OPM-NEXT:    i32 2, label [[ONTWO:%.*]]
2008; IS__CGSCC_OPM-NEXT:    i32 3, label [[ONTHREE:%.*]]
2009; IS__CGSCC_OPM-NEXT:    i32 4, label [[ONFOUR:%.*]]
2010; IS__CGSCC_OPM-NEXT:    i32 5, label [[ONFIVE:%.*]]
2011; IS__CGSCC_OPM-NEXT:    i32 6, label [[ONSIX:%.*]]
2012; IS__CGSCC_OPM-NEXT:    ]
2013; IS__CGSCC_OPM:       onzero:
2014; IS__CGSCC_OPM-NEXT:    ret i32 undef
2015; IS__CGSCC_OPM:       onone:
2016; IS__CGSCC_OPM-NEXT:    ret i32 undef
2017; IS__CGSCC_OPM:       ontwo:
2018; IS__CGSCC_OPM-NEXT:    ret i32 undef
2019; IS__CGSCC_OPM:       onthree:
2020; IS__CGSCC_OPM-NEXT:    ret i32 undef
2021; IS__CGSCC_OPM:       onfour:
2022; IS__CGSCC_OPM-NEXT:    ret i32 undef
2023; IS__CGSCC_OPM:       onfive:
2024; IS__CGSCC_OPM-NEXT:    ret i32 undef
2025; IS__CGSCC_OPM:       onsix:
2026; IS__CGSCC_OPM-NEXT:    ret i32 undef
2027; IS__CGSCC_OPM:       otherwise:
2028; IS__CGSCC_OPM-NEXT:    ret i32 undef
2029;
2030; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2031; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@less_than_100_1
2032; IS__CGSCC_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR1]] {
2033; IS__CGSCC_NPM-NEXT:    switch i32 [[C]], label [[OTHERWISE:%.*]] [
2034; IS__CGSCC_NPM-NEXT:    i32 0, label [[ONZERO:%.*]]
2035; IS__CGSCC_NPM-NEXT:    i32 1, label [[ONONE:%.*]]
2036; IS__CGSCC_NPM-NEXT:    i32 2, label [[ONTWO:%.*]]
2037; IS__CGSCC_NPM-NEXT:    i32 3, label [[ONTHREE:%.*]]
2038; IS__CGSCC_NPM-NEXT:    i32 4, label [[ONFOUR:%.*]]
2039; IS__CGSCC_NPM-NEXT:    i32 5, label [[ONFIVE:%.*]]
2040; IS__CGSCC_NPM-NEXT:    i32 6, label [[ONSIX:%.*]]
2041; IS__CGSCC_NPM-NEXT:    ]
2042; IS__CGSCC_NPM:       onzero:
2043; IS__CGSCC_NPM-NEXT:    ret i32 undef
2044; IS__CGSCC_NPM:       onone:
2045; IS__CGSCC_NPM-NEXT:    ret i32 undef
2046; IS__CGSCC_NPM:       ontwo:
2047; IS__CGSCC_NPM-NEXT:    ret i32 undef
2048; IS__CGSCC_NPM:       onthree:
2049; IS__CGSCC_NPM-NEXT:    ret i32 undef
2050; IS__CGSCC_NPM:       onfour:
2051; IS__CGSCC_NPM-NEXT:    ret i32 undef
2052; IS__CGSCC_NPM:       onfive:
2053; IS__CGSCC_NPM-NEXT:    ret i32 undef
2054; IS__CGSCC_NPM:       onsix:
2055; IS__CGSCC_NPM-NEXT:    ret i32 undef
2056; IS__CGSCC_NPM:       otherwise:
2057; IS__CGSCC_NPM-NEXT:    ret i32 undef
2058;
2059  switch i32 %c, label %otherwise [ i32 0, label %onzero
2060  i32 1, label %onone
2061  i32 2, label %ontwo
2062  i32 3, label %onthree
2063  i32 4, label %onfour
2064  i32 5, label %onfive
2065  i32 6, label %onsix]
2066onzero:
2067  ret i32 0
2068onone:
2069  ret i32 1
2070ontwo:
2071  ret i32 2
2072onthree:
2073  ret i32 3
2074onfour:
2075  ret i32 4
2076onfive:
2077  ret i32 5
2078onsix:
2079  ret i32 6
2080otherwise:
2081  ret i32 99
2082}
2083
2084define internal i1 @is_less_than_100_1(i32 %c) {
2085; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2086; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@is_less_than_100_1
2087; IS__CGSCC_OPM-SAME: () #[[ATTR2]] {
2088; IS__CGSCC_OPM-NEXT:    ret i1 undef
2089;
2090; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2091; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@is_less_than_100_1
2092; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
2093; IS__CGSCC_NPM-NEXT:    ret i1 undef
2094;
2095  %cmp = icmp slt i32 %c, 100
2096  ret i1 %cmp
2097}
2098
2099define i1 @propagate_range1(i32 %c){
2100; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
2101; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@propagate_range1
2102; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] {
2103; IS__TUNIT_OPM-NEXT:    ret i1 true
2104;
2105; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
2106; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@propagate_range1
2107; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR1]] {
2108; IS__TUNIT_NPM-NEXT:    ret i1 true
2109;
2110; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2111; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@propagate_range1
2112; IS__CGSCC_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] {
2113; IS__CGSCC_OPM-NEXT:    ret i1 true
2114;
2115; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2116; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@propagate_range1
2117; IS__CGSCC_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR1]] {
2118; IS__CGSCC_NPM-NEXT:    ret i1 true
2119;
2120  %csret = call i32 @less_than_100_1(i32 %c)
2121  %true = call i1 @is_less_than_100_1(i32 %csret)
2122  ret i1 %true
2123}
2124
2125define internal i32 @less_than_100_2(i32 %c) {
2126; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
2127; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@less_than_100_2
2128; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] {
2129; IS__TUNIT_OPM-NEXT:    switch i32 [[C]], label [[OTHERWISE:%.*]] [
2130; IS__TUNIT_OPM-NEXT:    i32 0, label [[ONZERO:%.*]]
2131; IS__TUNIT_OPM-NEXT:    i32 1, label [[ONONE:%.*]]
2132; IS__TUNIT_OPM-NEXT:    i32 2, label [[ONTWO:%.*]]
2133; IS__TUNIT_OPM-NEXT:    i32 3, label [[ONTHREE:%.*]]
2134; IS__TUNIT_OPM-NEXT:    i32 4, label [[ONFOUR:%.*]]
2135; IS__TUNIT_OPM-NEXT:    i32 5, label [[ONFIVE:%.*]]
2136; IS__TUNIT_OPM-NEXT:    i32 6, label [[ONSIX:%.*]]
2137; IS__TUNIT_OPM-NEXT:    ]
2138; IS__TUNIT_OPM:       onzero:
2139; IS__TUNIT_OPM-NEXT:    ret i32 0
2140; IS__TUNIT_OPM:       onone:
2141; IS__TUNIT_OPM-NEXT:    ret i32 1
2142; IS__TUNIT_OPM:       ontwo:
2143; IS__TUNIT_OPM-NEXT:    ret i32 2
2144; IS__TUNIT_OPM:       onthree:
2145; IS__TUNIT_OPM-NEXT:    ret i32 3
2146; IS__TUNIT_OPM:       onfour:
2147; IS__TUNIT_OPM-NEXT:    ret i32 4
2148; IS__TUNIT_OPM:       onfive:
2149; IS__TUNIT_OPM-NEXT:    ret i32 5
2150; IS__TUNIT_OPM:       onsix:
2151; IS__TUNIT_OPM-NEXT:    ret i32 6
2152; IS__TUNIT_OPM:       otherwise:
2153; IS__TUNIT_OPM-NEXT:    ret i32 99
2154;
2155; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
2156; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@less_than_100_2
2157; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR1]] {
2158; IS__TUNIT_NPM-NEXT:    switch i32 [[C]], label [[OTHERWISE:%.*]] [
2159; IS__TUNIT_NPM-NEXT:    i32 0, label [[ONZERO:%.*]]
2160; IS__TUNIT_NPM-NEXT:    i32 1, label [[ONONE:%.*]]
2161; IS__TUNIT_NPM-NEXT:    i32 2, label [[ONTWO:%.*]]
2162; IS__TUNIT_NPM-NEXT:    i32 3, label [[ONTHREE:%.*]]
2163; IS__TUNIT_NPM-NEXT:    i32 4, label [[ONFOUR:%.*]]
2164; IS__TUNIT_NPM-NEXT:    i32 5, label [[ONFIVE:%.*]]
2165; IS__TUNIT_NPM-NEXT:    i32 6, label [[ONSIX:%.*]]
2166; IS__TUNIT_NPM-NEXT:    ]
2167; IS__TUNIT_NPM:       onzero:
2168; IS__TUNIT_NPM-NEXT:    ret i32 0
2169; IS__TUNIT_NPM:       onone:
2170; IS__TUNIT_NPM-NEXT:    ret i32 1
2171; IS__TUNIT_NPM:       ontwo:
2172; IS__TUNIT_NPM-NEXT:    ret i32 2
2173; IS__TUNIT_NPM:       onthree:
2174; IS__TUNIT_NPM-NEXT:    ret i32 3
2175; IS__TUNIT_NPM:       onfour:
2176; IS__TUNIT_NPM-NEXT:    ret i32 4
2177; IS__TUNIT_NPM:       onfive:
2178; IS__TUNIT_NPM-NEXT:    ret i32 5
2179; IS__TUNIT_NPM:       onsix:
2180; IS__TUNIT_NPM-NEXT:    ret i32 6
2181; IS__TUNIT_NPM:       otherwise:
2182; IS__TUNIT_NPM-NEXT:    ret i32 99
2183;
2184; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2185; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@less_than_100_2
2186; IS__CGSCC_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] {
2187; IS__CGSCC_OPM-NEXT:    switch i32 [[C]], label [[OTHERWISE:%.*]] [
2188; IS__CGSCC_OPM-NEXT:    i32 0, label [[ONZERO:%.*]]
2189; IS__CGSCC_OPM-NEXT:    i32 1, label [[ONONE:%.*]]
2190; IS__CGSCC_OPM-NEXT:    i32 2, label [[ONTWO:%.*]]
2191; IS__CGSCC_OPM-NEXT:    i32 3, label [[ONTHREE:%.*]]
2192; IS__CGSCC_OPM-NEXT:    i32 4, label [[ONFOUR:%.*]]
2193; IS__CGSCC_OPM-NEXT:    i32 5, label [[ONFIVE:%.*]]
2194; IS__CGSCC_OPM-NEXT:    i32 6, label [[ONSIX:%.*]]
2195; IS__CGSCC_OPM-NEXT:    ]
2196; IS__CGSCC_OPM:       onzero:
2197; IS__CGSCC_OPM-NEXT:    ret i32 0
2198; IS__CGSCC_OPM:       onone:
2199; IS__CGSCC_OPM-NEXT:    ret i32 1
2200; IS__CGSCC_OPM:       ontwo:
2201; IS__CGSCC_OPM-NEXT:    ret i32 2
2202; IS__CGSCC_OPM:       onthree:
2203; IS__CGSCC_OPM-NEXT:    ret i32 3
2204; IS__CGSCC_OPM:       onfour:
2205; IS__CGSCC_OPM-NEXT:    ret i32 4
2206; IS__CGSCC_OPM:       onfive:
2207; IS__CGSCC_OPM-NEXT:    ret i32 5
2208; IS__CGSCC_OPM:       onsix:
2209; IS__CGSCC_OPM-NEXT:    ret i32 6
2210; IS__CGSCC_OPM:       otherwise:
2211; IS__CGSCC_OPM-NEXT:    ret i32 99
2212;
2213; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2214; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@less_than_100_2
2215; IS__CGSCC_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR1]] {
2216; IS__CGSCC_NPM-NEXT:    switch i32 [[C]], label [[OTHERWISE:%.*]] [
2217; IS__CGSCC_NPM-NEXT:    i32 0, label [[ONZERO:%.*]]
2218; IS__CGSCC_NPM-NEXT:    i32 1, label [[ONONE:%.*]]
2219; IS__CGSCC_NPM-NEXT:    i32 2, label [[ONTWO:%.*]]
2220; IS__CGSCC_NPM-NEXT:    i32 3, label [[ONTHREE:%.*]]
2221; IS__CGSCC_NPM-NEXT:    i32 4, label [[ONFOUR:%.*]]
2222; IS__CGSCC_NPM-NEXT:    i32 5, label [[ONFIVE:%.*]]
2223; IS__CGSCC_NPM-NEXT:    i32 6, label [[ONSIX:%.*]]
2224; IS__CGSCC_NPM-NEXT:    ]
2225; IS__CGSCC_NPM:       onzero:
2226; IS__CGSCC_NPM-NEXT:    ret i32 0
2227; IS__CGSCC_NPM:       onone:
2228; IS__CGSCC_NPM-NEXT:    ret i32 1
2229; IS__CGSCC_NPM:       ontwo:
2230; IS__CGSCC_NPM-NEXT:    ret i32 2
2231; IS__CGSCC_NPM:       onthree:
2232; IS__CGSCC_NPM-NEXT:    ret i32 3
2233; IS__CGSCC_NPM:       onfour:
2234; IS__CGSCC_NPM-NEXT:    ret i32 4
2235; IS__CGSCC_NPM:       onfive:
2236; IS__CGSCC_NPM-NEXT:    ret i32 5
2237; IS__CGSCC_NPM:       onsix:
2238; IS__CGSCC_NPM-NEXT:    ret i32 6
2239; IS__CGSCC_NPM:       otherwise:
2240; IS__CGSCC_NPM-NEXT:    ret i32 99
2241;
2242  switch i32 %c, label %otherwise [ i32 0, label %onzero
2243  i32 1, label %onone
2244  i32 2, label %ontwo
2245  i32 3, label %onthree
2246  i32 4, label %onfour
2247  i32 5, label %onfive
2248  i32 6, label %onsix]
2249onzero:
2250  ret i32 0
2251onone:
2252  ret i32 1
2253ontwo:
2254  ret i32 2
2255onthree:
2256  ret i32 3
2257onfour:
2258  ret i32 4
2259onfive:
2260  ret i32 5
2261onsix:
2262  ret i32 6
2263otherwise:
2264  ret i32 99
2265}
2266
2267define internal i1 @is_less_than_100_2(i32 %c) {
2268; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
2269; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@is_less_than_100_2
2270; IS__TUNIT_OPM-SAME: (i32 noundef [[C:%.*]]) #[[ATTR2]] {
2271; IS__TUNIT_OPM-NEXT:    [[CMP:%.*]] = icmp slt i32 [[C]], 100
2272; IS__TUNIT_OPM-NEXT:    ret i1 [[CMP]]
2273;
2274; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
2275; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@is_less_than_100_2
2276; IS__TUNIT_NPM-SAME: (i32 noundef [[C:%.*]]) #[[ATTR1]] {
2277; IS__TUNIT_NPM-NEXT:    [[CMP:%.*]] = icmp slt i32 [[C]], 100
2278; IS__TUNIT_NPM-NEXT:    ret i1 [[CMP]]
2279;
2280; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2281; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@is_less_than_100_2
2282; IS__CGSCC_OPM-SAME: (i32 noundef [[C:%.*]]) #[[ATTR2]] {
2283; IS__CGSCC_OPM-NEXT:    ret i1 true
2284;
2285; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2286; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@is_less_than_100_2
2287; IS__CGSCC_NPM-SAME: (i32 noundef [[C:%.*]]) #[[ATTR1]] {
2288; IS__CGSCC_NPM-NEXT:    ret i1 true
2289;
2290  %cmp = icmp slt i32 %c, 100
2291  ret i1 %cmp
2292}
2293
2294; FIXME: returned value can be simplified to i1 true
2295define i1 @propagate_range2(i32 %c) {
2296; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
2297; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@propagate_range2
2298; IS__TUNIT_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] {
2299; IS__TUNIT_OPM-NEXT:    [[CSRET1:%.*]] = call noundef i32 @less_than_100_2(i32 noundef 0) #[[ATTR2]], !range [[RNG5:![0-9]+]]
2300; IS__TUNIT_OPM-NEXT:    [[TRUE1:%.*]] = call i1 @is_less_than_100_2(i32 noundef [[CSRET1]]) #[[ATTR2]]
2301; IS__TUNIT_OPM-NEXT:    [[CSRET2:%.*]] = call noundef i32 @less_than_100_2(i32 [[C]]) #[[ATTR2]], !range [[RNG5]]
2302; IS__TUNIT_OPM-NEXT:    [[TRUE2:%.*]] = call i1 @is_less_than_100_2(i32 noundef [[CSRET2]]) #[[ATTR2]]
2303; IS__TUNIT_OPM-NEXT:    [[TRUE:%.*]] = and i1 [[TRUE1]], [[TRUE2]]
2304; IS__TUNIT_OPM-NEXT:    ret i1 [[TRUE]]
2305;
2306; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
2307; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@propagate_range2
2308; IS__TUNIT_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR1]] {
2309; IS__TUNIT_NPM-NEXT:    [[CSRET1:%.*]] = call noundef i32 @less_than_100_2(i32 noundef 0) #[[ATTR1]], !range [[RNG7:![0-9]+]]
2310; IS__TUNIT_NPM-NEXT:    [[TRUE1:%.*]] = call i1 @is_less_than_100_2(i32 noundef [[CSRET1]]) #[[ATTR1]]
2311; IS__TUNIT_NPM-NEXT:    [[CSRET2:%.*]] = call noundef i32 @less_than_100_2(i32 [[C]]) #[[ATTR1]], !range [[RNG7]]
2312; IS__TUNIT_NPM-NEXT:    [[TRUE2:%.*]] = call i1 @is_less_than_100_2(i32 noundef [[CSRET2]]) #[[ATTR1]]
2313; IS__TUNIT_NPM-NEXT:    [[TRUE:%.*]] = and i1 [[TRUE1]], [[TRUE2]]
2314; IS__TUNIT_NPM-NEXT:    ret i1 [[TRUE]]
2315;
2316; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2317; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@propagate_range2
2318; IS__CGSCC_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR2]] {
2319; IS__CGSCC_OPM-NEXT:    ret i1 true
2320;
2321; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2322; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@propagate_range2
2323; IS__CGSCC_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR1]] {
2324; IS__CGSCC_NPM-NEXT:    ret i1 true
2325;
2326  %csret1 = call i32 @less_than_100_2(i32 0)
2327  %true1 = call i1 @is_less_than_100_2(i32 %csret1)
2328  %csret2 = call i32 @less_than_100_2(i32 %c)
2329  %true2 = call i1 @is_less_than_100_2(i32 %csret2)
2330  %true = and i1 %true1, %true2
2331  ret i1 %true
2332}
2333
2334define internal i1 @non_zero(i8 %v) {
2335; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
2336; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@non_zero
2337; IS__TUNIT_OPM-SAME: (i8 [[V:%.*]]) #[[ATTR2]] {
2338; IS__TUNIT_OPM-NEXT:    [[R:%.*]] = icmp ne i8 [[V]], 0
2339; IS__TUNIT_OPM-NEXT:    ret i1 [[R]]
2340;
2341; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2342; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@non_zero
2343; IS__CGSCC_OPM-SAME: (i8 [[V:%.*]]) #[[ATTR2]] {
2344; IS__CGSCC_OPM-NEXT:    [[R:%.*]] = icmp ne i8 [[V]], 0
2345; IS__CGSCC_OPM-NEXT:    ret i1 [[R]]
2346;
2347; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2348; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@non_zero
2349; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
2350; IS__CGSCC_NPM-NEXT:    ret i1 undef
2351;
2352  %r = icmp ne i8 %v, 0
2353  ret i1 %r
2354}
2355
2356; Avoid range metadata for %l below
2357define i1 @context(i8* %p) {
2358; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn
2359; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@context
2360; IS__TUNIT_OPM-SAME: (i8* nocapture nofree noundef nonnull readonly dereferenceable(1) [[P:%.*]]) #[[ATTR0]] {
2361; IS__TUNIT_OPM-NEXT:    [[L:%.*]] = load i8, i8* [[P]], align 1
2362; IS__TUNIT_OPM-NEXT:    [[C:%.*]] = icmp slt i8 0, [[L]]
2363; IS__TUNIT_OPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
2364; IS__TUNIT_OPM:       t:
2365; IS__TUNIT_OPM-NEXT:    [[R:%.*]] = call i1 @non_zero(i8 [[L]]) #[[ATTR2]]
2366; IS__TUNIT_OPM-NEXT:    ret i1 [[R]]
2367; IS__TUNIT_OPM:       f:
2368; IS__TUNIT_OPM-NEXT:    ret i1 false
2369;
2370; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn
2371; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@context
2372; IS__TUNIT_NPM-SAME: (i8* nocapture nofree noundef nonnull readonly dereferenceable(1) [[P:%.*]]) #[[ATTR0]] {
2373; IS__TUNIT_NPM-NEXT:    [[L:%.*]] = load i8, i8* [[P]], align 1
2374; IS__TUNIT_NPM-NEXT:    [[C:%.*]] = icmp slt i8 0, [[L]]
2375; IS__TUNIT_NPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
2376; IS__TUNIT_NPM:       t:
2377; IS__TUNIT_NPM-NEXT:    ret i1 true
2378; IS__TUNIT_NPM:       f:
2379; IS__TUNIT_NPM-NEXT:    ret i1 false
2380;
2381; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn
2382; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@context
2383; IS__CGSCC_OPM-SAME: (i8* nocapture nofree noundef nonnull readonly dereferenceable(1) [[P:%.*]]) #[[ATTR0]] {
2384; IS__CGSCC_OPM-NEXT:    [[L:%.*]] = load i8, i8* [[P]], align 1
2385; IS__CGSCC_OPM-NEXT:    [[C:%.*]] = icmp slt i8 0, [[L]]
2386; IS__CGSCC_OPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
2387; IS__CGSCC_OPM:       t:
2388; IS__CGSCC_OPM-NEXT:    [[R:%.*]] = call i1 @non_zero(i8 [[L]]) #[[ATTR5]]
2389; IS__CGSCC_OPM-NEXT:    ret i1 [[R]]
2390; IS__CGSCC_OPM:       f:
2391; IS__CGSCC_OPM-NEXT:    ret i1 false
2392;
2393; IS__CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn
2394; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@context
2395; IS__CGSCC_NPM-SAME: (i8* nocapture nofree noundef nonnull readonly dereferenceable(1) [[P:%.*]]) #[[ATTR0]] {
2396; IS__CGSCC_NPM-NEXT:    [[L:%.*]] = load i8, i8* [[P]], align 1
2397; IS__CGSCC_NPM-NEXT:    [[C:%.*]] = icmp slt i8 0, [[L]]
2398; IS__CGSCC_NPM-NEXT:    br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
2399; IS__CGSCC_NPM:       t:
2400; IS__CGSCC_NPM-NEXT:    ret i1 true
2401; IS__CGSCC_NPM:       f:
2402; IS__CGSCC_NPM-NEXT:    ret i1 false
2403;
2404  %l = load i8, i8* %p
2405  %c = icmp slt i8 0, %l
2406  br i1 %c, label %t, label %f
2407t:
2408  %r = call i1 @non_zero(i8 %l)
2409  ret i1 %r
2410f:
2411  ret i1 false
2412}
2413
2414
2415define void @spam(i32* %arg, i32* %arg1) {
2416; CHECK-LABEL: define {{[^@]+}}@spam
2417; CHECK-SAME: (i32* nocapture noundef nonnull readonly align 8 dereferenceable(4) [[ARG:%.*]], i32* nocapture nofree readnone [[ARG1:%.*]]) {
2418; CHECK-NEXT:  bb:
2419; CHECK-NEXT:    [[TMP:%.*]] = load i32, i32* [[ARG]], align 8
2420; CHECK-NEXT:    [[TMP2:%.*]] = icmp ult i32 [[TMP]], 4
2421; CHECK-NEXT:    br i1 [[TMP2]], label [[BB3:%.*]], label [[BB4:%.*]]
2422; CHECK:       bb3:
2423; CHECK-NEXT:    call fastcc void @wobble(i32 signext [[TMP]])
2424; CHECK-NEXT:    br label [[BB5:%.*]]
2425; CHECK:       bb4:
2426; CHECK-NEXT:    call void @ham(i32 [[TMP]])
2427; CHECK-NEXT:    br label [[BB5]]
2428; CHECK:       bb5:
2429; CHECK-NEXT:    ret void
2430;
2431bb:
2432  %tmp = load i32, i32* %arg, align 8
2433  %tmp2 = icmp ult i32 %tmp, 4
2434  br i1 %tmp2, label %bb3, label %bb4
2435
2436bb3:                                              ; preds = %bb
2437  call fastcc void @wobble(i32 signext %tmp)
2438  br label %bb5
2439
2440bb4:                                              ; preds = %bb
2441  call void @ham(i32 %tmp)
2442  br label %bb5
2443
2444bb5:                                              ; preds = %bb4, %bb3
2445  ret void
2446}
2447
2448define internal fastcc void @wobble(i32 signext %arg) {
2449; CHECK-LABEL: define {{[^@]+}}@wobble
2450; CHECK-SAME: (i32 signext [[ARG:%.*]]) {
2451; CHECK-NEXT:  bb:
2452; CHECK-NEXT:    [[TMP:%.*]] = icmp ult i32 [[ARG]], 2
2453; CHECK-NEXT:    br i1 [[TMP]], label [[BB1:%.*]], label [[BB2:%.*]]
2454; CHECK:       bb1:
2455; CHECK-NEXT:    call void @barney(i32 noundef signext 32, i32 noundef signext 0)
2456; CHECK-NEXT:    br label [[BB3:%.*]]
2457; CHECK:       bb2:
2458; CHECK-NEXT:    br label [[BB3]]
2459; CHECK:       bb3:
2460; CHECK-NEXT:    ret void
2461;
2462bb:
2463  %tmp = icmp ult i32 %arg, 2
2464  br i1 %tmp, label %bb1, label %bb2
2465
2466bb1:                                              ; preds = %bb
2467  call void @barney(i32 signext 32, i32 signext 0)
2468  br label %bb3
2469
2470bb2:                                              ; preds = %bb
2471  br label %bb3
2472
2473bb3:                                              ; preds = %bb2, %bb1
2474  ret void
2475}
2476
2477declare void @ham(i32)
2478
2479declare void @barney(i32 signext, i32 signext)
2480
2481
2482!0 = !{i32 0, i32 10}
2483!1 = !{i32 10, i32 100}
2484;.
2485; IS__TUNIT_OPM: attributes #[[ATTR0]] = { argmemonly nofree nosync nounwind readonly willreturn }
2486; IS__TUNIT_OPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone }
2487; IS__TUNIT_OPM: attributes #[[ATTR2]] = { nofree nosync nounwind readnone willreturn }
2488; IS__TUNIT_OPM: attributes #[[ATTR3]] = { nofree nosync nounwind readonly willreturn }
2489;.
2490; IS__TUNIT_NPM: attributes #[[ATTR0]] = { argmemonly nofree nosync nounwind readonly willreturn }
2491; IS__TUNIT_NPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
2492; IS__TUNIT_NPM: attributes #[[ATTR2]] = { nofree nosync nounwind readonly willreturn }
2493;.
2494; IS__CGSCC_OPM: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind readonly willreturn }
2495; IS__CGSCC_OPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone }
2496; IS__CGSCC_OPM: attributes #[[ATTR2]] = { nofree norecurse nosync nounwind readnone willreturn }
2497; IS__CGSCC_OPM: attributes #[[ATTR3]] = { readonly willreturn }
2498; IS__CGSCC_OPM: attributes #[[ATTR4]] = { nounwind readnone }
2499; IS__CGSCC_OPM: attributes #[[ATTR5]] = { readnone willreturn }
2500;.
2501; IS__CGSCC_NPM: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind readonly willreturn }
2502; IS__CGSCC_NPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
2503; IS__CGSCC_NPM: attributes #[[ATTR2]] = { readonly willreturn }
2504; IS__CGSCC_NPM: attributes #[[ATTR3]] = { readnone willreturn }
2505;.
2506; IS__TUNIT_OPM: [[RNG0]] = !{i32 0, i32 10}
2507; IS__TUNIT_OPM: [[RNG1]] = !{i32 10, i32 100}
2508; IS__TUNIT_OPM: [[RNG2]] = !{i32 200, i32 1091}
2509; IS__TUNIT_OPM: [[RNG3]] = !{i32 0, i32 2}
2510; IS__TUNIT_OPM: [[RNG4]] = !{i32 1, i32 3}
2511; IS__TUNIT_OPM: [[RNG5]] = !{i32 0, i32 100}
2512;.
2513; IS__TUNIT_NPM: [[RNG0]] = !{i32 0, i32 10}
2514; IS__TUNIT_NPM: [[RNG1]] = !{i32 10, i32 100}
2515; IS__TUNIT_NPM: [[RNG2]] = !{i32 200, i32 1091}
2516; IS__TUNIT_NPM: [[RNG3]] = !{i32 1, i32 -2147483648}
2517; IS__TUNIT_NPM: [[RNG4]] = !{i32 0, i32 2}
2518; IS__TUNIT_NPM: [[RNG5]] = !{i32 1, i32 3}
2519; IS__TUNIT_NPM: [[RNG6]] = !{i32 0, i32 65536}
2520; IS__TUNIT_NPM: [[RNG7]] = !{i32 0, i32 100}
2521;.
2522; IS__CGSCC_OPM: [[RNG0]] = !{i32 0, i32 10}
2523; IS__CGSCC_OPM: [[RNG1]] = !{i32 10, i32 100}
2524; IS__CGSCC_OPM: [[RNG2]] = !{i32 200, i32 1091}
2525; IS__CGSCC_OPM: [[RNG3]] = !{i32 10, i32 21}
2526; IS__CGSCC_OPM: [[RNG4]] = !{i32 0, i32 2}
2527; IS__CGSCC_OPM: [[RNG5]] = !{i32 1, i32 3}
2528;.
2529; IS__CGSCC_NPM: [[RNG0]] = !{i32 0, i32 10}
2530; IS__CGSCC_NPM: [[RNG1]] = !{i32 10, i32 100}
2531; IS__CGSCC_NPM: [[RNG2]] = !{i32 200, i32 1091}
2532; IS__CGSCC_NPM: [[RNG3]] = !{i32 1, i32 -2147483648}
2533; IS__CGSCC_NPM: [[RNG4]] = !{i32 0, i32 2}
2534; IS__CGSCC_NPM: [[RNG5]] = !{i32 1, i32 3}
2535; IS__CGSCC_NPM: [[RNG6]] = !{i32 0, i32 65536}
2536;.
2537