[PATCH] D96015: [RegAllocFast] Handle case where operand of copy cannot be assigned.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 04:26:46 PST 2021


fhahn created this revision.
fhahn added reviewers: qcolombet, t.p.northover, aemerson, arsenm.
Herald added subscribers: pengfei, hiraditya, MatzeB.
fhahn requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

This patch adds special handling to detect the case where we try to
assign a register to the VReg use of a copy, but all registers in the
required class are pre-assigned. We cannot assign such registers and
error out later.

Instead, we can try to move the use right after the definition, in the
hope that one of the registers in the class gets freed up.

This scenario can happen when assigning registers to copies to physical
registers for a function call, so initially this is limited to copies to
physical registers.

The only extra cost in practice should be the scan of the register
class. Finding the defining MI should only be needed in cases where we
would run out of registers otherwise.

I am planning to convert the test case into a MIR test case, but I'd
like to make sure the patch is on the right track first.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96015

Files:
  llvm/lib/CodeGen/RegAllocFast.cpp
  llvm/test/CodeGen/X86/regallocfast-need-to-move-copy.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96015.321382.patch
Type: text/x-patch
Size: 5833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210204/97dec615/attachment-0001.bin>


More information about the llvm-commits mailing list