[llvm] ae68b3a - [AMDGPU] Add test for a problem with noclobber metadata

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 03:09:39 PST 2022


Author: Jay Foad
Date: 2022-01-31T11:09:34Z
New Revision: ae68b3a4577633a7be9e97319d39a7bc3cf37ee4

URL: https://github.com/llvm/llvm-project/commit/ae68b3a4577633a7be9e97319d39a7bc3cf37ee4
DIFF: https://github.com/llvm/llvm-project/commit/ae68b3a4577633a7be9e97319d39a7bc3cf37ee4.diff

LOG: [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

Added: 
    

Modified: 
    llvm/test/CodeGen/AMDGPU/global_smrd.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/AMDGPU/global_smrd.ll b/llvm/test/CodeGen/AMDGPU/global_smrd.ll
index e3ac344dc0ee3..56d4b0faa4d30 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


        


More information about the llvm-commits mailing list