]> granicus.if.org Git - llvm/commit
GlobalISel: Avoid producing Illegal copies in RegBankSelect
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 14 Jun 2019 15:22:25 +0000 (15:22 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 14 Jun 2019 15:22:25 +0000 (15:22 +0000)
commit697e6923d12b19b9b6f2fa23661fff101a154c88
treebc9ae6aecb41a719eb7be21110fad86a765141e0
parent31b94430d787da5b96b2eed0502cc5adb58bea14
GlobalISel: Avoid producing Illegal copies in RegBankSelect

Avoid producing illegal register bank copies for reg_sequence and
phi. The default implementation assumes it is possible to pick any
operand's bank and use that for the result, introducing a copy for
operands with a different bank. This does not check for illegal
copies. It is not legal to introduce a VGPR->SGPR copy, so any VGPR
operand requires the result to be a VGPR.

The changes in getInstrMappingImpl aren't strictly necessary, since
AMDGPU now just bypasses this for reg_sequence/phi. This could be
replaced with an assert in case other targets run into this. It is
currently responsible for producing the error for unsatisfiable
copies, but this will be better served with a verifier check.

For phis, for now assume any undetermined operands must be
VGPRs. Eventually, this needs to be able to defer mapping these
operations. This also does not yet have a way to check for whether the
block is in a divergent region.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363410 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
test/CodeGen/AMDGPU/GlobalISel/regbankselect-illegal-copy.mir [new file with mode: 0644]
test/CodeGen/AMDGPU/GlobalISel/regbankselect-phi.mir
test/CodeGen/AMDGPU/GlobalISel/regbankselect-reg-sequence.mir