[PATCH] D92907: [RegisterClassInfo] Return non-zero for RC without allocatable reg
Jinsong Ji via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 5 08:19:03 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf26bc0ddd508: [RegisterClassInfo] Return non-zero for RC without allocatable reg (authored by jsji).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92907/new/
https://reviews.llvm.org/D92907
Files:
llvm/lib/CodeGen/RegisterClassInfo.cpp
llvm/test/CodeGen/PowerPC/compute-regpressure.ll
Index: llvm/test/CodeGen/PowerPC/compute-regpressure.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/compute-regpressure.ll
+++ llvm/test/CodeGen/PowerPC/compute-regpressure.ll
@@ -1,7 +1,7 @@
; REQUIRES: asserts
; RUN: llc -debug-only=regalloc < %s 2>&1 |FileCheck %s --check-prefix=DEBUG
-; DEBUG-COUNT-3: AllocationOrder(VRSAVERC) = [ ]
+; DEBUG-COUNT-1: AllocationOrder(VRSAVERC) = [ ]
target triple = "powerpc64le-unknown-linux-gnu"
Index: llvm/lib/CodeGen/RegisterClassInfo.cpp
===================================================================
--- llvm/lib/CodeGen/RegisterClassInfo.cpp
+++ llvm/lib/CodeGen/RegisterClassInfo.cpp
@@ -188,7 +188,14 @@
}
assert(RC && "Failed to find register class");
compute(RC);
- unsigned NReserved = RC->getNumRegs() - getNumAllocatableRegs(RC);
- return TRI->getRegPressureSetLimit(*MF, Idx) -
- TRI->getRegClassWeight(RC).RegWeight * NReserved;
+ unsigned NAllocatableRegs = getNumAllocatableRegs(RC);
+ unsigned RegPressureSetLimit = TRI->getRegPressureSetLimit(*MF, Idx);
+ // If all the regs are reserved, return raw RegPressureSetLimit.
+ // One example is VRSAVERC in PowerPC.
+ // Avoid returning zero, getRegPressureSetLimit(Idx) assumes computePSetLimit
+ // return non-zero value.
+ if (NAllocatableRegs == 0)
+ return RegPressureSetLimit;
+ unsigned NReserved = RC->getNumRegs() - NAllocatableRegs;
+ return RegPressureSetLimit - TRI->getRegClassWeight(RC).RegWeight * NReserved;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92907.314621.patch
Type: text/x-patch
Size: 1548 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210105/6ff9eda7/attachment.bin>
More information about the llvm-commits
mailing list