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