summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2022-01-28 13:05:39 +0000
committerJay Foad <jay.foad@amd.com>2022-01-31 11:09:34 +0000
commitae68b3a4577633a7be9e97319d39a7bc3cf37ee4 (patch)
tree92e37ddaafee1a87c3b11efb34461b9334cb1ab3
parentffd0e464b4b98ffa9a511b09dd36cfba33fed8a1 (diff)
[AMDGPU] Add test for a problem with noclobber metadata
If AMDGPUAnnotateUniformValues finds a load from a uniform pointer with no potentially clobbering stores between the kernel entry point and the load instruction, it adds noclobber metadata to the *address*. This is unsafe because it can get applied to other loads in the same which do have aliasing stores. Differential Revision: https://reviews.llvm.org/D118458
-rw-r--r--llvm/test/CodeGen/AMDGPU/global_smrd.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/global_smrd.ll b/llvm/test/CodeGen/AMDGPU/global_smrd.ll
index e3ac344dc0ee..56d4b0faa4d3 100644
--- a/llvm/test/CodeGen/AMDGPU/global_smrd.ll
+++ b/llvm/test/CodeGen/AMDGPU/global_smrd.ll
@@ -23,6 +23,24 @@ bb:
ret void
}
+; uniform loads before and after an aliasing store
+; FIXME: The second load should not be converted to an SMEM load!
+; CHECK-LABEL: @uniform_load_store_load
+; CHECK: s_load_dwordx4
+; CHECK: s_load_dword
+; CHECK: flat_store_dword
+; CHECK: s_load_dword
+; CHECK: flat_store_dword
+
+define amdgpu_kernel void @uniform_load_store_load(float addrspace(1)* %arg0, float addrspace(1)* %arg1) {
+bb:
+ %tmp2 = load float, float addrspace(1)* %arg0, !tbaa !8
+ store float %tmp2, float addrspace(1)* %arg1, !tbaa !8
+ %tmp3 = load float, float addrspace(1)* %arg0, !tbaa !8
+ store float %tmp3, float addrspace(1)* %arg1, !tbaa !8
+ ret void
+}
+
; non-uniform loads
; CHECK-LABEL: @non-uniform_load
; CHECK: flat_load_dword