[PATCH] D130427: RegAllocGreedy: Avoid overflowing priority bitfields
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 25 02:24:30 PDT 2022
foad added inline comments.
================
Comment at: llvm/lib/CodeGen/RegAllocGreedy.cpp:332-333
+ // 30 Preference priority
+ // 29 Global bit
+ // 28-24 AllocPriority
+ // 0-23 Size/Instr distance
----------------
These two get swapped by RegClassPriorityTrumpsGlobalness.
================
Comment at: llvm/lib/Target/PowerPC/PPCRegisterInfoMMA.td:80
// ACC registers.
- let AllocationPriority = 36;
+ let AllocationPriority = 30;
+ let GlobalPriority = true;
----------------
Shouldn't this be 36 - 32 = 4 to preserve current behaviour?
================
Comment at: llvm/utils/TableGen/CodeGenRegisters.cpp:806
int AllocationPriority = R->getValueAsInt("AllocationPriority");
- if (AllocationPriority < 0 || AllocationPriority > 63)
- PrintFatalError(R->getLoc(), "AllocationPriority out of range [0,63]");
+ if (AllocationPriority < 0 || !isUInt<5>(AllocationPriority))
+ PrintFatalError(R->getLoc(), "AllocationPriority out of range [0,31]");
----------------
The `< 0` check seems redundant.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130427/new/
https://reviews.llvm.org/D130427
More information about the llvm-commits
mailing list