1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals 2; RUN: opt -enable-new-pm=0 -attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=20 -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=20 -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 -enable-new-pm=0 -attributor-cgscc -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; Test for multiple potential values 8; 9; potential-test 1 10; bool iszero(int c) { return c == 0; } 11; bool potential_test1(bool c) { return iszero(c ? 1 : -1); } 12 13define internal i1 @iszero1(i32 %c) { 14; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 15; IS__CGSCC____-LABEL: define {{[^@]+}}@iszero1 16; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] { 17; IS__CGSCC____-NEXT: ret i1 undef 18; 19 %cmp = icmp eq i32 %c, 0 20 ret i1 %cmp 21} 22 23define i1 @potential_test1(i1 %c) { 24; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 25; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test1 26; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0:[0-9]+]] { 27; IS__TUNIT____-NEXT: ret i1 false 28; 29; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 30; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test1 31; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 32; IS__CGSCC____-NEXT: ret i1 false 33; 34 %arg = select i1 %c, i32 -1, i32 1 35 %ret = call i1 @iszero1(i32 %arg) 36 ret i1 %ret 37} 38 39 40; potential-test 2 41; 42; potential values of argument of iszero are {1,-1} 43; potential value of returned value of iszero is 0 44; 45; int call_with_two_values(int x) { return iszero(x) + iszero(-x); } 46; int potential_test2(int x) { return call_with_two_values(1) + call_with_two_values(-1); } 47 48define internal i32 @iszero2(i32 %c) { 49; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 50; IS__CGSCC____-LABEL: define {{[^@]+}}@iszero2 51; IS__CGSCC____-SAME: () #[[ATTR0]] { 52; IS__CGSCC____-NEXT: ret i32 undef 53; 54 %cmp = icmp eq i32 %c, 0 55 %ret = zext i1 %cmp to i32 56 ret i32 %ret 57} 58 59define internal i32 @call_with_two_values(i32 %c) { 60; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 61; IS__CGSCC____-LABEL: define {{[^@]+}}@call_with_two_values 62; IS__CGSCC____-SAME: () #[[ATTR0]] { 63; IS__CGSCC____-NEXT: ret i32 undef 64; 65 %csret1 = call i32 @iszero2(i32 %c) 66 %minusc = sub i32 0, %c 67 %csret2 = call i32 @iszero2(i32 %minusc) 68 %ret = add i32 %csret1, %csret2 69 ret i32 %ret 70} 71 72define i32 @potential_test2(i1 %c) { 73; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 74; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test2 75; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 76; IS__TUNIT____-NEXT: ret i32 0 77; 78; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 79; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test2 80; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 81; IS__CGSCC____-NEXT: ret i32 0 82; 83 %csret1 = call i32 @call_with_two_values(i32 1) 84 %csret2 = call i32 @call_with_two_values(i32 -1) 85 %ret = add i32 %csret1, %csret2 86 ret i32 %ret 87} 88 89 90; potential-test 3 91; 92; potential values of returned value of f are {0,1} 93; potential values of argument of g are {0,1} 94; potential value of returned value of g is 1 95; then returned value of g can be simplified 96; 97; int zero_or_one(int c) { return c < 2; } 98; int potential_test3() { return zero_or_one(iszero(0))+zero_or_one(iszero(1)); } 99 100define internal i32 @iszero3(i32 %c) { 101; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 102; IS__CGSCC____-LABEL: define {{[^@]+}}@iszero3 103; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 104; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 undef, 0 105; IS__CGSCC____-NEXT: [[RET:%.*]] = zext i1 undef to i32 106; IS__CGSCC____-NEXT: ret i32 undef 107; 108 %cmp = icmp eq i32 %c, 0 109 %ret = zext i1 %cmp to i32 110 ret i32 %ret 111} 112 113define internal i32 @less_than_two(i32 %c) { 114; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 115; IS__CGSCC____-LABEL: define {{[^@]+}}@less_than_two 116; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 117; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp slt i32 undef, 2 118; IS__CGSCC____-NEXT: [[RET:%.*]] = zext i1 true to i32 119; IS__CGSCC____-NEXT: ret i32 undef 120; 121 %cmp = icmp slt i32 %c, 2 122 %ret = zext i1 %cmp to i32 123 ret i32 %ret 124} 125 126define i32 @potential_test3() { 127; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 128; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test3 129; IS__TUNIT____-SAME: () #[[ATTR0]] { 130; IS__TUNIT____-NEXT: ret i32 2 131; 132; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 133; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test3 134; IS__CGSCC____-SAME: () #[[ATTR0]] { 135; IS__CGSCC____-NEXT: ret i32 2 136; 137 %cmp1 = call i32 @iszero3(i32 0) 138 %true1 = call i32 @less_than_two(i32 %cmp1) 139 %cmp2 = call i32 @iszero3(i32 1) 140 %true2 = call i32 @less_than_two(i32 %cmp2) 141 %ret = add i32 %true1, %true2 142 ret i32 %ret 143} 144 145 146; potential-test 4,5 147; 148; simplified 149; int potential_test4(int c) { return return1or3(c) == 2; } 150; int potential_test5(int c) { return return1or3(c) == return2or4(c); } 151; 152; not simplified 153; int potential_test6(int c) { return return1or3(c) == 3; } 154; int potential_test7(int c) { return return1or3(c) == return3or4(c); } 155 156define i32 @potential_test4(i32 %c) { 157; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 158; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test4 159; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 160; IS__TUNIT____-NEXT: ret i32 0 161; 162; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 163; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test4 164; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 165; IS__CGSCC____-NEXT: ret i32 0 166; 167 %csret = call i32 @return1or3(i32 %c) 168 %false = icmp eq i32 %csret, 2 169 %ret = zext i1 %false to i32 170 ret i32 %ret 171} 172 173define i32 @potential_test5(i32 %c) { 174; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 175; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test5 176; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 177; IS__TUNIT____-NEXT: ret i32 0 178; 179; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 180; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test5 181; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 182; IS__CGSCC____-NEXT: ret i32 0 183; 184 %csret1 = call i32 @return1or3(i32 %c) 185 %csret2 = call i32 @return2or4(i32 %c) 186 %false = icmp eq i32 %csret1, %csret2 187 %ret = zext i1 %false to i32 188 ret i32 %ret 189} 190 191define i1 @potential_test6(i32 %c) { 192; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 193; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test6 194; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 195; IS__TUNIT____-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR0]], !range [[RNG0:![0-9]+]] 196; IS__TUNIT____-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], 3 197; IS__TUNIT____-NEXT: ret i1 [[RET]] 198; 199; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 200; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test6 201; IS__CGSCC_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 202; IS__CGSCC_OPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR2:[0-9]+]], !range [[RNG0:![0-9]+]] 203; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], 3 204; IS__CGSCC_OPM-NEXT: ret i1 [[RET]] 205; 206; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 207; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test6 208; IS__CGSCC_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 209; IS__CGSCC_NPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]] 210; IS__CGSCC_NPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], 3 211; IS__CGSCC_NPM-NEXT: ret i1 [[RET]] 212; 213 %csret1 = call i32 @return1or3(i32 %c) 214 %ret = icmp eq i32 %csret1, 3 215 ret i1 %ret 216} 217 218define i1 @potential_test7(i32 %c) { 219; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 220; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test7 221; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 222; IS__TUNIT____-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR0]], !range [[RNG0]] 223; IS__TUNIT____-NEXT: [[CSRET2:%.*]] = call i32 @return3or4(i32 [[C]]) #[[ATTR0]], !range [[RNG1:![0-9]+]] 224; IS__TUNIT____-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], [[CSRET2]] 225; IS__TUNIT____-NEXT: ret i1 [[RET]] 226; 227; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 228; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test7 229; IS__CGSCC_OPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 230; IS__CGSCC_OPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR2]], !range [[RNG0]] 231; IS__CGSCC_OPM-NEXT: [[CSRET2:%.*]] = call i32 @return3or4(i32 [[C]]) #[[ATTR2]], !range [[RNG1:![0-9]+]] 232; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], [[CSRET2]] 233; IS__CGSCC_OPM-NEXT: ret i1 [[RET]] 234; 235; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 236; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test7 237; IS__CGSCC_NPM-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 238; IS__CGSCC_NPM-NEXT: [[CSRET1:%.*]] = call i32 @return1or3(i32 [[C]]) #[[ATTR1]], !range [[RNG0]] 239; IS__CGSCC_NPM-NEXT: [[CSRET2:%.*]] = call i32 @return3or4(i32 [[C]]) #[[ATTR1]], !range [[RNG1:![0-9]+]] 240; IS__CGSCC_NPM-NEXT: [[RET:%.*]] = icmp eq i32 [[CSRET1]], [[CSRET2]] 241; IS__CGSCC_NPM-NEXT: ret i1 [[RET]] 242; 243 %csret1 = call i32 @return1or3(i32 %c) 244 %csret2 = call i32 @return3or4(i32 %c) 245 %ret = icmp eq i32 %csret1, %csret2 246 ret i1 %ret 247} 248 249define internal i32 @return1or3(i32 %c) { 250; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 251; IS__TUNIT____-LABEL: define {{[^@]+}}@return1or3 252; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 253; IS__TUNIT____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0 254; IS__TUNIT____-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 1, i32 3 255; IS__TUNIT____-NEXT: ret i32 [[RET]] 256; 257; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 258; IS__CGSCC____-LABEL: define {{[^@]+}}@return1or3 259; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 260; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0 261; IS__CGSCC____-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 1, i32 3 262; IS__CGSCC____-NEXT: ret i32 [[RET]] 263; 264 %cmp = icmp eq i32 %c, 0 265 %ret = select i1 %cmp, i32 1, i32 3 266 ret i32 %ret 267} 268 269define internal i32 @return2or4(i32 %c) { 270; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 271; IS__CGSCC____-LABEL: define {{[^@]+}}@return2or4 272; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 273; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 undef, 0 274; IS__CGSCC____-NEXT: [[RET:%.*]] = select i1 undef, i32 2, i32 4 275; IS__CGSCC____-NEXT: ret i32 undef 276; 277 %cmp = icmp eq i32 %c, 0 278 %ret = select i1 %cmp, i32 2, i32 4 279 ret i32 %ret 280} 281 282define internal i32 @return3or4(i32 %c) { 283; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 284; IS__TUNIT____-LABEL: define {{[^@]+}}@return3or4 285; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 286; IS__TUNIT____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0 287; IS__TUNIT____-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 3, i32 4 288; IS__TUNIT____-NEXT: ret i32 [[RET]] 289; 290; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 291; IS__CGSCC____-LABEL: define {{[^@]+}}@return3or4 292; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 293; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 [[C]], 0 294; IS__CGSCC____-NEXT: [[RET:%.*]] = select i1 [[CMP]], i32 3, i32 4 295; IS__CGSCC____-NEXT: ret i32 [[RET]] 296; 297 %cmp = icmp eq i32 %c, 0 298 %ret = select i1 %cmp, i32 3, i32 4 299 ret i32 %ret 300} 301 302; potential-test 8 303; 304; propagate argument to callsite argument 305 306define internal i1 @cmp_with_four(i32 %c) { 307; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 308; IS__CGSCC____-LABEL: define {{[^@]+}}@cmp_with_four 309; IS__CGSCC____-SAME: () #[[ATTR0]] { 310; IS__CGSCC____-NEXT: ret i1 undef 311; 312 %cmp = icmp eq i32 %c, 4 313 ret i1 %cmp 314} 315 316define internal i1 @wrapper(i32 %c) { 317; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 318; IS__CGSCC____-LABEL: define {{[^@]+}}@wrapper 319; IS__CGSCC____-SAME: () #[[ATTR0]] { 320; IS__CGSCC____-NEXT: ret i1 undef 321; 322 %ret = call i1 @cmp_with_four(i32 %c) 323 ret i1 %ret 324} 325 326define i1 @potential_test8() { 327; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 328; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test8 329; IS__TUNIT____-SAME: () #[[ATTR0]] { 330; IS__TUNIT____-NEXT: ret i1 false 331; 332; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 333; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test8 334; IS__CGSCC____-SAME: () #[[ATTR0]] { 335; IS__CGSCC____-NEXT: ret i1 false 336; 337 %res1 = call i1 @wrapper(i32 1) 338 %res3 = call i1 @wrapper(i32 3) 339 %res5 = call i1 @wrapper(i32 5) 340 %res13 = or i1 %res1, %res3 341 %res135 = or i1 %res13, %res5 342 ret i1 %res135 343} 344 345define i1 @potential_test9() { 346; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone 347; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test9 348; IS__TUNIT_OPM-SAME: () #[[ATTR1:[0-9]+]] { 349; IS__TUNIT_OPM-NEXT: entry: 350; IS__TUNIT_OPM-NEXT: br label [[COND:%.*]] 351; IS__TUNIT_OPM: cond: 352; IS__TUNIT_OPM-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_1:%.*]], [[INC:%.*]] ] 353; IS__TUNIT_OPM-NEXT: [[C_0:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ [[C_1:%.*]], [[INC]] ] 354; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 10 355; IS__TUNIT_OPM-NEXT: br i1 [[CMP]], label [[BODY:%.*]], label [[END:%.*]] 356; IS__TUNIT_OPM: body: 357; IS__TUNIT_OPM-NEXT: [[C_1]] = mul i32 [[C_0]], -1 358; IS__TUNIT_OPM-NEXT: br label [[INC]] 359; IS__TUNIT_OPM: inc: 360; IS__TUNIT_OPM-NEXT: [[I_1]] = add i32 [[I_0]], 1 361; IS__TUNIT_OPM-NEXT: br label [[COND]] 362; IS__TUNIT_OPM: end: 363; IS__TUNIT_OPM-NEXT: ret i1 false 364; 365; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn 366; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test9 367; IS__TUNIT_NPM-SAME: () #[[ATTR0]] { 368; IS__TUNIT_NPM-NEXT: entry: 369; IS__TUNIT_NPM-NEXT: br label [[COND:%.*]] 370; IS__TUNIT_NPM: cond: 371; IS__TUNIT_NPM-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_1:%.*]], [[INC:%.*]] ] 372; IS__TUNIT_NPM-NEXT: [[C_0:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ [[C_1:%.*]], [[INC]] ] 373; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 10 374; IS__TUNIT_NPM-NEXT: br i1 [[CMP]], label [[BODY:%.*]], label [[END:%.*]] 375; IS__TUNIT_NPM: body: 376; IS__TUNIT_NPM-NEXT: [[C_1]] = mul i32 [[C_0]], -1 377; IS__TUNIT_NPM-NEXT: br label [[INC]] 378; IS__TUNIT_NPM: inc: 379; IS__TUNIT_NPM-NEXT: [[I_1]] = add i32 [[I_0]], 1 380; IS__TUNIT_NPM-NEXT: br label [[COND]] 381; IS__TUNIT_NPM: end: 382; IS__TUNIT_NPM-NEXT: ret i1 false 383; 384; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone 385; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test9 386; IS__CGSCC_OPM-SAME: () #[[ATTR1:[0-9]+]] { 387; IS__CGSCC_OPM-NEXT: entry: 388; IS__CGSCC_OPM-NEXT: br label [[COND:%.*]] 389; IS__CGSCC_OPM: cond: 390; IS__CGSCC_OPM-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_1:%.*]], [[INC:%.*]] ] 391; IS__CGSCC_OPM-NEXT: [[C_0:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ [[C_1:%.*]], [[INC]] ] 392; IS__CGSCC_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 10 393; IS__CGSCC_OPM-NEXT: br i1 [[CMP]], label [[BODY:%.*]], label [[END:%.*]] 394; IS__CGSCC_OPM: body: 395; IS__CGSCC_OPM-NEXT: [[C_1]] = mul i32 [[C_0]], -1 396; IS__CGSCC_OPM-NEXT: br label [[INC]] 397; IS__CGSCC_OPM: inc: 398; IS__CGSCC_OPM-NEXT: [[I_1]] = add i32 [[I_0]], 1 399; IS__CGSCC_OPM-NEXT: br label [[COND]] 400; IS__CGSCC_OPM: end: 401; IS__CGSCC_OPM-NEXT: ret i1 false 402; 403; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 404; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test9 405; IS__CGSCC_NPM-SAME: () #[[ATTR0]] { 406; IS__CGSCC_NPM-NEXT: entry: 407; IS__CGSCC_NPM-NEXT: br label [[COND:%.*]] 408; IS__CGSCC_NPM: cond: 409; IS__CGSCC_NPM-NEXT: [[I_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[I_1:%.*]], [[INC:%.*]] ] 410; IS__CGSCC_NPM-NEXT: [[C_0:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ [[C_1:%.*]], [[INC]] ] 411; IS__CGSCC_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_0]], 10 412; IS__CGSCC_NPM-NEXT: br i1 [[CMP]], label [[BODY:%.*]], label [[END:%.*]] 413; IS__CGSCC_NPM: body: 414; IS__CGSCC_NPM-NEXT: [[C_1]] = mul i32 [[C_0]], -1 415; IS__CGSCC_NPM-NEXT: br label [[INC]] 416; IS__CGSCC_NPM: inc: 417; IS__CGSCC_NPM-NEXT: [[I_1]] = add i32 [[I_0]], 1 418; IS__CGSCC_NPM-NEXT: br label [[COND]] 419; IS__CGSCC_NPM: end: 420; IS__CGSCC_NPM-NEXT: ret i1 false 421; 422entry: 423 br label %cond 424cond: 425 %i.0 = phi i32 [0, %entry], [%i.1, %inc] 426 %c.0 = phi i32 [1, %entry], [%c.1, %inc] 427 %cmp = icmp slt i32 %i.0, 10 428 br i1 %cmp, label %body, label %end 429body: 430 %c.1 = mul i32 %c.0, -1 431 br label %inc 432inc: 433 %i.1 = add i32 %i.0, 1 434 br label %cond 435end: 436 %ret = icmp eq i32 %c.0, 0 437 ret i1 %ret 438} 439 440; Test 10 441; FIXME: potential returned values of @may_return_undef is {1, -1} 442; and returned value of @potential_test10 can be simplified to 0(false) 443 444define internal i32 @may_return_undef(i32 %c) { 445; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 446; IS__CGSCC____-LABEL: define {{[^@]+}}@may_return_undef 447; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 448; IS__CGSCC____-NEXT: switch i32 [[C]], label [[OTHERWISE:%.*]] [ 449; IS__CGSCC____-NEXT: i32 1, label [[A:%.*]] 450; IS__CGSCC____-NEXT: i32 -1, label [[B:%.*]] 451; IS__CGSCC____-NEXT: ] 452; IS__CGSCC____: a: 453; IS__CGSCC____-NEXT: ret i32 undef 454; IS__CGSCC____: b: 455; IS__CGSCC____-NEXT: ret i32 undef 456; IS__CGSCC____: otherwise: 457; IS__CGSCC____-NEXT: ret i32 undef 458; 459 switch i32 %c, label %otherwise [i32 1, label %a 460 i32 -1, label %b] 461a: 462 ret i32 1 463b: 464 ret i32 -1 465otherwise: 466 ret i32 undef 467} 468 469define i1 @potential_test10(i32 %c) { 470; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 471; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test10 472; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 473; IS__TUNIT____-NEXT: ret i1 false 474; 475; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 476; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test10 477; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 478; IS__CGSCC____-NEXT: [[CMP:%.*]] = icmp eq i32 undef, 0 479; IS__CGSCC____-NEXT: ret i1 false 480; 481 %ret = call i32 @may_return_undef(i32 %c) 482 %cmp = icmp eq i32 %ret, 0 483 ret i1 %cmp 484} 485 486define i32 @optimize_undef_1(i1 %c) { 487; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 488; IS__TUNIT____-LABEL: define {{[^@]+}}@optimize_undef_1 489; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 490; IS__TUNIT____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 491; IS__TUNIT____: t: 492; IS__TUNIT____-NEXT: ret i32 0 493; IS__TUNIT____: f: 494; IS__TUNIT____-NEXT: ret i32 1 495; 496; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 497; IS__CGSCC____-LABEL: define {{[^@]+}}@optimize_undef_1 498; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 499; IS__CGSCC____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 500; IS__CGSCC____: t: 501; IS__CGSCC____-NEXT: ret i32 0 502; IS__CGSCC____: f: 503; IS__CGSCC____-NEXT: ret i32 1 504; 505 br i1 %c, label %t, label %f 506t: 507 ret i32 0 508f: 509 %undef = add i32 undef, 1 510 ret i32 %undef 511} 512 513define i32 @optimize_undef_2(i1 %c) { 514; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 515; IS__TUNIT____-LABEL: define {{[^@]+}}@optimize_undef_2 516; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 517; IS__TUNIT____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 518; IS__TUNIT____: t: 519; IS__TUNIT____-NEXT: ret i32 0 520; IS__TUNIT____: f: 521; IS__TUNIT____-NEXT: ret i32 -1 522; 523; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 524; IS__CGSCC____-LABEL: define {{[^@]+}}@optimize_undef_2 525; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 526; IS__CGSCC____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 527; IS__CGSCC____: t: 528; IS__CGSCC____-NEXT: ret i32 0 529; IS__CGSCC____: f: 530; IS__CGSCC____-NEXT: ret i32 -1 531; 532 br i1 %c, label %t, label %f 533t: 534 ret i32 0 535f: 536 %undef = sub i32 undef, 1 537 ret i32 %undef 538} 539 540define i32 @optimize_undef_3(i1 %c) { 541; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 542; IS__TUNIT____-LABEL: define {{[^@]+}}@optimize_undef_3 543; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 544; IS__TUNIT____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 545; IS__TUNIT____: t: 546; IS__TUNIT____-NEXT: ret i32 0 547; IS__TUNIT____: f: 548; IS__TUNIT____-NEXT: ret i32 1 549; 550; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 551; IS__CGSCC____-LABEL: define {{[^@]+}}@optimize_undef_3 552; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 553; IS__CGSCC____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 554; IS__CGSCC____: t: 555; IS__CGSCC____-NEXT: ret i32 0 556; IS__CGSCC____: f: 557; IS__CGSCC____-NEXT: ret i32 1 558; 559 br i1 %c, label %t, label %f 560t: 561 ret i32 0 562f: 563 %undef = icmp eq i32 undef, 0 564 %undef2 = zext i1 %undef to i32 565 ret i32 %undef2 566} 567 568 569; FIXME: returned value can be simplified to 0 570define i32 @potential_test11(i1 %c) { 571; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 572; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test11 573; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 574; IS__TUNIT____-NEXT: [[ZERO1:%.*]] = call i32 @optimize_undef_1(i1 [[C]]) #[[ATTR0]], !range [[RNG2:![0-9]+]] 575; IS__TUNIT____-NEXT: [[ZERO2:%.*]] = call i32 @optimize_undef_2(i1 [[C]]) #[[ATTR0]], !range [[RNG3:![0-9]+]] 576; IS__TUNIT____-NEXT: [[ZERO3:%.*]] = call i32 @optimize_undef_3(i1 [[C]]) #[[ATTR0]], !range [[RNG2]] 577; IS__TUNIT____-NEXT: [[ACC1:%.*]] = add i32 [[ZERO1]], [[ZERO2]] 578; IS__TUNIT____-NEXT: [[ACC2:%.*]] = add i32 [[ACC1]], [[ZERO3]] 579; IS__TUNIT____-NEXT: ret i32 [[ACC2]] 580; 581; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 582; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test11 583; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 584; IS__CGSCC_OPM-NEXT: [[ZERO1:%.*]] = call i32 @optimize_undef_1(i1 [[C]]) #[[ATTR2]], !range [[RNG2:![0-9]+]] 585; IS__CGSCC_OPM-NEXT: [[ZERO2:%.*]] = call i32 @optimize_undef_2(i1 [[C]]) #[[ATTR2]], !range [[RNG3:![0-9]+]] 586; IS__CGSCC_OPM-NEXT: [[ZERO3:%.*]] = call i32 @optimize_undef_3(i1 [[C]]) #[[ATTR2]], !range [[RNG2]] 587; IS__CGSCC_OPM-NEXT: [[ACC1:%.*]] = add i32 [[ZERO1]], [[ZERO2]] 588; IS__CGSCC_OPM-NEXT: [[ACC2:%.*]] = add i32 [[ACC1]], [[ZERO3]] 589; IS__CGSCC_OPM-NEXT: ret i32 [[ACC2]] 590; 591; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 592; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test11 593; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 594; IS__CGSCC_NPM-NEXT: [[ZERO1:%.*]] = call i32 @optimize_undef_1(i1 [[C]]) #[[ATTR1]], !range [[RNG2:![0-9]+]] 595; IS__CGSCC_NPM-NEXT: [[ZERO2:%.*]] = call i32 @optimize_undef_2(i1 [[C]]) #[[ATTR1]], !range [[RNG3:![0-9]+]] 596; IS__CGSCC_NPM-NEXT: [[ZERO3:%.*]] = call i32 @optimize_undef_3(i1 [[C]]) #[[ATTR1]], !range [[RNG2]] 597; IS__CGSCC_NPM-NEXT: [[ACC1:%.*]] = add i32 [[ZERO1]], [[ZERO2]] 598; IS__CGSCC_NPM-NEXT: [[ACC2:%.*]] = add i32 [[ACC1]], [[ZERO3]] 599; IS__CGSCC_NPM-NEXT: ret i32 [[ACC2]] 600; 601 %zero1 = call i32 @optimize_undef_1(i1 %c) 602 %zero2 = call i32 @optimize_undef_2(i1 %c) 603 %zero3 = call i32 @optimize_undef_3(i1 %c) 604 %acc1 = add i32 %zero1, %zero2 605 %acc2 = add i32 %acc1, %zero3 606 ret i32 %acc2 607} 608 609define i32 @optimize_poison_1(i1 %c) { 610; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn 611; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@optimize_poison_1 612; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 613; IS__TUNIT_OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 614; IS__TUNIT_OPM: t: 615; IS__TUNIT_OPM-NEXT: ret i32 0 616; IS__TUNIT_OPM: f: 617; IS__TUNIT_OPM-NEXT: ret i32 -1 618; 619; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn 620; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@optimize_poison_1 621; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 622; IS__TUNIT_NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 623; IS__TUNIT_NPM: t: 624; IS__TUNIT_NPM-NEXT: ret i32 0 625; IS__TUNIT_NPM: f: 626; IS__TUNIT_NPM-NEXT: ret i32 undef 627; 628; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 629; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@optimize_poison_1 630; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 631; IS__CGSCC_OPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 632; IS__CGSCC_OPM: t: 633; IS__CGSCC_OPM-NEXT: ret i32 0 634; IS__CGSCC_OPM: f: 635; IS__CGSCC_OPM-NEXT: ret i32 -1 636; 637; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 638; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@optimize_poison_1 639; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 640; IS__CGSCC_NPM-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]] 641; IS__CGSCC_NPM: t: 642; IS__CGSCC_NPM-NEXT: ret i32 0 643; IS__CGSCC_NPM: f: 644; IS__CGSCC_NPM-NEXT: ret i32 undef 645; 646 br i1 %c, label %t, label %f 647t: 648 ret i32 0 649f: 650 %poison = sub nuw i32 0, 1 651 ret i32 %poison 652} 653 654; FIXME: returned value can be simplified to 0 655define i32 @potential_test12(i1 %c) { 656; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone willreturn 657; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@potential_test12 658; IS__TUNIT_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 659; IS__TUNIT_OPM-NEXT: [[ZERO:%.*]] = call noundef i32 @optimize_poison_1(i1 [[C]]) #[[ATTR0]], !range [[RNG3]] 660; IS__TUNIT_OPM-NEXT: ret i32 [[ZERO]] 661; 662; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone willreturn 663; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@potential_test12 664; IS__TUNIT_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 665; IS__TUNIT_NPM-NEXT: ret i32 0 666; 667; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 668; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test12 669; IS__CGSCC_OPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 670; IS__CGSCC_OPM-NEXT: [[ZERO:%.*]] = call noundef i32 @optimize_poison_1(i1 [[C]]) #[[ATTR2]], !range [[RNG3]] 671; IS__CGSCC_OPM-NEXT: ret i32 [[ZERO]] 672; 673; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 674; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test12 675; IS__CGSCC_NPM-SAME: (i1 [[C:%.*]]) #[[ATTR0]] { 676; IS__CGSCC_NPM-NEXT: ret i32 0 677; 678 %zero = call i32 @optimize_poison_1(i1 %c) 679 ret i32 %zero 680} 681 682; Test 13 683; Do not simplify %ret in the callee to `%c`. 684; The potential value of %c is {0, 1} (undef is merged). 685; However, we should not simplify `and i32 %c, 3` to `%c` 686 687define internal i32 @potential_test13_callee(i32 %c) { 688; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 689; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test13_callee 690; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 691; IS__TUNIT____-NEXT: [[RET:%.*]] = and i32 [[C]], 3 692; IS__TUNIT____-NEXT: ret i32 [[RET]] 693; 694; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 695; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test13_callee 696; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR0]] { 697; IS__CGSCC____-NEXT: [[RET:%.*]] = and i32 [[C]], 3 698; IS__CGSCC____-NEXT: ret i32 [[RET]] 699; 700 %ret = and i32 %c, 3 701 ret i32 %ret 702} 703 704define i32 @potential_test13_caller1() { 705; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 706; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test13_caller1 707; IS__TUNIT____-SAME: () #[[ATTR0]] { 708; IS__TUNIT____-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 0) #[[ATTR0]], !range [[RNG2]] 709; IS__TUNIT____-NEXT: ret i32 [[RET]] 710; 711; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 712; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test13_caller1 713; IS__CGSCC_OPM-SAME: () #[[ATTR0]] { 714; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 0) #[[ATTR2]], !range [[RNG2]] 715; IS__CGSCC_OPM-NEXT: ret i32 [[RET]] 716; 717; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 718; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test13_caller1 719; IS__CGSCC_NPM-SAME: () #[[ATTR0]] { 720; IS__CGSCC_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 0) #[[ATTR1]], !range [[RNG2]] 721; IS__CGSCC_NPM-NEXT: ret i32 [[RET]] 722; 723 %ret = call i32 @potential_test13_callee(i32 0) 724 ret i32 %ret 725} 726 727define i32 @potential_test13_caller2() { 728; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 729; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test13_caller2 730; IS__TUNIT____-SAME: () #[[ATTR0]] { 731; IS__TUNIT____-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 1) #[[ATTR0]], !range [[RNG2]] 732; IS__TUNIT____-NEXT: ret i32 [[RET]] 733; 734; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 735; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test13_caller2 736; IS__CGSCC_OPM-SAME: () #[[ATTR0]] { 737; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 1) #[[ATTR2]], !range [[RNG2]] 738; IS__CGSCC_OPM-NEXT: ret i32 [[RET]] 739; 740; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 741; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test13_caller2 742; IS__CGSCC_NPM-SAME: () #[[ATTR0]] { 743; IS__CGSCC_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 noundef 1) #[[ATTR1]], !range [[RNG2]] 744; IS__CGSCC_NPM-NEXT: ret i32 [[RET]] 745; 746 %ret = call i32 @potential_test13_callee(i32 1) 747 ret i32 %ret 748} 749 750define i32 @potential_test13_caller3() { 751; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 752; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test13_caller3 753; IS__TUNIT____-SAME: () #[[ATTR0]] { 754; IS__TUNIT____-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 undef) #[[ATTR0]], !range [[RNG2]] 755; IS__TUNIT____-NEXT: ret i32 [[RET]] 756; 757; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 758; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@potential_test13_caller3 759; IS__CGSCC_OPM-SAME: () #[[ATTR0]] { 760; IS__CGSCC_OPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 undef) #[[ATTR2]], !range [[RNG2]] 761; IS__CGSCC_OPM-NEXT: ret i32 [[RET]] 762; 763; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 764; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@potential_test13_caller3 765; IS__CGSCC_NPM-SAME: () #[[ATTR0]] { 766; IS__CGSCC_NPM-NEXT: [[RET:%.*]] = call i32 @potential_test13_callee(i32 undef) #[[ATTR1]], !range [[RNG2]] 767; IS__CGSCC_NPM-NEXT: ret i32 [[RET]] 768; 769 %ret = call i32 @potential_test13_callee(i32 undef) 770 ret i32 %ret 771} 772 773define i1 @potential_test14(i1 %c0, i1 %c1, i1 %c2, i1 %c3) { 774; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 775; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test14 776; IS__TUNIT____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR0]] { 777; IS__TUNIT____-NEXT: [[X0:%.*]] = select i1 [[C0]], i32 0, i32 1 778; IS__TUNIT____-NEXT: [[X1:%.*]] = select i1 [[C1]], i32 [[X0]], i32 undef 779; IS__TUNIT____-NEXT: [[Y2:%.*]] = select i1 [[C2]], i32 0, i32 7 780; IS__TUNIT____-NEXT: [[Z3:%.*]] = select i1 [[C3]], i32 [[X1]], i32 [[Y2]] 781; IS__TUNIT____-NEXT: [[RET:%.*]] = icmp slt i32 [[Z3]], 7 782; IS__TUNIT____-NEXT: ret i1 [[RET]] 783; 784; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 785; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test14 786; IS__CGSCC____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]]) #[[ATTR0]] { 787; IS__CGSCC____-NEXT: [[X0:%.*]] = select i1 [[C0]], i32 0, i32 1 788; IS__CGSCC____-NEXT: [[X1:%.*]] = select i1 [[C1]], i32 [[X0]], i32 undef 789; IS__CGSCC____-NEXT: [[Y2:%.*]] = select i1 [[C2]], i32 0, i32 7 790; IS__CGSCC____-NEXT: [[Z3:%.*]] = select i1 [[C3]], i32 [[X1]], i32 [[Y2]] 791; IS__CGSCC____-NEXT: [[RET:%.*]] = icmp slt i32 [[Z3]], 7 792; IS__CGSCC____-NEXT: ret i1 [[RET]] 793; 794 %x0 = select i1 %c0, i32 0, i32 1 795 %x1 = select i1 %c1, i32 %x0, i32 undef 796 %y2 = select i1 %c2, i32 0, i32 7 797 %z3 = select i1 %c3, i32 %x1, i32 %y2 798 %ret = icmp slt i32 %z3, 7 799 ret i1 %ret 800} 801 802define i1 @potential_test15(i1 %c0, i1 %c1) { 803; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 804; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test15 805; IS__TUNIT____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]]) #[[ATTR0]] { 806; IS__TUNIT____-NEXT: ret i1 false 807; 808; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 809; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test15 810; IS__CGSCC____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]]) #[[ATTR0]] { 811; IS__CGSCC____-NEXT: ret i1 false 812; 813 %x0 = select i1 %c0, i32 0, i32 1 814 %x1 = select i1 %c1, i32 %x0, i32 undef 815 %ret = icmp eq i32 %x1, 7 816 ret i1 %ret 817} 818 819define i1 @potential_test16(i1 %c0, i1 %c1) { 820; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn 821; IS__TUNIT____-LABEL: define {{[^@]+}}@potential_test16 822; IS__TUNIT____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]]) #[[ATTR0]] { 823; IS__TUNIT____-NEXT: ret i1 false 824; 825; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 826; IS__CGSCC____-LABEL: define {{[^@]+}}@potential_test16 827; IS__CGSCC____-SAME: (i1 [[C0:%.*]], i1 [[C1:%.*]]) #[[ATTR0]] { 828; IS__CGSCC____-NEXT: ret i1 false 829; 830 %x0 = select i1 %c0, i32 0, i32 undef 831 %x1 = select i1 %c1, i32 %x0, i32 1 832 %ret = icmp eq i32 %x1, 7 833 ret i1 %ret 834} 835 836;. 837; IS__TUNIT_OPM: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn } 838; IS__TUNIT_OPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone } 839;. 840; IS__TUNIT_NPM: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn } 841;. 842; IS__CGSCC_OPM: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } 843; IS__CGSCC_OPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone } 844; IS__CGSCC_OPM: attributes #[[ATTR2]] = { readnone willreturn } 845;. 846; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } 847; IS__CGSCC_NPM: attributes #[[ATTR1]] = { readnone willreturn } 848;. 849; CHECK: [[META0:![0-9]+]] = !{i32 1, i32 4} 850; CHECK: [[META1:![0-9]+]] = !{i32 3, i32 5} 851; CHECK: [[META2:![0-9]+]] = !{i32 0, i32 2} 852; CHECK: [[META3:![0-9]+]] = !{i32 -1, i32 1} 853;. 854