[PATCH] D124308: [MachineScheduler] exclude INLINEASM from schedule when it would increase register pressure

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 15:22:41 PDT 2022


nickdesaulniers created this revision.
nickdesaulniers added reviewers: pengfei, craig.topper, arsenm, lebedev.ri.
Herald added subscribers: StephenFan, ecnelises, javed.absar, hiraditya, MatzeB.
Herald added a project: All.
nickdesaulniers requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

INLINEASM with a large number of operands requires delicate
pre-register-allocation scheduling, so as not to exhaust the number of
physical registers allocatable to the INLINEASM.

Sinking a COPY of a PhysReg to a VirtReg closer to its use is
problematic when sunk past an INLINEASM that requires Physreg's of the
same register class. Doing so extends the LiveRange of the Physregs in a
way that register allocation may fail to allocate enough registers for
the inline asm, resulting in compile time failures for inline asm
statements that have many operands.

When we encounter and INLINEASM whose number of operands of any
particular TargetRegisterClass would be above the register pressure
limit of a given MachineFunction, split the scheduling boundary at the
INLINEASM.

Fixes: https://github.com/llvm/llvm-project/issues/41914


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124308

Files:
  llvm/lib/CodeGen/MachineScheduler.cpp
  llvm/lib/Target/X86/X86RegisterInfo.cpp
  llvm/test/CodeGen/X86/scheduler-asm-moves.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124308.424633.patch
Type: text/x-patch
Size: 6788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220422/ddb6aca0/attachment.bin>


More information about the llvm-commits mailing list