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

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 22:51:04 PST 2024


Author: Pengcheng Wang
Date: 2024-12-18T14:51:01+08:00
New Revision: b6ad231666fa8be41e2f357f53072238fdb4059e

URL: https://github.com/llvm/llvm-project/commit/b6ad231666fa8be41e2f357f53072238fdb4059e
DIFF: https://github.com/llvm/llvm-project/commit/b6ad231666fa8be41e2f357f53072238fdb4059e.diff

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

`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

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineSink.cpp

Removed: 
    


################################################################################
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