[PATCH] D118458: [AMDGPU] Add test for a problem with noclobber metadata

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 28 05:08:55 PST 2022


foad created this revision.
foad added reviewers: arsenm, rampitec, alex-t, critson.
Herald added subscribers: kerbowa, t-tye, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
foad requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118458

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


Index: llvm/test/CodeGen/AMDGPU/global_smrd.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/global_smrd.ll
+++ llvm/test/CodeGen/AMDGPU/global_smrd.ll
@@ -23,6 +23,24 @@
   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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118458.403978.patch
Type: text/x-patch
Size: 971 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220128/c6fd4fbc/attachment.bin>


More information about the llvm-commits mailing list