[PATCH] D63162: GlobalISel: Avoid producing Illegal copies in RegBankSelect

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 13:21:36 PDT 2019


arsenm created this revision.
arsenm added a reviewer: qcolombet.
Herald added subscribers: Petar.Avramovic, volkan, tpr, kristof.beyls, rovka, nhaehnle, wdng, jvesely.

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.


https://reviews.llvm.org/D63162

Files:
  include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
  lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
  lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
  test/CodeGen/AMDGPU/GlobalISel/regbankselect-illegal-copy.mir
  test/CodeGen/AMDGPU/GlobalISel/regbankselect-phi.mir
  test/CodeGen/AMDGPU/GlobalISel/regbankselect-reg-sequence.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63162.204149.patch
Type: text/x-patch
Size: 20672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190611/c23ea1f9/attachment.bin>


More information about the llvm-commits mailing list