1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
3 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
5 define internal i32 @testf(i1 %c) {
6 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
7 ; CGSCC-LABEL: define {{[^@]+}}@testf
8 ; CGSCC-SAME: (i1 noundef [[C:%.*]]) #[[ATTR0:[0-9]+]] {
10 ; CGSCC-NEXT: br i1 [[C]], label [[IF_COND:%.*]], label [[IF_END:%.*]]
12 ; CGSCC-NEXT: unreachable
14 ; CGSCC-NEXT: unreachable
16 ; CGSCC-NEXT: ret i32 10
19 br i1 %c, label %if.cond, label %if.end
22 br i1 undef, label %if.then, label %if.end
24 if.then: ; preds = %entry, %if.then
27 if.end: ; preds = %if.then1, %entry
31 define internal i32 @test1(i1 %c) {
32 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
33 ; CGSCC-LABEL: define {{[^@]+}}@test1
34 ; CGSCC-SAME: (i1 [[C:%.*]]) #[[ATTR1:[0-9]+]] {
36 ; CGSCC-NEXT: br label [[IF_THEN:%.*]]
38 ; CGSCC-NEXT: [[CALL:%.*]] = call i32 @testf(i1 noundef [[C]]) #[[ATTR2:[0-9]+]]
39 ; CGSCC-NEXT: [[RES:%.*]] = icmp eq i32 [[CALL]], 10
40 ; CGSCC-NEXT: br i1 [[RES]], label [[RET1:%.*]], label [[RET2:%.*]]
42 ; CGSCC-NEXT: ret i32 99
44 ; CGSCC-NEXT: ret i32 0
49 if.then: ; preds = %entry, %if.then
50 %call = call i32 @testf(i1 %c)
51 %res = icmp eq i32 %call, 10
52 br i1 %res, label %ret1, label %ret2
54 ret1: ; preds = %if.then, %entry
57 ret2: ; preds = %if.then, %entry
61 define i32 @main(i1 %c) {
62 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
63 ; TUNIT-LABEL: define {{[^@]+}}@main
64 ; TUNIT-SAME: (i1 [[C:%.*]]) #[[ATTR0:[0-9]+]] {
65 ; TUNIT-NEXT: ret i32 99
67 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
68 ; CGSCC-LABEL: define {{[^@]+}}@main
69 ; CGSCC-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
70 ; CGSCC-NEXT: [[RES:%.*]] = call noundef i32 @test1(i1 [[C]]) #[[ATTR2]]
71 ; CGSCC-NEXT: ret i32 [[RES]]
73 %res = call i32 @test1(i1 %c)
77 ; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
79 ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
80 ; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
81 ; CGSCC: attributes #[[ATTR2]] = { nofree nosync willreturn }
83 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: