AMDGPU: Consider memory dependencies with moved instructions in SILoadStoreOptimizer
authorNicolai Haehnle <nhaehnle@gmail.com>
Wed, 22 Nov 2017 12:25:21 +0000 (12:25 +0000)
committerNicolai Haehnle <nhaehnle@gmail.com>
Wed, 22 Nov 2017 12:25:21 +0000 (12:25 +0000)
commitdd059c161d6fbb2caf9bba34fbfaf66cdec7c6ce
treeaf31fa7c3d984732b8752a26302d8a77c6585e4c
parentf70c5beb228e44861557f6757bbd2f983c964b6b
AMDGPU: Consider memory dependencies with moved instructions in SILoadStoreOptimizer

Summary:
This bug seems to have gone unnoticed because critical cases with LDS
instructions are eliminated by the peephole optimizer.

However, equivalent situations arise with buffer loads and stores
as well, so this fixes regressions since r317751 ("AMDGPU: Merge
S_BUFFER_LOAD_DWORD_IMM into x2, x4").

Fixes at least:
KHR-GL45.shader_storage_buffer_object.basic-operations-case1-cs
KHR-GL45.cull_distance.functional
piglit tes-input-gl_ClipDistance.shader_test
... and probably more

Change-Id: I0e371536288eb8e6afeaa241a185266fd45d129d

Reviewers: arsenm, mareko, rampitec

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Differential Revision: https://reviews.llvm.org/D40303

llvm-svn: 318829
llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp
llvm/test/CodeGen/AMDGPU/merge-load-store.mir [new file with mode: 0644]