[PATCH] D75086: [AArch64][GlobalISel] Fixup <32b heterogeneous regbanks of G_PHIs just before selection.

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 15:06:34 PST 2020


aemerson created this revision.
aemerson added reviewers: paquette, qcolombet.
Herald added subscribers: hiraditya, kristof.beyls, rovka.
Herald added a project: LLVM.

Since all types <32b on gpr end up being assigned gpr32 regclasses, we can end up with PHIs here which try to select between a gpr32 and an fpr16. Ideally RBS shouldn't be selecting heterogenous regbanks for operands if possible, but we still need to be able to deal with it here.

To fix this, if we have a gpr-bank operand < 32b in size and at least one other operand is on the fpr bank, then we add cross-bank copies to homogenize the operand banks. For simplicity the bank that we choose to settle on is whatever bank the def operand has. For example:

  %endbb:
        %dst:gpr(s16) = G_PHI %in1:gpr(s16), %bb1, %in2:fpr(s16), %bb2
       =>
  %bb2:
        ...
        %in2_copy:gpr(s16) = COPY %in2:fpr(s16)
        ...
  %endbb:
        %dst:gpr(s16) = G_PHI %in1:gpr(s16), %bb1, %in2_copy:gpr(s16), %bb2


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75086

Files:
  llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/preselect-process-phis.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75086.246320.patch
Type: text/x-patch
Size: 8581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200224/d0a56ff9/attachment.bin>


More information about the llvm-commits mailing list