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