[PATCH] D130427: RegAllocGreedy: Avoid overflowing priority bitfields

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 23 09:56:55 PDT 2022


arsenm created this revision.
arsenm added reviewers: qcolombet, MatzeB, foad, stefanp, nemanjai, qiucf.
Herald added subscribers: kosarev, kbarton, hiraditya, tpr.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

The class priority is expected to be at most 5 bits before it starts
clobbering bits used for other fields. Also clamp the instruction
distance in case we have millions of instructions.

      

AMDGPU was accidentally overflowing into the global priority bit in
some cases. I think in principal we would have wanted this, but in the
cases I've looked at, it had the counter intuitive effect and
de-prioritized the large register tuple.

      

Avoid using weird bit hack PPC uses for global priority. The
AllocationPriority field is really 5 bits, and PPC was relying on
overflowing this to 6-bits to forcibly set the global priority
bit. Split this out as a separate flag to avoid having magic behavior
for values above 31.


https://reviews.llvm.org/D130427

Files:
  llvm/include/llvm/CodeGen/TargetRegisterInfo.h
  llvm/include/llvm/Target/Target.td
  llvm/lib/CodeGen/RegAllocGreedy.cpp
  llvm/lib/Target/PowerPC/PPCRegisterInfoMMA.td
  llvm/utils/TableGen/CodeGenRegisters.cpp
  llvm/utils/TableGen/CodeGenRegisters.h
  llvm/utils/TableGen/RegisterInfoEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130427.447081.patch
Type: text/x-patch
Size: 7789 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220723/89a62b28/attachment.bin>


More information about the llvm-commits mailing list