1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals --prefix-filecheck-ir-name true
2 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK
4 @dst = dso_local addrspace(1) externally_initialized global i32 0, align 4
5 @g1 = dso_local addrspace(1) externally_initialized global ptr null, align 4
6 @g2 = dso_local addrspace(1) externally_initialized global i32 0, align 4
7 @s1 = dso_local addrspace(3) global i32 undef, align 4
8 @s2 = dso_local addrspace(3) global i32 undef, align 4
11 ; CHECK: @dst = dso_local addrspace(1) externally_initialized global i32 0, align 4
12 ; CHECK: @g1 = dso_local addrspace(1) externally_initialized global ptr null, align 4
13 ; CHECK: @g2 = dso_local addrspace(1) externally_initialized global i32 0, align 4
14 ; CHECK: @s1 = dso_local addrspace(3) global i32 undef, align 4
15 ; CHECK: @s2 = dso_local addrspace(3) global i32 undef, align 4
17 define internal void @_Z12global_writePi(ptr noundef %p) #0 {
18 ; CHECK: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(write)
19 ; CHECK-LABEL: define {{[^@]+}}@_Z12global_writePi
20 ; CHECK-SAME: (ptr nofree noundef nonnull writeonly align 4 dereferenceable(8) [[P:%.*]]) #[[ATTR0:[0-9]+]] {
22 ; CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr [[P]] to ptr addrspace(1)
23 ; CHECK-NEXT: store ptr [[P]], ptr addrspace(1) [[TMP0]], align 4
24 ; CHECK-NEXT: ret void
27 store ptr %p, ptr %p, align 4
31 ; Function Attrs: convergent mustprogress noinline nounwind
32 define internal void @_Z13unknown_writePi(ptr noundef %p) #0 {
33 ; CHECK: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(write)
34 ; CHECK-LABEL: define {{[^@]+}}@_Z13unknown_writePi
35 ; CHECK-SAME: (ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
37 ; CHECK-NEXT: store i32 2, ptr [[P]], align 4
38 ; CHECK-NEXT: ret void
41 store i32 2, ptr %p, align 4
45 ; Function Attrs: convergent mustprogress noinline nounwind
46 define internal void @_Z12shared_writePi(ptr noundef %p) #0 {
47 ; CHECK: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(write)
48 ; CHECK-LABEL: define {{[^@]+}}@_Z12shared_writePi
49 ; CHECK-SAME: (ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR0]] {
51 ; CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr [[P]] to ptr addrspace(3)
52 ; CHECK-NEXT: store i32 3, ptr addrspace(3) [[TMP0]], align 4
53 ; CHECK-NEXT: ret void
56 store i32 3, ptr %p, align 4
60 ; Function Attrs: convergent mustprogress noinline nounwind
61 define internal void @_Z11global_readPi(ptr noundef %p) #0 {
62 ; CHECK: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn
63 ; CHECK-LABEL: define {{[^@]+}}@_Z11global_readPi
64 ; CHECK-SAME: (ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR1:[0-9]+]] {
66 ; CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr [[P]] to ptr addrspace(1)
67 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr addrspace(1) [[TMP0]], align 4
68 ; CHECK-NEXT: store i32 [[TMP1]], ptr addrspace(1) @dst, align 4
69 ; CHECK-NEXT: ret void
72 %0 = load i32, ptr %p, align 4
73 store i32 %0, ptr addrspacecast (ptr addrspace(1) @dst to ptr), align 4
77 ; Function Attrs: convergent mustprogress noinline nounwind
78 define internal void @_Z12unknown_readPi(ptr noundef %p) #0 {
79 ; CHECK: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn
80 ; CHECK-LABEL: define {{[^@]+}}@_Z12unknown_readPi
81 ; CHECK-SAME: (ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR1]] {
83 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[P]], align 4
84 ; CHECK-NEXT: store i32 [[TMP0]], ptr addrspace(1) @dst, align 4
85 ; CHECK-NEXT: ret void
88 %0 = load i32, ptr %p, align 4
89 store i32 %0, ptr addrspacecast (ptr addrspace(1) @dst to ptr), align 4
93 ; Function Attrs: convergent mustprogress noinline nounwind
94 define internal void @_Z11shared_readPi(ptr noundef %p) #0 {
95 ; CHECK: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn
96 ; CHECK-LABEL: define {{[^@]+}}@_Z11shared_readPi
97 ; CHECK-SAME: (ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[P:%.*]]) #[[ATTR1]] {
99 ; CHECK-NEXT: [[TMP0:%.*]] = addrspacecast ptr [[P]] to ptr addrspace(3)
100 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr addrspace(3) [[TMP0]], align 4
101 ; CHECK-NEXT: store i32 [[TMP1]], ptr addrspace(1) @dst, align 4
102 ; CHECK-NEXT: ret void
105 %0 = load i32, ptr %p, align 4
106 store i32 %0, ptr addrspacecast (ptr addrspace(1) @dst to ptr), align 4
110 ; Function Attrs: convergent mustprogress noinline nounwind
111 define dso_local void @_Z3bazv() #0 {
112 ; CHECK: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn
113 ; CHECK-LABEL: define {{[^@]+}}@_Z3bazv
114 ; CHECK-SAME: () #[[ATTR1]] {
116 ; CHECK-NEXT: call void @_Z12global_writePi(ptr nofree noundef nonnull writeonly align 4 dereferenceable(8) addrspacecast (ptr addrspace(1) @g1 to ptr)) #[[ATTR2:[0-9]+]]
117 ; CHECK-NEXT: call void @_Z12global_writePi(ptr nofree noundef nonnull writeonly align 4 dereferenceable(4) addrspacecast (ptr addrspace(1) @g2 to ptr)) #[[ATTR2]]
118 ; CHECK-NEXT: call void @_Z13unknown_writePi(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(8) addrspacecast (ptr addrspace(1) @g1 to ptr)) #[[ATTR2]]
119 ; CHECK-NEXT: call void @_Z13unknown_writePi(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) addrspacecast (ptr addrspace(3) @s1 to ptr)) #[[ATTR2]]
120 ; CHECK-NEXT: call void @_Z12shared_writePi(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) addrspacecast (ptr addrspace(3) @s1 to ptr)) #[[ATTR2]]
121 ; CHECK-NEXT: call void @_Z12shared_writePi(ptr nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) addrspacecast (ptr addrspace(3) @s2 to ptr)) #[[ATTR2]]
122 ; CHECK-NEXT: call void @_Z11global_readPi(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(8) addrspacecast (ptr addrspace(1) @g1 to ptr)) #[[ATTR3:[0-9]+]]
123 ; CHECK-NEXT: call void @_Z11global_readPi(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) addrspacecast (ptr addrspace(1) @g2 to ptr)) #[[ATTR3]]
124 ; CHECK-NEXT: call void @_Z12unknown_readPi(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(8) addrspacecast (ptr addrspace(1) @g1 to ptr)) #[[ATTR3]]
125 ; CHECK-NEXT: call void @_Z12unknown_readPi(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) addrspacecast (ptr addrspace(3) @s1 to ptr)) #[[ATTR3]]
126 ; CHECK-NEXT: call void @_Z11shared_readPi(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) addrspacecast (ptr addrspace(3) @s1 to ptr)) #[[ATTR3]]
127 ; CHECK-NEXT: call void @_Z11shared_readPi(ptr nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) addrspacecast (ptr addrspace(3) @s2 to ptr)) #[[ATTR3]]
128 ; CHECK-NEXT: ret void
131 call void @_Z12global_writePi(ptr noundef addrspacecast (ptr addrspace(1) @g1 to ptr)) #1
132 call void @_Z12global_writePi(ptr noundef addrspacecast (ptr addrspace(1) @g2 to ptr)) #1
133 call void @_Z13unknown_writePi(ptr noundef addrspacecast (ptr addrspace(1) @g1 to ptr)) #1
134 call void @_Z13unknown_writePi(ptr noundef addrspacecast (ptr addrspace(3) @s1 to ptr)) #1
135 call void @_Z12shared_writePi(ptr noundef addrspacecast (ptr addrspace(3) @s1 to ptr)) #1
136 call void @_Z12shared_writePi(ptr noundef addrspacecast (ptr addrspace(3) @s2 to ptr)) #1
137 call void @_Z11global_readPi(ptr noundef addrspacecast (ptr addrspace(1) @g1 to ptr)) #1
138 call void @_Z11global_readPi(ptr noundef addrspacecast (ptr addrspace(1) @g2 to ptr)) #1
139 call void @_Z12unknown_readPi(ptr noundef addrspacecast (ptr addrspace(1) @g1 to ptr)) #1
140 call void @_Z12unknown_readPi(ptr noundef addrspacecast (ptr addrspace(3) @s1 to ptr)) #1
141 call void @_Z11shared_readPi(ptr noundef addrspacecast (ptr addrspace(3) @s1 to ptr)) #1
142 call void @_Z11shared_readPi(ptr noundef addrspacecast (ptr addrspace(3) @s2 to ptr)) #1
146 attributes #0 = { convergent mustprogress noinline nounwind }
147 attributes #1 = { convergent nounwind }
149 ; CHECK: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(write) }
150 ; CHECK: attributes #[[ATTR1]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn }
151 ; CHECK: attributes #[[ATTR2]] = { convergent nofree nosync nounwind willreturn memory(write) }
152 ; CHECK: attributes #[[ATTR3]] = { convergent nofree nosync nounwind willreturn }