[AMDGPU] Allow scalar loads after barrier
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Fri, 28 Jan 2022 00:27:43 +0000 (16:27 -0800)
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Tue, 1 Feb 2022 19:43:17 +0000 (11:43 -0800)
commitc2b18a3cc5bd6cae49372c2367445b480989db0d
treeeb91d408da1135f9fdf09f2d13ff171707931681
parent8e75536e510460bedcfdafb38d58cdfb7bb66111
[AMDGPU] Allow scalar loads after barrier

Currently we cannot convert a vector load into scalar if there
is dominating barrier or fence. It is considered a clobbering
memory access to prevent memory operations reordering. While
reordering is not possible the actual memory is not being clobbered
by a barrier or fence and we can still use a scalar load for a
uniform pointer.

The solution is not to bail on a first clobbering access but
traverse MemorySSA to the root excluding barriers and fences.

Differential Revision: https://reviews.llvm.org/D118419
llvm/lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp
llvm/test/CodeGen/AMDGPU/noclobber-barrier.ll [new file with mode: 0644]