Skip to content

Conversation

@arsenm
Copy link
Contributor

@arsenm arsenm commented Dec 3, 2024

No description provided.

Copy link
Contributor Author

arsenm commented Dec 3, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arsenm arsenm requested a review from mtrofin December 3, 2024 13:35
@arsenm arsenm marked this pull request as ready for review December 3, 2024 13:35
@llvmbot llvmbot added the mlgo label Dec 3, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 3, 2024

@llvm/pr-subscribers-mlgo

@llvm/pr-subscribers-llvm-regalloc

Author: Matt Arsenault (arsenm)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/118489.diff

1 Files Affected:

  • (modified) llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp (+4-5)
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,

Copy link
Member

@mtrofin mtrofin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but could you please add [NFC] to the commit message?

@arsenm arsenm changed the title MLRegAlloc: Do not use float to count number of used registers MLRegAlloc: Do not use float to count number of used registers [NFC] Dec 3, 2024
@arsenm arsenm merged commit 5024926 into main Dec 3, 2024
13 checks passed
@arsenm arsenm deleted the users/arsenm/ml-regalloc-evict-advisor-no-fp-sum branch December 3, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants