1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -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=4 -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
8 define internal void @dead() {
9 ; IS__CGSCC____-LABEL: define {{[^@]+}}@dead() {
10 ; IS__CGSCC____-NEXT: [[TMP1:%.*]] = call i32 @test(i32* noalias noundef align 536870912 null)
11 ; IS__CGSCC____-NEXT: ret void
13 call i32 @test(i32* null, i32* null)
17 define internal i32 @test(i32* %X, i32* %Y) {
18 ; IS__CGSCC_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
19 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test
20 ; IS__CGSCC_OPM-SAME: (i32* noalias nocapture nofree noundef writeonly align 4 [[X:%.*]]) #[[ATTR0:[0-9]+]] {
21 ; IS__CGSCC_OPM-NEXT: br i1 true, label [[LIVE:%.*]], label [[DEAD:%.*]]
22 ; IS__CGSCC_OPM: live:
23 ; IS__CGSCC_OPM-NEXT: store i32 0, i32* [[X]], align 4
24 ; IS__CGSCC_OPM-NEXT: ret i32 undef
25 ; IS__CGSCC_OPM: dead:
26 ; IS__CGSCC_OPM-NEXT: unreachable
28 ; IS__CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
29 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test
30 ; IS__CGSCC_NPM-SAME: (i32* noalias nocapture nofree noundef writeonly align 4 [[X:%.*]]) #[[ATTR0:[0-9]+]] {
31 ; IS__CGSCC_NPM-NEXT: br i1 true, label [[LIVE:%.*]], label [[DEAD:%.*]]
32 ; IS__CGSCC_NPM: live:
33 ; IS__CGSCC_NPM-NEXT: store i32 0, i32* [[X]], align 4
34 ; IS__CGSCC_NPM-NEXT: ret i32 undef
35 ; IS__CGSCC_NPM: dead:
36 ; IS__CGSCC_NPM-NEXT: unreachable
38 br i1 true, label %live, label %dead
43 call i32 @caller(i32* null)
48 define internal i32 @caller(i32* %B) {
49 ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind readnone willreturn
50 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@caller
51 ; IS__CGSCC_OPM-SAME: () #[[ATTR1:[0-9]+]] {
52 ; IS__CGSCC_OPM-NEXT: [[A:%.*]] = alloca i32, align 4
53 ; IS__CGSCC_OPM-NEXT: [[C:%.*]] = call i32 @test(i32* noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR3:[0-9]+]]
54 ; IS__CGSCC_OPM-NEXT: ret i32 undef
56 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
57 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@caller
58 ; IS__CGSCC_NPM-SAME: () #[[ATTR1:[0-9]+]] {
59 ; IS__CGSCC_NPM-NEXT: [[A:%.*]] = alloca i32, align 4
60 ; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i32 @test(i32* noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR2:[0-9]+]]
61 ; IS__CGSCC_NPM-NEXT: ret i32 undef
65 %C = call i32 @test(i32* %A, i32* %B)
69 define i32 @callercaller() {
70 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
71 ; IS__TUNIT____-LABEL: define {{[^@]+}}@callercaller
72 ; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] {
73 ; IS__TUNIT____-NEXT: [[B:%.*]] = alloca i32, align 4
74 ; IS__TUNIT____-NEXT: ret i32 0
76 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
77 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@callercaller
78 ; IS__CGSCC_OPM-SAME: () #[[ATTR2:[0-9]+]] {
79 ; IS__CGSCC_OPM-NEXT: [[B:%.*]] = alloca i32, align 4
80 ; IS__CGSCC_OPM-NEXT: ret i32 0
82 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
83 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@callercaller
84 ; IS__CGSCC_NPM-SAME: () #[[ATTR1]] {
85 ; IS__CGSCC_NPM-NEXT: [[B:%.*]] = alloca i32, align 4
86 ; IS__CGSCC_NPM-NEXT: ret i32 0
90 %X = call i32 @caller(i32* %B)
95 ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn }
97 ; IS__CGSCC_OPM: attributes #[[ATTR0]] = { argmemonly nofree nosync nounwind willreturn writeonly }
98 ; IS__CGSCC_OPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
99 ; IS__CGSCC_OPM: attributes #[[ATTR2]] = { nofree norecurse nosync nounwind readnone willreturn }
100 ; IS__CGSCC_OPM: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn writeonly }
102 ; IS__CGSCC_NPM: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
103 ; IS__CGSCC_NPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
104 ; IS__CGSCC_NPM: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn writeonly }