diff options
author | Noah Goldstein <goldstein.w.n@gmail.com> | 2024-05-02 18:35:31 -0500 |
---|---|---|
committer | Noah Goldstein <goldstein.w.n@gmail.com> | 2024-05-03 14:10:24 -0500 |
commit | f8ff51e1b08643b23f90e1a39c3fb55a23d2dc84 (patch) | |
tree | c06b8012cba9295caaad75e65fa65795e7662125 | |
parent | 70b79a9ccd03f93fc4c8464a91b6bef3aab322d3 (diff) |
[Inliner] Add tests for not propagating `writable` if `readonly` is present; NFC
-rw-r--r-- | llvm/test/Transforms/Inline/access-attributes-prop.ll | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/llvm/test/Transforms/Inline/access-attributes-prop.ll b/llvm/test/Transforms/Inline/access-attributes-prop.ll index 3b4a59897c56..c242472f083d 100644 --- a/llvm/test/Transforms/Inline/access-attributes-prop.ll +++ b/llvm/test/Transforms/Inline/access-attributes-prop.ll @@ -5,7 +5,7 @@ declare void @bar1(ptr %p) declare void @bar2(ptr %p, ptr %p2) - +declare void @bar3(ptr writable %p) define dso_local void @foo1_rdonly(ptr readonly %p) { ; CHECK-LABEL: define {{[^@]+}}@foo1_rdonly ; CHECK-SAME: (ptr readonly [[P:%.*]]) { @@ -26,6 +26,27 @@ define dso_local void @foo1(ptr %p) { ret void } +define dso_local void @foo1_writable(ptr %p) { +; CHECK-LABEL: define {{[^@]+}}@foo1_writable +; CHECK-SAME: (ptr [[P:%.*]]) { +; CHECK-NEXT: call void @bar1(ptr writable [[P]]) +; CHECK-NEXT: ret void +; + call void @bar1(ptr writable %p) + ret void +} + +define dso_local void @foo3_writable(ptr %p) { +; CHECK-LABEL: define {{[^@]+}}@foo3_writable +; CHECK-SAME: (ptr [[P:%.*]]) { +; CHECK-NEXT: call void @bar3(ptr [[P]]) +; CHECK-NEXT: ret void +; + call void @bar3(ptr %p) + ret void +} + + define dso_local void @foo1_bar_aligned64_deref512(ptr %p) { ; CHECK-LABEL: define {{[^@]+}}@foo1_bar_aligned64_deref512 ; CHECK-SAME: (ptr [[P:%.*]]) { @@ -496,3 +517,25 @@ define void @prop_cb_def_mustprogress(ptr %p) { call void @foo1(ptr %p) mustprogress ret void } + +define void @prop_no_conflict_writable(ptr %p) { +; CHECK-LABEL: define {{[^@]+}}@prop_no_conflict_writable +; CHECK-SAME: (ptr [[P:%.*]]) { +; CHECK-NEXT: call void @bar1(ptr writable [[P]]) +; CHECK-NEXT: ret void +; + call void @foo1_writable(ptr readonly %p) + ret void +} + + +define void @prop_no_conflict_writable2(ptr %p) { +; CHECK-LABEL: define {{[^@]+}}@prop_no_conflict_writable2 +; CHECK-SAME: (ptr [[P:%.*]]) { +; CHECK-NEXT: call void @bar3(ptr [[P]]) +; CHECK-NEXT: ret void +; + call void @foo3_writable(ptr readnone %p) + ret void +} + |