]> granicus.if.org Git - llvm/commit
[AMDGPU] Fix illegal agpr use by VALU
authorStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Wed, 2 Oct 2019 23:23:46 +0000 (23:23 +0000)
committerStanislav Mekhanoshin <Stanislav.Mekhanoshin@amd.com>
Wed, 2 Oct 2019 23:23:46 +0000 (23:23 +0000)
commit60eeded1a40b0d2132dcc7a2dcfead7e94d4ed52
treedbe4fbc1639e0fee7feeb5ac53d620cb232516ff
parente49e59bb45e26f9983847f18dba32d2cfd986da7
[AMDGPU] Fix illegal agpr use by VALU

When SIFixSGPRCopies attempts to fix an illegal copy from vector to
scalar register it calls moveToVALU(). A copy from an agpr to sgpr
becomes a copy from agpr to agpr, which may result in the illegal
register class at a use of this copy.

Solution is to copy it always into a vgpr. This may result in a
subsequent copy into an agpr if that is what really needed, however
should not happen too often and likely will be folded later.

The opposite situation may not happen because an sgpr is always
illegal where agpr is legal, so such user instructions may not
exist.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373544 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AMDGPU/SIInstrInfo.cpp
test/CodeGen/AMDGPU/fold_acc_copy_into_valu.mir [new file with mode: 0644]
test/CodeGen/AMDGPU/illegal-sgpr-to-vgpr-copy.ll