[AMDGPU] Fix the SDWA Peephole phase to handle src for dst:UNUSED_PRESERVE.
authorMichael Bedy <mjbedy@gmail.com>
Fri, 30 Mar 2018 05:03:36 +0000 (05:03 +0000)
committerMichael Bedy <mjbedy@gmail.com>
Fri, 30 Mar 2018 05:03:36 +0000 (05:03 +0000)
commit59e5ef793c587cee64b8b10c4be48ec0aef0a126
tree3b312935127b05e89fe73ec4c1785f487cdc54f3
parenta7d614c3e58400e9b053b3eaba969a7e77b26945
[AMDGPU] Fix the SDWA Peephole phase to handle src for dst:UNUSED_PRESERVE.

Summary:
The phase attempts to transform operations that extract a portion of a value
into an SDWA src operand in cases where that value is used only once. It
was not prepared for this use to be the preserved portion of a value for
dst:UNUSED_PRESERVE, resulting in a crash or assert.

This change either rejects the illegal SDWA attempt, or in the case where
dst:WORD_1 and the src_sel would be WORD_0, removes the unneeded
extract instruction.

Reviewers: arsenm, #amdgpu

Reviewed By: arsenm, #amdgpu

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

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

llvm-svn: 328856
llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
llvm/test/CodeGen/AMDGPU/sdwa-preserve.mir