blob: 9f28407c76c4723cdeb9a3fc0a02e47953546878 [file] [log] [blame]
Johannes Doerfert25de3422021-03-11 23:21:32 -06001; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
Johannes Doerfert8d4df862020-09-07 19:56:51 -05002; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -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=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
Arthur Eubanks5a8075e2020-07-28 17:57:21 -07004; 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
Johannes Doerfert7a8805f2020-04-17 21:09:16 -05005; 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
Johannes Doerfert75e7dc52020-04-08 19:04:57 -05006
Hideto Ueno9a38ca02019-12-02 13:40:09 +00007
8@x = global i32 0
9
10declare void @test1_1(i8* %x1_1, i8* readonly %y1_1, ...)
11
12; NOTE: readonly for %y1_2 would be OK here but not for the similar situation in test13.
13;
Johannes Doerfert25de3422021-03-11 23:21:32 -060014;.
15; CHECK: @[[X:[a-zA-Z0-9_$"\\.-]+]] = global i32 0
16; CHECK: @[[CONSTANT_MEM:[a-zA-Z0-9_$"\\.-]+]] = external dso_local constant i32, align 4
17;.
Hideto Ueno9a38ca02019-12-02 13:40:09 +000018define void @test1_2(i8* %x1_2, i8* %y1_2, i8* %z1_2) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050019; CHECK-LABEL: define {{[^@]+}}@test1_2
sstefan1a9329d92020-08-29 19:31:13 +020020; CHECK-SAME: (i8* [[X1_2:%.*]], i8* [[Y1_2:%.*]], i8* [[Z1_2:%.*]]) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050021; CHECK-NEXT: call void (i8*, i8*, ...) @test1_1(i8* [[X1_2]], i8* readonly [[Y1_2]], i8* [[Z1_2]])
22; CHECK-NEXT: store i32 0, i32* @x, align 4
23; CHECK-NEXT: ret void
24;
Hideto Ueno9a38ca02019-12-02 13:40:09 +000025 call void (i8*, i8*, ...) @test1_1(i8* %x1_2, i8* %y1_2, i8* %z1_2)
26 store i32 0, i32* @x
27 ret void
28}
29
Hideto Ueno9a38ca02019-12-02 13:40:09 +000030define i8* @test2(i8* %p) {
sstefan135cfe172020-07-19 21:55:43 +020031; IS__TUNIT____: Function Attrs: nofree nosync nounwind willreturn writeonly
32; IS__TUNIT____-LABEL: define {{[^@]+}}@test2
Johannes Doerfert25de3422021-03-11 23:21:32 -060033; IS__TUNIT____-SAME: (i8* nofree readnone returned "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR0:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +020034; IS__TUNIT____-NEXT: store i32 0, i32* @x, align 4
35; IS__TUNIT____-NEXT: ret i8* [[P]]
36;
37; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
38; IS__CGSCC____-LABEL: define {{[^@]+}}@test2
Johannes Doerfert25de3422021-03-11 23:21:32 -060039; IS__CGSCC____-SAME: (i8* nofree readnone returned "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR0:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +020040; IS__CGSCC____-NEXT: store i32 0, i32* @x, align 4
41; IS__CGSCC____-NEXT: ret i8* [[P]]
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050042;
Hideto Ueno9a38ca02019-12-02 13:40:09 +000043 store i32 0, i32* @x
44 ret i8* %p
45}
46
Hideto Ueno9a38ca02019-12-02 13:40:09 +000047define i1 @test3(i8* %p, i8* %q) {
sstefan135cfe172020-07-19 21:55:43 +020048; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
49; IS__TUNIT____-LABEL: define {{[^@]+}}@test3
Johannes Doerfert25de3422021-03-11 23:21:32 -060050; IS__TUNIT____-SAME: (i8* nofree readnone [[P:%.*]], i8* nofree readnone [[Q:%.*]]) #[[ATTR1:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +020051; IS__TUNIT____-NEXT: [[A:%.*]] = icmp ult i8* [[P]], [[Q]]
52; IS__TUNIT____-NEXT: ret i1 [[A]]
53;
54; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
55; IS__CGSCC____-LABEL: define {{[^@]+}}@test3
Johannes Doerfert25de3422021-03-11 23:21:32 -060056; IS__CGSCC____-SAME: (i8* nofree readnone [[P:%.*]], i8* nofree readnone [[Q:%.*]]) #[[ATTR1:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +020057; IS__CGSCC____-NEXT: [[A:%.*]] = icmp ult i8* [[P]], [[Q]]
58; IS__CGSCC____-NEXT: ret i1 [[A]]
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050059;
Hideto Ueno9a38ca02019-12-02 13:40:09 +000060 %A = icmp ult i8* %p, %q
61 ret i1 %A
62}
63
64declare void @test4_1(i8* nocapture) readonly
65
Hideto Ueno9a38ca02019-12-02 13:40:09 +000066define void @test4_2(i8* %p) {
sstefan135cfe172020-07-19 21:55:43 +020067; CHECK: Function Attrs: readonly
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050068; CHECK-LABEL: define {{[^@]+}}@test4_2
Johannes Doerfert25de3422021-03-11 23:21:32 -060069; CHECK-SAME: (i8* nocapture readonly [[P:%.*]]) #[[ATTR2:[0-9]+]] {
70; CHECK-NEXT: call void @test4_1(i8* nocapture readonly [[P]]) #[[ATTR2]]
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050071; CHECK-NEXT: ret void
72;
Hideto Ueno9a38ca02019-12-02 13:40:09 +000073 call void @test4_1(i8* %p)
74 ret void
75}
76
Hideto Ueno9a38ca02019-12-02 13:40:09 +000077; Missed optz'n: we could make %q readnone, but don't break test6!
78define void @test5(i8** %p, i8* %q) {
sstefan135cfe172020-07-19 21:55:43 +020079; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
80; IS__TUNIT____-LABEL: define {{[^@]+}}@test5
Johannes Doerfert25de3422021-03-11 23:21:32 -060081; IS__TUNIT____-SAME: (i8** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[P:%.*]], i8* nofree writeonly [[Q:%.*]]) #[[ATTR3:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +020082; IS__TUNIT____-NEXT: store i8* [[Q]], i8** [[P]], align 8
83; IS__TUNIT____-NEXT: ret void
84;
85; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
86; IS__CGSCC____-LABEL: define {{[^@]+}}@test5
Johannes Doerfert25de3422021-03-11 23:21:32 -060087; IS__CGSCC____-SAME: (i8** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[P:%.*]], i8* nofree writeonly [[Q:%.*]]) #[[ATTR3:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +020088; IS__CGSCC____-NEXT: store i8* [[Q]], i8** [[P]], align 8
89; IS__CGSCC____-NEXT: ret void
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050090;
Hideto Ueno9a38ca02019-12-02 13:40:09 +000091 store i8* %q, i8** %p
92 ret void
93}
94
95declare void @test6_1()
Hideto Ueno9a38ca02019-12-02 13:40:09 +000096; This is not a missed optz'n.
97define void @test6_2(i8** %p, i8* %q) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -050098; CHECK-LABEL: define {{[^@]+}}@test6_2
aqjune187491d2021-02-13 16:22:25 +090099; CHECK-SAME: (i8** nocapture noundef nonnull writeonly align 8 dereferenceable(8) [[P:%.*]], i8* [[Q:%.*]]) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500100; CHECK-NEXT: store i8* [[Q]], i8** [[P]], align 8
101; CHECK-NEXT: call void @test6_1()
102; CHECK-NEXT: ret void
103;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000104 store i8* %q, i8** %p
105 call void @test6_1()
106 ret void
107}
108
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000109; inalloca parameters are always considered written
Nico Weber01c9b9c2021-03-28 13:02:52 -0400110define void @test7_1(i32* inalloca %a) {
sstefan135cfe172020-07-19 21:55:43 +0200111; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
112; IS__TUNIT____-LABEL: define {{[^@]+}}@test7_1
Nico Weber01c9b9c2021-03-28 13:02:52 -0400113; IS__TUNIT____-SAME: (i32* inalloca nocapture nofree nonnull writeonly dereferenceable(4) [[A:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200114; IS__TUNIT____-NEXT: ret void
115;
116; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
117; IS__CGSCC____-LABEL: define {{[^@]+}}@test7_1
Nico Weber01c9b9c2021-03-28 13:02:52 -0400118; IS__CGSCC____-SAME: (i32* inalloca nocapture nofree nonnull writeonly dereferenceable(4) [[A:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200119; IS__CGSCC____-NEXT: ret void
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500120;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000121 ret void
122}
123
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000124define i32* @test8_1(i32* %p) {
sstefan135cfe172020-07-19 21:55:43 +0200125; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
126; IS__TUNIT____-LABEL: define {{[^@]+}}@test8_1
Johannes Doerfert25de3422021-03-11 23:21:32 -0600127; IS__TUNIT____-SAME: (i32* nofree readnone returned "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200128; IS__TUNIT____-NEXT: entry:
129; IS__TUNIT____-NEXT: ret i32* [[P]]
130;
131; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
132; IS__CGSCC____-LABEL: define {{[^@]+}}@test8_1
Johannes Doerfert25de3422021-03-11 23:21:32 -0600133; IS__CGSCC____-SAME: (i32* nofree readnone returned "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200134; IS__CGSCC____-NEXT: entry:
135; IS__CGSCC____-NEXT: ret i32* [[P]]
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500136;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000137entry:
138 ret i32* %p
139}
140
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000141define void @test8_2(i32* %p) {
sstefan135cfe172020-07-19 21:55:43 +0200142; IS__TUNIT____: Function Attrs: nofree nosync nounwind willreturn writeonly
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500143; IS__TUNIT____-LABEL: define {{[^@]+}}@test8_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600144; IS__TUNIT____-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR0]] {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500145; IS__TUNIT____-NEXT: entry:
Johannes Doerfert25de3422021-03-11 23:21:32 -0600146; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @test8_1(i32* noalias nofree readnone "no-capture-maybe-returned" [[P]]) #[[ATTR1]]
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500147; IS__TUNIT____-NEXT: store i32 10, i32* [[CALL]], align 4
148; IS__TUNIT____-NEXT: ret void
149;
sstefan135cfe172020-07-19 21:55:43 +0200150; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500151; IS__CGSCC____-LABEL: define {{[^@]+}}@test8_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600152; IS__CGSCC____-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR3]] {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500153; IS__CGSCC____-NEXT: entry:
Johannes Doerfert25de3422021-03-11 23:21:32 -0600154; IS__CGSCC____-NEXT: [[CALL:%.*]] = call align 4 i32* @test8_1(i32* noalias nofree readnone "no-capture-maybe-returned" [[P]]) #[[ATTR11:[0-9]+]]
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500155; IS__CGSCC____-NEXT: store i32 10, i32* [[CALL]], align 4
156; IS__CGSCC____-NEXT: ret void
157;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000158entry:
159 %call = call i32* @test8_1(i32* %p)
160 store i32 10, i32* %call, align 4
161 ret void
162}
163
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500164; CHECK: declare void @llvm.masked.scatter
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000165declare void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32>%val, <4 x i32*>, i32, <4 x i1>)
166
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500167; CHECK-NOT: readnone
168; CHECK-NOT: readonly
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000169define void @test9(<4 x i32*> %ptrs, <4 x i32>%val) {
sstefan16520cb92020-10-15 13:04:36 +0200170; IS__TUNIT____: Function Attrs: nofree nosync nounwind willreturn writeonly
Matt Arsenaulta4188272020-06-25 19:17:24 -0400171; IS__TUNIT____-LABEL: define {{[^@]+}}@test9
Johannes Doerfert25de3422021-03-11 23:21:32 -0600172; IS__TUNIT____-SAME: (<4 x i32*> [[PTRS:%.*]], <4 x i32> [[VAL:%.*]]) #[[ATTR0]] {
173; IS__TUNIT____-NEXT: call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> [[VAL]], <4 x i32*> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>) #[[ATTR10:[0-9]+]]
Matt Arsenaulta4188272020-06-25 19:17:24 -0400174; IS__TUNIT____-NEXT: ret void
175;
sstefan16520cb92020-10-15 13:04:36 +0200176; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn writeonly
Matt Arsenaulta4188272020-06-25 19:17:24 -0400177; IS__CGSCC____-LABEL: define {{[^@]+}}@test9
Johannes Doerfert25de3422021-03-11 23:21:32 -0600178; IS__CGSCC____-SAME: (<4 x i32*> [[PTRS:%.*]], <4 x i32> [[VAL:%.*]]) #[[ATTR4:[0-9]+]] {
179; IS__CGSCC____-NEXT: call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32> [[VAL]], <4 x i32*> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>) #[[ATTR12:[0-9]+]]
Matt Arsenaulta4188272020-06-25 19:17:24 -0400180; IS__CGSCC____-NEXT: ret void
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500181;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000182 call void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32>%val, <4 x i32*> %ptrs, i32 4, <4 x i1><i1 true, i1 false, i1 true, i1 false>)
183 ret void
184}
185
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500186; CHECK: declare <4 x i32> @llvm.masked.gather
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000187declare <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*>, i32, <4 x i1>, <4 x i32>)
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000188define <4 x i32> @test10(<4 x i32*> %ptrs) {
sstefan16520cb92020-10-15 13:04:36 +0200189; IS__TUNIT____: Function Attrs: nofree nosync nounwind readonly willreturn
Matt Arsenaulta4188272020-06-25 19:17:24 -0400190; IS__TUNIT____-LABEL: define {{[^@]+}}@test10
Johannes Doerfert25de3422021-03-11 23:21:32 -0600191; IS__TUNIT____-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR4:[0-9]+]] {
192; IS__TUNIT____-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef) #[[ATTR11:[0-9]+]]
Matt Arsenaulta4188272020-06-25 19:17:24 -0400193; IS__TUNIT____-NEXT: ret <4 x i32> [[RES]]
194;
sstefan16520cb92020-10-15 13:04:36 +0200195; IS__CGSCC____: Function Attrs: nofree nosync nounwind readonly willreturn
Matt Arsenaulta4188272020-06-25 19:17:24 -0400196; IS__CGSCC____-LABEL: define {{[^@]+}}@test10
Johannes Doerfert25de3422021-03-11 23:21:32 -0600197; IS__CGSCC____-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR5:[0-9]+]] {
198; IS__CGSCC____-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> [[PTRS]], i32 noundef 4, <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef) #[[ATTR13:[0-9]+]]
Matt Arsenaulta4188272020-06-25 19:17:24 -0400199; IS__CGSCC____-NEXT: ret <4 x i32> [[RES]]
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500200;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000201 %res = call <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*> %ptrs, i32 4, <4 x i1><i1 true, i1 false, i1 true, i1 false>, <4 x i32>undef)
202 ret <4 x i32> %res
203}
204
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500205; CHECK: declare <4 x i32> @test11_1
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000206declare <4 x i32> @test11_1(<4 x i32*>) argmemonly nounwind readonly
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000207define <4 x i32> @test11_2(<4 x i32*> %ptrs) {
aqjune187491d2021-02-13 16:22:25 +0900208; IS__TUNIT____: Function Attrs: argmemonly nounwind readonly
209; IS__TUNIT____-LABEL: define {{[^@]+}}@test11_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600210; IS__TUNIT____-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR5:[0-9]+]] {
211; IS__TUNIT____-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x i32*> [[PTRS]]) #[[ATTR9:[0-9]+]]
aqjune187491d2021-02-13 16:22:25 +0900212; IS__TUNIT____-NEXT: ret <4 x i32> [[RES]]
213;
214; IS__CGSCC____: Function Attrs: argmemonly nounwind readonly
215; IS__CGSCC____-LABEL: define {{[^@]+}}@test11_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600216; IS__CGSCC____-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR6:[0-9]+]] {
217; IS__CGSCC____-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x i32*> [[PTRS]]) #[[ATTR10:[0-9]+]]
aqjune187491d2021-02-13 16:22:25 +0900218; IS__CGSCC____-NEXT: ret <4 x i32> [[RES]]
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500219;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000220 %res = call <4 x i32> @test11_1(<4 x i32*> %ptrs)
221 ret <4 x i32> %res
222}
223
224declare <4 x i32> @test12_1(<4 x i32*>) argmemonly nounwind
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500225; CHECK-NOT: readnone
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000226define <4 x i32> @test12_2(<4 x i32*> %ptrs) {
Matt Arsenaulta4188272020-06-25 19:17:24 -0400227; IS__TUNIT____: Function Attrs: argmemonly nounwind
228; IS__TUNIT____-LABEL: define {{[^@]+}}@test12_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600229; IS__TUNIT____-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR6:[0-9]+]] {
230; IS__TUNIT____-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x i32*> [[PTRS]]) #[[ATTR12:[0-9]+]]
Matt Arsenaulta4188272020-06-25 19:17:24 -0400231; IS__TUNIT____-NEXT: ret <4 x i32> [[RES]]
232;
233; IS__CGSCC____: Function Attrs: argmemonly nounwind
234; IS__CGSCC____-LABEL: define {{[^@]+}}@test12_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600235; IS__CGSCC____-SAME: (<4 x i32*> [[PTRS:%.*]]) #[[ATTR7:[0-9]+]] {
236; IS__CGSCC____-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x i32*> [[PTRS]]) #[[ATTR14:[0-9]+]]
Matt Arsenaulta4188272020-06-25 19:17:24 -0400237; IS__CGSCC____-NEXT: ret <4 x i32> [[RES]]
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500238;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000239 %res = call <4 x i32> @test12_1(<4 x i32*> %ptrs)
240 ret <4 x i32> %res
241}
242
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000243define i32 @volatile_load(i32* %p) {
sstefan135cfe172020-07-19 21:55:43 +0200244; IS__TUNIT____: Function Attrs: argmemonly nofree nounwind willreturn
245; IS__TUNIT____-LABEL: define {{[^@]+}}@volatile_load
Johannes Doerfert25de3422021-03-11 23:21:32 -0600246; IS__TUNIT____-SAME: (i32* nofree noundef align 4 [[P:%.*]]) #[[ATTR7:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +0200247; IS__TUNIT____-NEXT: [[LOAD:%.*]] = load volatile i32, i32* [[P]], align 4
248; IS__TUNIT____-NEXT: ret i32 [[LOAD]]
249;
250; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nounwind willreturn
251; IS__CGSCC____-LABEL: define {{[^@]+}}@volatile_load
Johannes Doerfert25de3422021-03-11 23:21:32 -0600252; IS__CGSCC____-SAME: (i32* nofree noundef align 4 [[P:%.*]]) #[[ATTR8:[0-9]+]] {
sstefan135cfe172020-07-19 21:55:43 +0200253; IS__CGSCC____-NEXT: [[LOAD:%.*]] = load volatile i32, i32* [[P]], align 4
254; IS__CGSCC____-NEXT: ret i32 [[LOAD]]
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500255;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000256 %load = load volatile i32, i32* %p
257 ret i32 %load
258}
259
260declare void @escape_readnone_ptr(i8** %addr, i8* readnone %ptr)
261declare void @escape_readonly_ptr(i8** %addr, i8* readonly %ptr)
262
263; The argument pointer %escaped_then_written cannot be marked readnone/only even
264; though the only direct use, in @escape_readnone_ptr/@escape_readonly_ptr,
265; is marked as readnone/only. However, the functions can write the pointer into
266; %addr, causing the store to write to %escaped_then_written.
267;
Florian Hahn38a092c2020-04-09 11:07:36 +0100268define void @unsound_readnone(i8* %ignored, i8* %escaped_then_written) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500269; CHECK-LABEL: define {{[^@]+}}@unsound_readnone
sstefan1a9329d92020-08-29 19:31:13 +0200270; CHECK-SAME: (i8* nocapture nofree readnone [[IGNORED:%.*]], i8* [[ESCAPED_THEN_WRITTEN:%.*]]) {
Johannes Doerfert12a8ab12020-07-10 10:37:31 -0500271; CHECK-NEXT: [[ADDR:%.*]] = alloca i8*, align 8
Shinji Okumura95004ff2020-08-18 18:04:47 +0900272; CHECK-NEXT: call void @escape_readnone_ptr(i8** noundef nonnull align 8 dereferenceable(8) [[ADDR]], i8* noalias readnone [[ESCAPED_THEN_WRITTEN]])
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500273; CHECK-NEXT: [[ADDR_LD:%.*]] = load i8*, i8** [[ADDR]], align 8
Johannes Doerferta0232f72020-05-10 13:16:49 -0500274; CHECK-NEXT: store i8 0, i8* [[ADDR_LD]], align 1
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500275; CHECK-NEXT: ret void
276;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000277 %addr = alloca i8*
278 call void @escape_readnone_ptr(i8** %addr, i8* %escaped_then_written)
279 %addr.ld = load i8*, i8** %addr
280 store i8 0, i8* %addr.ld
281 ret void
282}
283
284define void @unsound_readonly(i8* %ignored, i8* %escaped_then_written) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500285; CHECK-LABEL: define {{[^@]+}}@unsound_readonly
sstefan1a9329d92020-08-29 19:31:13 +0200286; CHECK-SAME: (i8* nocapture nofree readnone [[IGNORED:%.*]], i8* [[ESCAPED_THEN_WRITTEN:%.*]]) {
Johannes Doerfert12a8ab12020-07-10 10:37:31 -0500287; CHECK-NEXT: [[ADDR:%.*]] = alloca i8*, align 8
Shinji Okumura95004ff2020-08-18 18:04:47 +0900288; CHECK-NEXT: call void @escape_readonly_ptr(i8** noundef nonnull align 8 dereferenceable(8) [[ADDR]], i8* readonly [[ESCAPED_THEN_WRITTEN]])
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500289; CHECK-NEXT: [[ADDR_LD:%.*]] = load i8*, i8** [[ADDR]], align 8
Johannes Doerferta0232f72020-05-10 13:16:49 -0500290; CHECK-NEXT: store i8 0, i8* [[ADDR_LD]], align 1
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500291; CHECK-NEXT: ret void
292;
Hideto Ueno9a38ca02019-12-02 13:40:09 +0000293 %addr = alloca i8*
294 call void @escape_readonly_ptr(i8** %addr, i8* %escaped_then_written)
295 %addr.ld = load i8*, i8** %addr
296 store i8 0, i8* %addr.ld
297 ret void
298}
Johannes Doerfertecd54182019-12-12 15:02:36 -0600299
300; Byval but not readonly/none tests
301;
302;{
303declare void @escape_i8(i8* %ptr)
304
Matt Arsenault2a6a4302020-11-20 10:52:27 -0500305define void @byval_not_readonly_1(i8* byval(i8) %written) readonly {
sstefan135cfe172020-07-19 21:55:43 +0200306; CHECK: Function Attrs: readonly
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500307; CHECK-LABEL: define {{[^@]+}}@byval_not_readonly_1
Johannes Doerfert25de3422021-03-11 23:21:32 -0600308; CHECK-SAME: (i8* noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR2]] {
Johannes Doerferta0232f72020-05-10 13:16:49 -0500309; CHECK-NEXT: call void @escape_i8(i8* nonnull dereferenceable(1) [[WRITTEN]])
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500310; CHECK-NEXT: ret void
311;
Johannes Doerfertecd54182019-12-12 15:02:36 -0600312 call void @escape_i8(i8* %written)
313 ret void
314}
315
Matt Arsenault2a6a4302020-11-20 10:52:27 -0500316define void @byval_not_readonly_2(i8* byval(i8) %written) readonly {
sstefan135cfe172020-07-19 21:55:43 +0200317; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
318; IS__TUNIT____-LABEL: define {{[^@]+}}@byval_not_readonly_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600319; IS__TUNIT____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200320; IS__TUNIT____-NEXT: store i8 0, i8* [[WRITTEN]], align 1
321; IS__TUNIT____-NEXT: ret void
322;
323; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
324; IS__CGSCC____-LABEL: define {{[^@]+}}@byval_not_readonly_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600325; IS__CGSCC____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200326; IS__CGSCC____-NEXT: store i8 0, i8* [[WRITTEN]], align 1
327; IS__CGSCC____-NEXT: ret void
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500328;
Johannes Doerfertecd54182019-12-12 15:02:36 -0600329 store i8 0, i8* %written
330 ret void
331}
332
Matt Arsenault2a6a4302020-11-20 10:52:27 -0500333define void @byval_not_readnone_1(i8* byval(i8) %written) readnone {
Johannes Doerfert25de3422021-03-11 23:21:32 -0600334; IS__TUNIT____: Function Attrs: readnone
335; IS__TUNIT____-LABEL: define {{[^@]+}}@byval_not_readnone_1
336; IS__TUNIT____-SAME: (i8* noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR8:[0-9]+]] {
337; IS__TUNIT____-NEXT: call void @escape_i8(i8* nonnull dereferenceable(1) [[WRITTEN]])
338; IS__TUNIT____-NEXT: ret void
339;
340; IS__CGSCC____: Function Attrs: readnone
341; IS__CGSCC____-LABEL: define {{[^@]+}}@byval_not_readnone_1
342; IS__CGSCC____-SAME: (i8* noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR9:[0-9]+]] {
343; IS__CGSCC____-NEXT: call void @escape_i8(i8* nonnull dereferenceable(1) [[WRITTEN]])
344; IS__CGSCC____-NEXT: ret void
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500345;
Johannes Doerfertecd54182019-12-12 15:02:36 -0600346 call void @escape_i8(i8* %written)
347 ret void
348}
349
Matt Arsenault2a6a4302020-11-20 10:52:27 -0500350define void @byval_not_readnone_2(i8* byval(i8) %written) readnone {
sstefan135cfe172020-07-19 21:55:43 +0200351; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
352; IS__TUNIT____-LABEL: define {{[^@]+}}@byval_not_readnone_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600353; IS__TUNIT____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200354; IS__TUNIT____-NEXT: store i8 0, i8* [[WRITTEN]], align 1
355; IS__TUNIT____-NEXT: ret void
356;
357; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
358; IS__CGSCC____-LABEL: define {{[^@]+}}@byval_not_readnone_2
Johannes Doerfert25de3422021-03-11 23:21:32 -0600359; IS__CGSCC____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200360; IS__CGSCC____-NEXT: store i8 0, i8* [[WRITTEN]], align 1
361; IS__CGSCC____-NEXT: ret void
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500362;
Johannes Doerfertecd54182019-12-12 15:02:36 -0600363 store i8 0, i8* %written
364 ret void
365}
366
Matt Arsenault2a6a4302020-11-20 10:52:27 -0500367define void @byval_no_fnarg(i8* byval(i8) %written) {
sstefan135cfe172020-07-19 21:55:43 +0200368; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
369; IS__TUNIT____-LABEL: define {{[^@]+}}@byval_no_fnarg
Johannes Doerfert25de3422021-03-11 23:21:32 -0600370; IS__TUNIT____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200371; IS__TUNIT____-NEXT: store i8 0, i8* [[WRITTEN]], align 1
372; IS__TUNIT____-NEXT: ret void
373;
374; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
375; IS__CGSCC____-LABEL: define {{[^@]+}}@byval_no_fnarg
Johannes Doerfert25de3422021-03-11 23:21:32 -0600376; IS__CGSCC____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] {
sstefan135cfe172020-07-19 21:55:43 +0200377; IS__CGSCC____-NEXT: store i8 0, i8* [[WRITTEN]], align 1
378; IS__CGSCC____-NEXT: ret void
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500379;
Johannes Doerfertecd54182019-12-12 15:02:36 -0600380 store i8 0, i8* %written
381 ret void
382}
383
Johannes Doerfertecd54182019-12-12 15:02:36 -0600384define void @testbyval(i8* %read_only) {
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500385; IS__TUNIT____-LABEL: define {{[^@]+}}@testbyval
sstefan1a9329d92020-08-29 19:31:13 +0200386; IS__TUNIT____-SAME: (i8* nocapture readonly [[READ_ONLY:%.*]]) {
Johannes Doerfert25de3422021-03-11 23:21:32 -0600387; IS__TUNIT____-NEXT: call void @byval_not_readonly_1(i8* nocapture readonly [[READ_ONLY]]) #[[ATTR2]]
Johannes Doerfert8d4df862020-09-07 19:56:51 -0500388; IS__TUNIT____-NEXT: call void @byval_not_readnone_1(i8* noalias nocapture readnone [[READ_ONLY]])
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500389; IS__TUNIT____-NEXT: ret void
390;
sstefan135cfe172020-07-19 21:55:43 +0200391; IS__CGSCC____: Function Attrs: readonly
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500392; IS__CGSCC____-LABEL: define {{[^@]+}}@testbyval
Johannes Doerfert25de3422021-03-11 23:21:32 -0600393; IS__CGSCC____-SAME: (i8* nocapture noundef nonnull readonly dereferenceable(1) [[READ_ONLY:%.*]]) #[[ATTR2]] {
394; IS__CGSCC____-NEXT: call void @byval_not_readonly_1(i8* noalias nocapture noundef nonnull readonly dereferenceable(1) [[READ_ONLY]]) #[[ATTR2]]
aqjune187491d2021-02-13 16:22:25 +0900395; IS__CGSCC____-NEXT: call void @byval_not_readnone_1(i8* noalias nocapture noundef nonnull readnone dereferenceable(1) [[READ_ONLY]])
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500396; IS__CGSCC____-NEXT: ret void
397;
Johannes Doerfertecd54182019-12-12 15:02:36 -0600398 call void @byval_not_readonly_1(i8* %read_only)
399 call void @byval_not_readonly_2(i8* %read_only)
400 call void @byval_not_readnone_1(i8* %read_only)
401 call void @byval_not_readnone_2(i8* %read_only)
402 call void @byval_no_fnarg(i8* %read_only)
403 ret void
404}
405;}
Johannes Doerfert8ed047a2020-01-10 12:32:24 -0600406
407declare i8* @maybe_returned_ptr(i8* readonly %ptr) readonly nounwind
408declare i8 @maybe_returned_val(i8* %ptr) readonly nounwind
409declare void @val_use(i8 %ptr) readonly nounwind
410
411define void @ptr_uses(i8* %ptr) {
aqjune187491d2021-02-13 16:22:25 +0900412; IS__TUNIT____: Function Attrs: nounwind readonly
413; IS__TUNIT____-LABEL: define {{[^@]+}}@ptr_uses
Johannes Doerfert25de3422021-03-11 23:21:32 -0600414; IS__TUNIT____-SAME: (i8* nocapture readonly [[PTR:%.*]]) #[[ATTR9]] {
415; IS__TUNIT____-NEXT: [[CALL_PTR:%.*]] = call i8* @maybe_returned_ptr(i8* readonly [[PTR]]) #[[ATTR9]]
416; IS__TUNIT____-NEXT: [[CALL_VAL:%.*]] = call i8 @maybe_returned_val(i8* readonly [[CALL_PTR]]) #[[ATTR9]]
aqjune187491d2021-02-13 16:22:25 +0900417; IS__TUNIT____-NEXT: ret void
418;
419; IS__CGSCC____: Function Attrs: nounwind readonly
420; IS__CGSCC____-LABEL: define {{[^@]+}}@ptr_uses
Johannes Doerfert25de3422021-03-11 23:21:32 -0600421; IS__CGSCC____-SAME: (i8* nocapture readonly [[PTR:%.*]]) #[[ATTR10]] {
422; IS__CGSCC____-NEXT: [[CALL_PTR:%.*]] = call i8* @maybe_returned_ptr(i8* readonly [[PTR]]) #[[ATTR10]]
423; IS__CGSCC____-NEXT: [[CALL_VAL:%.*]] = call i8 @maybe_returned_val(i8* readonly [[CALL_PTR]]) #[[ATTR10]]
aqjune187491d2021-02-13 16:22:25 +0900424; IS__CGSCC____-NEXT: ret void
Johannes Doerfert75e7dc52020-04-08 19:04:57 -0500425;
Johannes Doerfert8ed047a2020-01-10 12:32:24 -0600426 %call_ptr = call i8* @maybe_returned_ptr(i8* %ptr)
427 %call_val = call i8 @maybe_returned_val(i8* %call_ptr)
428 call void @val_use(i8 %call_val)
429 ret void
430}
Johannes Doerfert6f8baa82020-09-07 17:55:05 -0500431
432define void @ptr_use_chain(i8* %ptr) {
433; CHECK-LABEL: define {{[^@]+}}@ptr_use_chain
Johannes Doerfertbcc48342020-09-08 20:18:54 -0500434; CHECK-SAME: (i8* [[PTR:%.*]]) {
Johannes Doerfert6f8baa82020-09-07 17:55:05 -0500435; CHECK-NEXT: [[BC0:%.*]] = bitcast i8* [[PTR]] to i32*
436; CHECK-NEXT: [[BC1:%.*]] = bitcast i32* [[BC0]] to i8*
437; CHECK-NEXT: [[BC2:%.*]] = bitcast i8* [[BC1]] to i32*
438; CHECK-NEXT: [[BC3:%.*]] = bitcast i32* [[BC2]] to i8*
439; CHECK-NEXT: [[BC4:%.*]] = bitcast i8* [[BC3]] to i32*
440; CHECK-NEXT: [[BC5:%.*]] = bitcast i32* [[BC4]] to i8*
441; CHECK-NEXT: [[BC6:%.*]] = bitcast i8* [[BC5]] to i32*
442; CHECK-NEXT: [[BC7:%.*]] = bitcast i32* [[BC6]] to i8*
443; CHECK-NEXT: [[BC8:%.*]] = bitcast i8* [[BC7]] to i32*
444; CHECK-NEXT: [[BC9:%.*]] = bitcast i32* [[BC8]] to i8*
445; CHECK-NEXT: [[ABC2:%.*]] = bitcast i8* [[BC9]] to i32*
446; CHECK-NEXT: [[ABC3:%.*]] = bitcast i32* [[ABC2]] to i8*
447; CHECK-NEXT: [[ABC4:%.*]] = bitcast i8* [[ABC3]] to i32*
448; CHECK-NEXT: [[ABC5:%.*]] = bitcast i32* [[ABC4]] to i8*
449; CHECK-NEXT: [[ABC6:%.*]] = bitcast i8* [[ABC5]] to i32*
450; CHECK-NEXT: [[ABC7:%.*]] = bitcast i32* [[ABC6]] to i8*
451; CHECK-NEXT: [[ABC8:%.*]] = bitcast i8* [[ABC7]] to i32*
452; CHECK-NEXT: [[ABC9:%.*]] = bitcast i32* [[ABC8]] to i8*
453; CHECK-NEXT: call void @escape_i8(i8* [[ABC9]])
454; CHECK-NEXT: ret void
455;
456 %bc0 = bitcast i8* %ptr to i32*
457 %bc1 = bitcast i32* %bc0 to i8*
458 %bc2 = bitcast i8* %bc1 to i32*
459 %bc3 = bitcast i32* %bc2 to i8*
460 %bc4 = bitcast i8* %bc3 to i32*
461 %bc5 = bitcast i32* %bc4 to i8*
462 %bc6 = bitcast i8* %bc5 to i32*
463 %bc7 = bitcast i32* %bc6 to i8*
464 %bc8 = bitcast i8* %bc7 to i32*
465 %bc9 = bitcast i32* %bc8 to i8*
466 %abc2 = bitcast i8* %bc9 to i32*
467 %abc3 = bitcast i32* %abc2 to i8*
468 %abc4 = bitcast i8* %abc3 to i32*
469 %abc5 = bitcast i32* %abc4 to i8*
470 %abc6 = bitcast i8* %abc5 to i32*
471 %abc7 = bitcast i32* %abc6 to i8*
472 %abc8 = bitcast i8* %abc7 to i32*
473 %abc9 = bitcast i32* %abc8 to i8*
474 call void @escape_i8(i8* %abc9)
475 ret void
476}
Johannes Doerfert45b37192020-09-09 00:41:46 -0500477
478@constant_mem = external dso_local constant i32, align 4
479define i32 @read_only_constant_mem() {
480; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
481; IS__TUNIT____-LABEL: define {{[^@]+}}@read_only_constant_mem
Johannes Doerfert25de3422021-03-11 23:21:32 -0600482; IS__TUNIT____-SAME: () #[[ATTR1]] {
Johannes Doerfert45b37192020-09-09 00:41:46 -0500483; IS__TUNIT____-NEXT: [[L:%.*]] = load i32, i32* @constant_mem, align 4
484; IS__TUNIT____-NEXT: ret i32 [[L]]
485;
486; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
487; IS__CGSCC____-LABEL: define {{[^@]+}}@read_only_constant_mem
Johannes Doerfert25de3422021-03-11 23:21:32 -0600488; IS__CGSCC____-SAME: () #[[ATTR1]] {
Johannes Doerfert45b37192020-09-09 00:41:46 -0500489; IS__CGSCC____-NEXT: [[L:%.*]] = load i32, i32* @constant_mem, align 4
490; IS__CGSCC____-NEXT: ret i32 [[L]]
491;
492 %l = load i32, i32* @constant_mem
493 ret i32 %l
494}
Johannes Doerfert25de3422021-03-11 23:21:32 -0600495;.
496; IS__TUNIT____: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn writeonly }
497; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
498; IS__TUNIT____: attributes #[[ATTR2]] = { readonly }
499; IS__TUNIT____: attributes #[[ATTR3]] = { argmemonly nofree nosync nounwind willreturn writeonly }
500; IS__TUNIT____: attributes #[[ATTR4]] = { nofree nosync nounwind readonly willreturn }
501; IS__TUNIT____: attributes #[[ATTR5]] = { argmemonly nounwind readonly }
502; IS__TUNIT____: attributes #[[ATTR6]] = { argmemonly nounwind }
503; IS__TUNIT____: attributes #[[ATTR7]] = { argmemonly nofree nounwind willreturn }
504; IS__TUNIT____: attributes #[[ATTR8]] = { readnone }
505; IS__TUNIT____: attributes #[[ATTR9]] = { nounwind readonly }
506; IS__TUNIT____: attributes #[[ATTR10]] = { willreturn writeonly }
507; IS__TUNIT____: attributes #[[ATTR11]] = { readonly willreturn }
508; IS__TUNIT____: attributes #[[ATTR12]] = { nounwind }
509;.
510; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind willreturn writeonly }
511; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
512; IS__CGSCC____: attributes #[[ATTR2]] = { readonly }
513; IS__CGSCC____: attributes #[[ATTR3]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
514; IS__CGSCC____: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn writeonly }
515; IS__CGSCC____: attributes #[[ATTR5]] = { nofree nosync nounwind readonly willreturn }
516; IS__CGSCC____: attributes #[[ATTR6]] = { argmemonly nounwind readonly }
517; IS__CGSCC____: attributes #[[ATTR7]] = { argmemonly nounwind }
518; IS__CGSCC____: attributes #[[ATTR8]] = { argmemonly nofree norecurse nounwind willreturn }
519; IS__CGSCC____: attributes #[[ATTR9]] = { readnone }
520; IS__CGSCC____: attributes #[[ATTR10]] = { nounwind readonly }
Johannes Doerfert979d5c62021-01-05 16:55:54 -0600521; IS__CGSCC____: attributes #[[ATTR11]] = { readnone willreturn }
Johannes Doerfert25de3422021-03-11 23:21:32 -0600522; IS__CGSCC____: attributes #[[ATTR12]] = { willreturn writeonly }
523; IS__CGSCC____: attributes #[[ATTR13]] = { readonly willreturn }
524; IS__CGSCC____: attributes #[[ATTR14]] = { nounwind }
525;.