[llvm] 5024926 - MLRegAlloc: Do not use float to count number of used registers [NFC] (#118489)

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 08:40:34 PST 2024


Author: Matt Arsenault
Date: 2024-12-03T11:40:30-05:00
New Revision: 50249263a173d43475a60ca658048cf3b6206aba

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

LOG: MLRegAlloc: Do not use float to count number of used registers [NFC] (#118489)

Added: 
    

Modified: 
    llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp
index d099544c2a4918..03f015f8c9e32d 100644
--- a/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp
+++ b/llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp
@@ -559,14 +559,13 @@ class DevelopmentModeEvictionAdvisorAnalysis final
 
 float MLEvictAdvisor::getInitialQueueSize(const MachineFunction &MF) {
   auto &MRI = MF.getRegInfo();
-  float Ret = 0.0;
+  unsigned NumUsedRegs = 0;
   for (unsigned I = 0, E = MRI.getNumVirtRegs(); I != E; ++I) {
     Register Reg = Register::index2VirtReg(I);
-    if (MRI.reg_nodbg_empty(Reg))
-      continue;
-    ++Ret;
+    if (!MRI.reg_nodbg_empty(Reg))
+      ++NumUsedRegs;
   }
-  return Ret;
+  return static_cast<float>(NumUsedRegs);
 }
 
 MLEvictAdvisor::MLEvictAdvisor(const MachineFunction &MF, const RAGreedy &RA,


        


More information about the llvm-commits mailing list