brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.7 KiB · 585b6ef Raw
203 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes --check-globals2; call site specific analysis is enabled3 4; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-enable-call-site-specific-deduction=true -attributor-manifest-internal  -attributor-annotate-decl-cs  -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT5 6; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-enable-call-site-specific-deduction=true -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC7 8define dso_local i32 @test_range1(i32 %0) #0 {9; CHECK-LABEL: define {{[^@]+}}@test_range110; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {11; CHECK-NEXT:    [[TMP2:%.*]] = icmp ne i32 [[TMP0]], 012; CHECK-NEXT:    br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]13; CHECK:       3:14; CHECK-NEXT:    br label [[TMP5:%.*]]15; CHECK:       4:16; CHECK-NEXT:    br label [[TMP5]]17; CHECK:       5:18; CHECK-NEXT:    [[DOT0:%.*]] = phi i32 [ 100, [[TMP3]] ], [ 0, [[TMP4]] ]19; CHECK-NEXT:    ret i32 [[DOT0]]20;21  %2 = icmp ne i32 %0, 022  br i1 %2, label %3, label %423 243:                                                ; preds = %125  br label %526 274:                                                ; preds = %128  br label %529 305:                                                ; preds = %4, %331  %.0 = phi i32 [ 100, %3 ], [ 0, %4 ]32  ret i32 %.033}34 35define i32 @test_range2(i32 %0) #0 {36; CHECK-LABEL: define {{[^@]+}}@test_range237; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {38; CHECK-NEXT:    [[TMP2:%.*]] = icmp ne i32 [[TMP0]], 039; CHECK-NEXT:    br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]40; CHECK:       3:41; CHECK-NEXT:    br label [[TMP5:%.*]]42; CHECK:       4:43; CHECK-NEXT:    br label [[TMP5]]44; CHECK:       5:45; CHECK-NEXT:    [[DOT0:%.*]] = phi i32 [ 100, [[TMP3]] ], [ 200, [[TMP4]] ]46; CHECK-NEXT:    ret i32 [[DOT0]]47;48  %2 = icmp ne i32 %0, 049  br i1 %2, label %3, label %450 513:                                                ; preds = %152  br label %553 544:                                                ; preds = %155  br label %556 575:                                                ; preds = %4, %358  %.0 = phi i32 [ 100, %3 ], [ 200, %4 ]59  ret i32 %.060}61define i32 @test(i32 %0, i32 %1) #0 {62; TUNIT-LABEL: define {{[^@]+}}@test63; TUNIT-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {64; TUNIT-NEXT:    [[TMP3:%.*]] = icmp ne i32 [[TMP1]], 065; TUNIT-NEXT:    br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP6:%.*]]66; TUNIT:       4:67; TUNIT-NEXT:    [[TMP5:%.*]] = call i32 @test_range1(i32 [[TMP0]])68; TUNIT-NEXT:    br label [[TMP8:%.*]]69; TUNIT:       6:70; TUNIT-NEXT:    [[TMP7:%.*]] = call i32 @test_range2(i32 [[TMP0]])71; TUNIT-NEXT:    br label [[TMP8]]72; TUNIT:       8:73; TUNIT-NEXT:    [[DOT0:%.*]] = phi i32 [ [[TMP5]], [[TMP4]] ], [ [[TMP7]], [[TMP6]] ]74; TUNIT-NEXT:    ret i32 [[DOT0]]75;76; CGSCC-LABEL: define {{[^@]+}}@test77; CGSCC-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR1:[0-9]+]] {78; CGSCC-NEXT:    [[TMP3:%.*]] = icmp ne i32 [[TMP1]], 079; CGSCC-NEXT:    br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP6:%.*]]80; CGSCC:       4:81; CGSCC-NEXT:    [[TMP5:%.*]] = call noundef i32 @test_range1(i32 [[TMP0]])82; CGSCC-NEXT:    br label [[TMP8:%.*]]83; CGSCC:       6:84; CGSCC-NEXT:    [[TMP7:%.*]] = call noundef i32 @test_range2(i32 [[TMP0]])85; CGSCC-NEXT:    br label [[TMP8]]86; CGSCC:       8:87; CGSCC-NEXT:    [[DOT0:%.*]] = phi i32 [ [[TMP5]], [[TMP4]] ], [ [[TMP7]], [[TMP6]] ]88; CGSCC-NEXT:    ret i32 [[DOT0]]89;90  %3 = icmp ne i32 %1, 091  br i1 %3, label %4, label %692 934:                                                ; preds = %294  %5 = call i32 @test_range1(i32 %0)95  br label %896 976:                                                ; preds = %298  %7 = call i32 @test_range2(i32 %0)99  br label %8100 1018:                                                ; preds = %6, %4102  %.0 = phi i32 [ %5, %4 ], [ %7, %6 ]103  ret i32 %.0104}105 106define i32 @test_pcheck1(i32 %0) #0 {107; TUNIT-LABEL: define {{[^@]+}}@test_pcheck1108; TUNIT-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {109; TUNIT-NEXT:    [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)110; TUNIT-NEXT:    [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 101111; TUNIT-NEXT:    [[TMP4:%.*]] = zext i1 [[TMP3]] to i32112; TUNIT-NEXT:    ret i32 [[TMP4]]113;114; CGSCC-LABEL: define {{[^@]+}}@test_pcheck1115; CGSCC-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1]] {116; CGSCC-NEXT:    [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)117; CGSCC-NEXT:    [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 101118; CGSCC-NEXT:    [[TMP4:%.*]] = zext i1 [[TMP3]] to i32119; CGSCC-NEXT:    ret i32 [[TMP4]]120;121; TUNIT_ENABLED-LABEL: define {{[^@]+}}@test_pcheck1122; TUNIT_ENABLED-SAME: (i32 [[TMP0:%.*]])123; TUNIT_ENABLED-NEXT:    ret i32 1124  %2 = call i32 @test(i32 %0, i32 1)125  %3 = icmp slt i32 %2, 101126  %4 = zext i1 %3 to i32127  ret i32 %4128}129 130define i32 @test_pcheck2(i32 %0) #0 {131; TUNIT-LABEL: define {{[^@]+}}@test_pcheck2132; TUNIT-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {133; TUNIT-NEXT:    [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)134; TUNIT-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 99135; TUNIT-NEXT:    [[TMP4:%.*]] = zext i1 [[TMP3]] to i32136; TUNIT-NEXT:    ret i32 [[TMP4]]137;138; CGSCC-LABEL: define {{[^@]+}}@test_pcheck2139; CGSCC-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1]] {140; CGSCC-NEXT:    [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)141; CGSCC-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 99142; CGSCC-NEXT:    [[TMP4:%.*]] = zext i1 [[TMP3]] to i32143; CGSCC-NEXT:    ret i32 [[TMP4]]144;145  %2 = call i32 @test(i32 %0, i32 0)146  %3 = icmp sgt i32 %2, 99147  %4 = zext i1 %3 to i32148  ret i32 %4149}150 151define i32 @test_ncheck1(i32 %0) #0 {152; TUNIT-LABEL: define {{[^@]+}}@test_ncheck1153; TUNIT-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {154; TUNIT-NEXT:    [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)155; TUNIT-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 50156; TUNIT-NEXT:    [[TMP4:%.*]] = zext i1 [[TMP3]] to i32157; TUNIT-NEXT:    ret i32 [[TMP4]]158;159; CGSCC-LABEL: define {{[^@]+}}@test_ncheck1160; CGSCC-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1]] {161; CGSCC-NEXT:    [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)162; CGSCC-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 50163; CGSCC-NEXT:    [[TMP4:%.*]] = zext i1 [[TMP3]] to i32164; CGSCC-NEXT:    ret i32 [[TMP4]]165;166  %2 = call i32 @test(i32 %0, i32 1)167  %3 = icmp sgt i32 %2, 50168  %4 = zext i1 %3 to i32169  ret i32 %4170}171 172define i32 @test_ncheck2(i32 %0) #0 {173; TUNIT-LABEL: define {{[^@]+}}@test_ncheck2174; TUNIT-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {175; TUNIT-NEXT:    [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)176; TUNIT-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 150177; TUNIT-NEXT:    [[TMP4:%.*]] = zext i1 [[TMP3]] to i32178; TUNIT-NEXT:    ret i32 [[TMP4]]179;180; CGSCC-LABEL: define {{[^@]+}}@test_ncheck2181; CGSCC-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1]] {182; CGSCC-NEXT:    [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)183; CGSCC-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 150184; CGSCC-NEXT:    [[TMP4:%.*]] = zext i1 [[TMP3]] to i32185; CGSCC-NEXT:    ret i32 [[TMP4]]186;187  %2 = call i32 @test(i32 %0, i32 0)188  %3 = icmp sgt i32 %2, 150189  %4 = zext i1 %3 to i32190  ret i32 %4191}192 193attributes #0 = { noinline nounwind sspstrong uwtable}194 195;.196; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind sspstrong willreturn memory(none) uwtable }197; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind willreturn memory(none) }198;.199; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind sspstrong willreturn memory(none) uwtable }200; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree noinline nosync nounwind sspstrong willreturn memory(none) uwtable }201; CGSCC: attributes #[[ATTR2:[0-9]+]] = { nofree nosync willreturn }202;.203