AMDGPU: Fix SILoadStoreOptimizer when writes cannot be merged due register dependencies
authorNicolai Haehnle <nhaehnle@gmail.com>
Thu, 27 Oct 2016 08:15:07 +0000 (08:15 +0000)
committerNicolai Haehnle <nhaehnle@gmail.com>
Thu, 27 Oct 2016 08:15:07 +0000 (08:15 +0000)
commit7b0e25b7ad98a8c8970ee49a768b88b1dd5e043f
tree95cec42bb929a03c5407ba5ebbd9f761183eb2fb
parent00009d48247477bb1f904a46dfca405cea16ed30
AMDGPU: Fix SILoadStoreOptimizer when writes cannot be merged due register dependencies

Summary:
When finding a match for a merge and collecting the instructions that must
be moved, keep in mind that the instruction we merge might actually use one
of the defs that are being moved.

Fixes piglit spec/arb_enhanced_layouts/execution/component-layout/vs-tcs-load-output[-indirect].

The fact that the ds_read in the test case is not eliminated suggests that
there might be another problem related to alias analysis, but that's a
separate problem: this pass should still work correctly even when earlier
optimization passes missed something or were disabled.

Reviewers: tstellarAMD, arsenm

Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, tony-tye

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

llvm-svn: 285273
llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp
llvm/test/CodeGen/AMDGPU/merge-store-usedef.ll [new file with mode: 0644]