[llvm] [MachineSink] Use `RegisterClassInfo::getRegPressureSetLimit` (PR #119830)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 22:49:28 PST 2024


https://github.com/wangpc-pp updated https://github.com/llvm/llvm-project/pull/119830

>From e74f73a551b37ffea25360e6c04348c05944c89f Mon Sep 17 00:00:00 2001
From: Wang Pengcheng <wangpengcheng.pp at bytedance.com>
Date: Fri, 13 Dec 2024 15:10:55 +0800
Subject: [PATCH] [MachineSink] Use `RegisterClassInfo::getRegPressureSetLimit`

`RegisterClassInfo::getRegPressureSetLimit` is a wrapper of
`TargetRegisterInfo::getRegPressureSetLimit` with some logics to
adjust the limit by removing reserved registers.

It seems that we shouldn't use `TargetRegisterInfo::getRegPressureSetLimit`
directly, just like the comment "This limit must be adjusted
dynamically for reserved registers" said.

Separate from https://github.com/llvm/llvm-project/pull/118787
---
 llvm/lib/CodeGen/MachineSink.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index bdf1ef68109d3f..3c816f97650901 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -1098,7 +1098,7 @@ bool MachineSinking::registerPressureSetExceedsLimit(
   std::vector<unsigned> BBRegisterPressure = getBBRegisterPressure(MBB);
   for (; *PS != -1; PS++)
     if (Weight + BBRegisterPressure[*PS] >=
-        TRI->getRegPressureSetLimit(*MBB.getParent(), *PS))
+        RegClassInfo.getRegPressureSetLimit(*PS))
       return true;
   return false;
 }



More information about the llvm-commits mailing list