Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals |
Johannes Doerfert | 8d4df86 | 2020-09-07 19:56:51 -0500 | [diff] [blame] | 2 | ; 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 Eubanks | 5a8075e | 2020-07-28 17:57:21 -0700 | [diff] [blame] | 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 |
Johannes Doerfert | 7a8805f | 2020-04-17 21:09:16 -0500 | [diff] [blame] | 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 |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 6 | |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 7 | |
| 8 | @x = global i32 0 |
| 9 | |
| 10 | declare 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 14 | ;. |
| 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 Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 18 | define void @test1_2(i8* %x1_2, i8* %y1_2, i8* %z1_2) { |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 19 | ; CHECK-LABEL: define {{[^@]+}}@test1_2 |
sstefan1 | a9329d9 | 2020-08-29 19:31:13 +0200 | [diff] [blame] | 20 | ; CHECK-SAME: (i8* [[X1_2:%.*]], i8* [[Y1_2:%.*]], i8* [[Z1_2:%.*]]) { |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 21 | ; 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 Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 25 | 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 Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 30 | define i8* @test2(i8* %p) { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 31 | ; IS__TUNIT____: Function Attrs: nofree nosync nounwind willreturn writeonly |
| 32 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@test2 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 33 | ; IS__TUNIT____-SAME: (i8* nofree readnone returned "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR0:[0-9]+]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 34 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 39 | ; IS__CGSCC____-SAME: (i8* nofree readnone returned "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR0:[0-9]+]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 40 | ; IS__CGSCC____-NEXT: store i32 0, i32* @x, align 4 |
| 41 | ; IS__CGSCC____-NEXT: ret i8* [[P]] |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 42 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 43 | store i32 0, i32* @x |
| 44 | ret i8* %p |
| 45 | } |
| 46 | |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 47 | define i1 @test3(i8* %p, i8* %q) { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 48 | ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn |
| 49 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@test3 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 50 | ; IS__TUNIT____-SAME: (i8* nofree readnone [[P:%.*]], i8* nofree readnone [[Q:%.*]]) #[[ATTR1:[0-9]+]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 51 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 56 | ; IS__CGSCC____-SAME: (i8* nofree readnone [[P:%.*]], i8* nofree readnone [[Q:%.*]]) #[[ATTR1:[0-9]+]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 57 | ; IS__CGSCC____-NEXT: [[A:%.*]] = icmp ult i8* [[P]], [[Q]] |
| 58 | ; IS__CGSCC____-NEXT: ret i1 [[A]] |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 59 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 60 | %A = icmp ult i8* %p, %q |
| 61 | ret i1 %A |
| 62 | } |
| 63 | |
| 64 | declare void @test4_1(i8* nocapture) readonly |
| 65 | |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 66 | define void @test4_2(i8* %p) { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 67 | ; CHECK: Function Attrs: readonly |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 68 | ; CHECK-LABEL: define {{[^@]+}}@test4_2 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 69 | ; CHECK-SAME: (i8* nocapture readonly [[P:%.*]]) #[[ATTR2:[0-9]+]] { |
| 70 | ; CHECK-NEXT: call void @test4_1(i8* nocapture readonly [[P]]) #[[ATTR2]] |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 71 | ; CHECK-NEXT: ret void |
| 72 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 73 | call void @test4_1(i8* %p) |
| 74 | ret void |
| 75 | } |
| 76 | |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 77 | ; Missed optz'n: we could make %q readnone, but don't break test6! |
| 78 | define void @test5(i8** %p, i8* %q) { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 79 | ; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly |
| 80 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@test5 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 81 | ; IS__TUNIT____-SAME: (i8** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[P:%.*]], i8* nofree writeonly [[Q:%.*]]) #[[ATTR3:[0-9]+]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 82 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 87 | ; IS__CGSCC____-SAME: (i8** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[P:%.*]], i8* nofree writeonly [[Q:%.*]]) #[[ATTR3:[0-9]+]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 88 | ; IS__CGSCC____-NEXT: store i8* [[Q]], i8** [[P]], align 8 |
| 89 | ; IS__CGSCC____-NEXT: ret void |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 90 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 91 | store i8* %q, i8** %p |
| 92 | ret void |
| 93 | } |
| 94 | |
| 95 | declare void @test6_1() |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 96 | ; This is not a missed optz'n. |
| 97 | define void @test6_2(i8** %p, i8* %q) { |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 98 | ; CHECK-LABEL: define {{[^@]+}}@test6_2 |
aqjune | 187491d | 2021-02-13 16:22:25 +0900 | [diff] [blame] | 99 | ; CHECK-SAME: (i8** nocapture noundef nonnull writeonly align 8 dereferenceable(8) [[P:%.*]], i8* [[Q:%.*]]) { |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 100 | ; CHECK-NEXT: store i8* [[Q]], i8** [[P]], align 8 |
| 101 | ; CHECK-NEXT: call void @test6_1() |
| 102 | ; CHECK-NEXT: ret void |
| 103 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 104 | store i8* %q, i8** %p |
| 105 | call void @test6_1() |
| 106 | ret void |
| 107 | } |
| 108 | |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 109 | ; inalloca parameters are always considered written |
Nico Weber | 01c9b9c | 2021-03-28 13:02:52 -0400 | [diff] [blame^] | 110 | define void @test7_1(i32* inalloca %a) { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 111 | ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn |
| 112 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@test7_1 |
Nico Weber | 01c9b9c | 2021-03-28 13:02:52 -0400 | [diff] [blame^] | 113 | ; IS__TUNIT____-SAME: (i32* inalloca nocapture nofree nonnull writeonly dereferenceable(4) [[A:%.*]]) #[[ATTR1]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 114 | ; 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 Weber | 01c9b9c | 2021-03-28 13:02:52 -0400 | [diff] [blame^] | 118 | ; IS__CGSCC____-SAME: (i32* inalloca nocapture nofree nonnull writeonly dereferenceable(4) [[A:%.*]]) #[[ATTR1]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 119 | ; IS__CGSCC____-NEXT: ret void |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 120 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 121 | ret void |
| 122 | } |
| 123 | |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 124 | define i32* @test8_1(i32* %p) { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 125 | ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn |
| 126 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@test8_1 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 127 | ; IS__TUNIT____-SAME: (i32* nofree readnone returned "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR1]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 128 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 133 | ; IS__CGSCC____-SAME: (i32* nofree readnone returned "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR1]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 134 | ; IS__CGSCC____-NEXT: entry: |
| 135 | ; IS__CGSCC____-NEXT: ret i32* [[P]] |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 136 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 137 | entry: |
| 138 | ret i32* %p |
| 139 | } |
| 140 | |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 141 | define void @test8_2(i32* %p) { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 142 | ; IS__TUNIT____: Function Attrs: nofree nosync nounwind willreturn writeonly |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 143 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@test8_2 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 144 | ; IS__TUNIT____-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR0]] { |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 145 | ; IS__TUNIT____-NEXT: entry: |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 146 | ; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @test8_1(i32* noalias nofree readnone "no-capture-maybe-returned" [[P]]) #[[ATTR1]] |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 147 | ; IS__TUNIT____-NEXT: store i32 10, i32* [[CALL]], align 4 |
| 148 | ; IS__TUNIT____-NEXT: ret void |
| 149 | ; |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 150 | ; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 151 | ; IS__CGSCC____-LABEL: define {{[^@]+}}@test8_2 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 152 | ; IS__CGSCC____-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR3]] { |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 153 | ; IS__CGSCC____-NEXT: entry: |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 154 | ; IS__CGSCC____-NEXT: [[CALL:%.*]] = call align 4 i32* @test8_1(i32* noalias nofree readnone "no-capture-maybe-returned" [[P]]) #[[ATTR11:[0-9]+]] |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 155 | ; IS__CGSCC____-NEXT: store i32 10, i32* [[CALL]], align 4 |
| 156 | ; IS__CGSCC____-NEXT: ret void |
| 157 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 158 | entry: |
| 159 | %call = call i32* @test8_1(i32* %p) |
| 160 | store i32 10, i32* %call, align 4 |
| 161 | ret void |
| 162 | } |
| 163 | |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 164 | ; CHECK: declare void @llvm.masked.scatter |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 165 | declare void @llvm.masked.scatter.v4i32.v4p0i32(<4 x i32>%val, <4 x i32*>, i32, <4 x i1>) |
| 166 | |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 167 | ; CHECK-NOT: readnone |
| 168 | ; CHECK-NOT: readonly |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 169 | define void @test9(<4 x i32*> %ptrs, <4 x i32>%val) { |
sstefan1 | 6520cb9 | 2020-10-15 13:04:36 +0200 | [diff] [blame] | 170 | ; IS__TUNIT____: Function Attrs: nofree nosync nounwind willreturn writeonly |
Matt Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 171 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@test9 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 172 | ; 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 Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 174 | ; IS__TUNIT____-NEXT: ret void |
| 175 | ; |
sstefan1 | 6520cb9 | 2020-10-15 13:04:36 +0200 | [diff] [blame] | 176 | ; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn writeonly |
Matt Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 177 | ; IS__CGSCC____-LABEL: define {{[^@]+}}@test9 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 178 | ; 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 Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 180 | ; IS__CGSCC____-NEXT: ret void |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 181 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 182 | 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 Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 186 | ; CHECK: declare <4 x i32> @llvm.masked.gather |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 187 | declare <4 x i32> @llvm.masked.gather.v4i32.v4p0i32(<4 x i32*>, i32, <4 x i1>, <4 x i32>) |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 188 | define <4 x i32> @test10(<4 x i32*> %ptrs) { |
sstefan1 | 6520cb9 | 2020-10-15 13:04:36 +0200 | [diff] [blame] | 189 | ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readonly willreturn |
Matt Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 190 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@test10 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 191 | ; 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 Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 193 | ; IS__TUNIT____-NEXT: ret <4 x i32> [[RES]] |
| 194 | ; |
sstefan1 | 6520cb9 | 2020-10-15 13:04:36 +0200 | [diff] [blame] | 195 | ; IS__CGSCC____: Function Attrs: nofree nosync nounwind readonly willreturn |
Matt Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 196 | ; IS__CGSCC____-LABEL: define {{[^@]+}}@test10 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 197 | ; 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 Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 199 | ; IS__CGSCC____-NEXT: ret <4 x i32> [[RES]] |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 200 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 201 | %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 Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 205 | ; CHECK: declare <4 x i32> @test11_1 |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 206 | declare <4 x i32> @test11_1(<4 x i32*>) argmemonly nounwind readonly |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 207 | define <4 x i32> @test11_2(<4 x i32*> %ptrs) { |
aqjune | 187491d | 2021-02-13 16:22:25 +0900 | [diff] [blame] | 208 | ; IS__TUNIT____: Function Attrs: argmemonly nounwind readonly |
| 209 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@test11_2 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 210 | ; 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]+]] |
aqjune | 187491d | 2021-02-13 16:22:25 +0900 | [diff] [blame] | 212 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 216 | ; 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]+]] |
aqjune | 187491d | 2021-02-13 16:22:25 +0900 | [diff] [blame] | 218 | ; IS__CGSCC____-NEXT: ret <4 x i32> [[RES]] |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 219 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 220 | %res = call <4 x i32> @test11_1(<4 x i32*> %ptrs) |
| 221 | ret <4 x i32> %res |
| 222 | } |
| 223 | |
| 224 | declare <4 x i32> @test12_1(<4 x i32*>) argmemonly nounwind |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 225 | ; CHECK-NOT: readnone |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 226 | define <4 x i32> @test12_2(<4 x i32*> %ptrs) { |
Matt Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 227 | ; IS__TUNIT____: Function Attrs: argmemonly nounwind |
| 228 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@test12_2 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 229 | ; 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 Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 231 | ; IS__TUNIT____-NEXT: ret <4 x i32> [[RES]] |
| 232 | ; |
| 233 | ; IS__CGSCC____: Function Attrs: argmemonly nounwind |
| 234 | ; IS__CGSCC____-LABEL: define {{[^@]+}}@test12_2 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 235 | ; 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 Arsenault | a418827 | 2020-06-25 19:17:24 -0400 | [diff] [blame] | 237 | ; IS__CGSCC____-NEXT: ret <4 x i32> [[RES]] |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 238 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 239 | %res = call <4 x i32> @test12_1(<4 x i32*> %ptrs) |
| 240 | ret <4 x i32> %res |
| 241 | } |
| 242 | |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 243 | define i32 @volatile_load(i32* %p) { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 244 | ; IS__TUNIT____: Function Attrs: argmemonly nofree nounwind willreturn |
| 245 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@volatile_load |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 246 | ; IS__TUNIT____-SAME: (i32* nofree noundef align 4 [[P:%.*]]) #[[ATTR7:[0-9]+]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 247 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 252 | ; IS__CGSCC____-SAME: (i32* nofree noundef align 4 [[P:%.*]]) #[[ATTR8:[0-9]+]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 253 | ; IS__CGSCC____-NEXT: [[LOAD:%.*]] = load volatile i32, i32* [[P]], align 4 |
| 254 | ; IS__CGSCC____-NEXT: ret i32 [[LOAD]] |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 255 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 256 | %load = load volatile i32, i32* %p |
| 257 | ret i32 %load |
| 258 | } |
| 259 | |
| 260 | declare void @escape_readnone_ptr(i8** %addr, i8* readnone %ptr) |
| 261 | declare 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 Hahn | 38a092c | 2020-04-09 11:07:36 +0100 | [diff] [blame] | 268 | define void @unsound_readnone(i8* %ignored, i8* %escaped_then_written) { |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 269 | ; CHECK-LABEL: define {{[^@]+}}@unsound_readnone |
sstefan1 | a9329d9 | 2020-08-29 19:31:13 +0200 | [diff] [blame] | 270 | ; CHECK-SAME: (i8* nocapture nofree readnone [[IGNORED:%.*]], i8* [[ESCAPED_THEN_WRITTEN:%.*]]) { |
Johannes Doerfert | 12a8ab1 | 2020-07-10 10:37:31 -0500 | [diff] [blame] | 271 | ; CHECK-NEXT: [[ADDR:%.*]] = alloca i8*, align 8 |
Shinji Okumura | 95004ff | 2020-08-18 18:04:47 +0900 | [diff] [blame] | 272 | ; CHECK-NEXT: call void @escape_readnone_ptr(i8** noundef nonnull align 8 dereferenceable(8) [[ADDR]], i8* noalias readnone [[ESCAPED_THEN_WRITTEN]]) |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 273 | ; CHECK-NEXT: [[ADDR_LD:%.*]] = load i8*, i8** [[ADDR]], align 8 |
Johannes Doerfert | a0232f7 | 2020-05-10 13:16:49 -0500 | [diff] [blame] | 274 | ; CHECK-NEXT: store i8 0, i8* [[ADDR_LD]], align 1 |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 275 | ; CHECK-NEXT: ret void |
| 276 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 277 | %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 | |
| 284 | define void @unsound_readonly(i8* %ignored, i8* %escaped_then_written) { |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 285 | ; CHECK-LABEL: define {{[^@]+}}@unsound_readonly |
sstefan1 | a9329d9 | 2020-08-29 19:31:13 +0200 | [diff] [blame] | 286 | ; CHECK-SAME: (i8* nocapture nofree readnone [[IGNORED:%.*]], i8* [[ESCAPED_THEN_WRITTEN:%.*]]) { |
Johannes Doerfert | 12a8ab1 | 2020-07-10 10:37:31 -0500 | [diff] [blame] | 287 | ; CHECK-NEXT: [[ADDR:%.*]] = alloca i8*, align 8 |
Shinji Okumura | 95004ff | 2020-08-18 18:04:47 +0900 | [diff] [blame] | 288 | ; CHECK-NEXT: call void @escape_readonly_ptr(i8** noundef nonnull align 8 dereferenceable(8) [[ADDR]], i8* readonly [[ESCAPED_THEN_WRITTEN]]) |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 289 | ; CHECK-NEXT: [[ADDR_LD:%.*]] = load i8*, i8** [[ADDR]], align 8 |
Johannes Doerfert | a0232f7 | 2020-05-10 13:16:49 -0500 | [diff] [blame] | 290 | ; CHECK-NEXT: store i8 0, i8* [[ADDR_LD]], align 1 |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 291 | ; CHECK-NEXT: ret void |
| 292 | ; |
Hideto Ueno | 9a38ca0 | 2019-12-02 13:40:09 +0000 | [diff] [blame] | 293 | %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 Doerfert | ecd5418 | 2019-12-12 15:02:36 -0600 | [diff] [blame] | 299 | |
| 300 | ; Byval but not readonly/none tests |
| 301 | ; |
| 302 | ;{ |
| 303 | declare void @escape_i8(i8* %ptr) |
| 304 | |
Matt Arsenault | 2a6a430 | 2020-11-20 10:52:27 -0500 | [diff] [blame] | 305 | define void @byval_not_readonly_1(i8* byval(i8) %written) readonly { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 306 | ; CHECK: Function Attrs: readonly |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 307 | ; CHECK-LABEL: define {{[^@]+}}@byval_not_readonly_1 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 308 | ; CHECK-SAME: (i8* noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR2]] { |
Johannes Doerfert | a0232f7 | 2020-05-10 13:16:49 -0500 | [diff] [blame] | 309 | ; CHECK-NEXT: call void @escape_i8(i8* nonnull dereferenceable(1) [[WRITTEN]]) |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 310 | ; CHECK-NEXT: ret void |
| 311 | ; |
Johannes Doerfert | ecd5418 | 2019-12-12 15:02:36 -0600 | [diff] [blame] | 312 | call void @escape_i8(i8* %written) |
| 313 | ret void |
| 314 | } |
| 315 | |
Matt Arsenault | 2a6a430 | 2020-11-20 10:52:27 -0500 | [diff] [blame] | 316 | define void @byval_not_readonly_2(i8* byval(i8) %written) readonly { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 317 | ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn |
| 318 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@byval_not_readonly_2 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 319 | ; IS__TUNIT____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 320 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 325 | ; IS__CGSCC____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 326 | ; IS__CGSCC____-NEXT: store i8 0, i8* [[WRITTEN]], align 1 |
| 327 | ; IS__CGSCC____-NEXT: ret void |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 328 | ; |
Johannes Doerfert | ecd5418 | 2019-12-12 15:02:36 -0600 | [diff] [blame] | 329 | store i8 0, i8* %written |
| 330 | ret void |
| 331 | } |
| 332 | |
Matt Arsenault | 2a6a430 | 2020-11-20 10:52:27 -0500 | [diff] [blame] | 333 | define void @byval_not_readnone_1(i8* byval(i8) %written) readnone { |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 334 | ; 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 Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 345 | ; |
Johannes Doerfert | ecd5418 | 2019-12-12 15:02:36 -0600 | [diff] [blame] | 346 | call void @escape_i8(i8* %written) |
| 347 | ret void |
| 348 | } |
| 349 | |
Matt Arsenault | 2a6a430 | 2020-11-20 10:52:27 -0500 | [diff] [blame] | 350 | define void @byval_not_readnone_2(i8* byval(i8) %written) readnone { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 351 | ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn |
| 352 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@byval_not_readnone_2 |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 353 | ; IS__TUNIT____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 354 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 359 | ; IS__CGSCC____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 360 | ; IS__CGSCC____-NEXT: store i8 0, i8* [[WRITTEN]], align 1 |
| 361 | ; IS__CGSCC____-NEXT: ret void |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 362 | ; |
Johannes Doerfert | ecd5418 | 2019-12-12 15:02:36 -0600 | [diff] [blame] | 363 | store i8 0, i8* %written |
| 364 | ret void |
| 365 | } |
| 366 | |
Matt Arsenault | 2a6a430 | 2020-11-20 10:52:27 -0500 | [diff] [blame] | 367 | define void @byval_no_fnarg(i8* byval(i8) %written) { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 368 | ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn |
| 369 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@byval_no_fnarg |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 370 | ; IS__TUNIT____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 371 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 376 | ; IS__CGSCC____-SAME: (i8* noalias nocapture nofree noundef nonnull writeonly byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] { |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 377 | ; IS__CGSCC____-NEXT: store i8 0, i8* [[WRITTEN]], align 1 |
| 378 | ; IS__CGSCC____-NEXT: ret void |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 379 | ; |
Johannes Doerfert | ecd5418 | 2019-12-12 15:02:36 -0600 | [diff] [blame] | 380 | store i8 0, i8* %written |
| 381 | ret void |
| 382 | } |
| 383 | |
Johannes Doerfert | ecd5418 | 2019-12-12 15:02:36 -0600 | [diff] [blame] | 384 | define void @testbyval(i8* %read_only) { |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 385 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@testbyval |
sstefan1 | a9329d9 | 2020-08-29 19:31:13 +0200 | [diff] [blame] | 386 | ; IS__TUNIT____-SAME: (i8* nocapture readonly [[READ_ONLY:%.*]]) { |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 387 | ; IS__TUNIT____-NEXT: call void @byval_not_readonly_1(i8* nocapture readonly [[READ_ONLY]]) #[[ATTR2]] |
Johannes Doerfert | 8d4df86 | 2020-09-07 19:56:51 -0500 | [diff] [blame] | 388 | ; IS__TUNIT____-NEXT: call void @byval_not_readnone_1(i8* noalias nocapture readnone [[READ_ONLY]]) |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 389 | ; IS__TUNIT____-NEXT: ret void |
| 390 | ; |
sstefan1 | 35cfe17 | 2020-07-19 21:55:43 +0200 | [diff] [blame] | 391 | ; IS__CGSCC____: Function Attrs: readonly |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 392 | ; IS__CGSCC____-LABEL: define {{[^@]+}}@testbyval |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 393 | ; 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]] |
aqjune | 187491d | 2021-02-13 16:22:25 +0900 | [diff] [blame] | 395 | ; IS__CGSCC____-NEXT: call void @byval_not_readnone_1(i8* noalias nocapture noundef nonnull readnone dereferenceable(1) [[READ_ONLY]]) |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 396 | ; IS__CGSCC____-NEXT: ret void |
| 397 | ; |
Johannes Doerfert | ecd5418 | 2019-12-12 15:02:36 -0600 | [diff] [blame] | 398 | 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 Doerfert | 8ed047a | 2020-01-10 12:32:24 -0600 | [diff] [blame] | 406 | |
| 407 | declare i8* @maybe_returned_ptr(i8* readonly %ptr) readonly nounwind |
| 408 | declare i8 @maybe_returned_val(i8* %ptr) readonly nounwind |
| 409 | declare void @val_use(i8 %ptr) readonly nounwind |
| 410 | |
| 411 | define void @ptr_uses(i8* %ptr) { |
aqjune | 187491d | 2021-02-13 16:22:25 +0900 | [diff] [blame] | 412 | ; IS__TUNIT____: Function Attrs: nounwind readonly |
| 413 | ; IS__TUNIT____-LABEL: define {{[^@]+}}@ptr_uses |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 414 | ; 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]] |
aqjune | 187491d | 2021-02-13 16:22:25 +0900 | [diff] [blame] | 417 | ; IS__TUNIT____-NEXT: ret void |
| 418 | ; |
| 419 | ; IS__CGSCC____: Function Attrs: nounwind readonly |
| 420 | ; IS__CGSCC____-LABEL: define {{[^@]+}}@ptr_uses |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 421 | ; 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]] |
aqjune | 187491d | 2021-02-13 16:22:25 +0900 | [diff] [blame] | 424 | ; IS__CGSCC____-NEXT: ret void |
Johannes Doerfert | 75e7dc5 | 2020-04-08 19:04:57 -0500 | [diff] [blame] | 425 | ; |
Johannes Doerfert | 8ed047a | 2020-01-10 12:32:24 -0600 | [diff] [blame] | 426 | %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 Doerfert | 6f8baa8 | 2020-09-07 17:55:05 -0500 | [diff] [blame] | 431 | |
| 432 | define void @ptr_use_chain(i8* %ptr) { |
| 433 | ; CHECK-LABEL: define {{[^@]+}}@ptr_use_chain |
Johannes Doerfert | bcc4834 | 2020-09-08 20:18:54 -0500 | [diff] [blame] | 434 | ; CHECK-SAME: (i8* [[PTR:%.*]]) { |
Johannes Doerfert | 6f8baa8 | 2020-09-07 17:55:05 -0500 | [diff] [blame] | 435 | ; 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 Doerfert | 45b3719 | 2020-09-09 00:41:46 -0500 | [diff] [blame] | 477 | |
| 478 | @constant_mem = external dso_local constant i32, align 4 |
| 479 | define 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 482 | ; IS__TUNIT____-SAME: () #[[ATTR1]] { |
Johannes Doerfert | 45b3719 | 2020-09-09 00:41:46 -0500 | [diff] [blame] | 483 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 488 | ; IS__CGSCC____-SAME: () #[[ATTR1]] { |
Johannes Doerfert | 45b3719 | 2020-09-09 00:41:46 -0500 | [diff] [blame] | 489 | ; 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 Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 495 | ;. |
| 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 Doerfert | 979d5c6 | 2021-01-05 16:55:54 -0600 | [diff] [blame] | 521 | ; IS__CGSCC____: attributes #[[ATTR11]] = { readnone willreturn } |
Johannes Doerfert | 25de342 | 2021-03-11 23:21:32 -0600 | [diff] [blame] | 522 | ; IS__CGSCC____: attributes #[[ATTR12]] = { willreturn writeonly } |
| 523 | ; IS__CGSCC____: attributes #[[ATTR13]] = { readonly willreturn } |
| 524 | ; IS__CGSCC____: attributes #[[ATTR14]] = { nounwind } |
| 525 | ;. |