[PATCH] D137813: [RegAlloc Greedy]Account statepoints while splitting single basic block

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 20:39:57 PST 2022


skatkov created this revision.
skatkov added reviewers: reames, qcolombet, arsenm, dantrushin.
Herald added subscribers: pengfei, hiraditya, MatzeB.
Herald added a project: All.
skatkov requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

When Greedy Register Allocator takes a decision whether it makes
sense to split single block it consider multiple uses as must
split condition. However there are instructions which can
accept the operand on stack with the same efficiency as on register.
An example of such instruction is statepoint.

Split single basic block expects that we enter on stack and exit
on stack the basic block. If there are multiple uses it makes sense
to do unsplit before the first use and split after the last use.
If we decide not to split we will do only unsplit before each use
and no spills if there is no defs.

This is exactly a case to cover in this change.
We have only one use which is not a statepoint. So we will do
an unspill before this use and nothing for statepoints.

As a result we avoid to do a redundant unspill and reduce the
register preasure in this basic block.


https://reviews.llvm.org/D137813

Files:
  llvm/include/llvm/CodeGen/StackMaps.h
  llvm/lib/CodeGen/SplitKit.cpp
  llvm/lib/CodeGen/SplitKit.h
  llvm/lib/CodeGen/StackMaps.cpp
  llvm/test/CodeGen/AArch64/regalloc-last-chance-recolor-with-split.mir
  llvm/test/CodeGen/X86/statepoint-invoke-ra.mir
  llvm/test/CodeGen/X86/statepoint-ra.ll
  llvm/test/CodeGen/X86/statepoint-split-single-block.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137813.474652.patch
Type: text/x-patch
Size: 49691 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221111/fed777b7/attachment.bin>


More information about the llvm-commits mailing list