[PATCH] D71089: [AMDGPU] Optimizing unnecessary copies for REG_SEQUENCE PHI operand. Also fixes rocBLAS error

Alexander via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 13:22:23 PST 2019


alex-t created this revision.
alex-t added reviewers: rampitec, vpykhtin.
Herald added subscribers: hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, wdng, jvesely, kzhuravl, arsenm.
Herald added a project: LLVM.

This change optimizes out unnecessary copies that appear in the case when the PHI node input register is defined by the REG_SEQUENCE.
The REG_SEQUENCE not necessarily is located in the PHI's predecessor block.

rocBLAS error is really caused by the subregisters tracking bug. PostRA Machine Sink cannot discover that sreg_32 writes are defining superreg that is used as source operand in subsequent COPY.  Machine Sink then sinks the superreg COPY to the "THEN" block of the branch but the copies of sreg32 that deine superreg COPY source operand - to the "ELSE" block. As a result "THEN" block receives uninitialized register.
This issue is going to be addressed in separate change later on.

The optimization in current change removes the IR pattern that triggers the Machine Sink bug.
Since it need to be done anyway to remove unnecessary copies, it goes first.


https://reviews.llvm.org/D71089

Files:
  llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
  llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
  llvm/lib/Target/AMDGPU/SIInstrInfo.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71089.232439.patch
Type: text/x-patch
Size: 7001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191205/783b3f71/attachment.bin>


More information about the llvm-commits mailing list