[llvm] MLRegAlloc: Do not use float to count number of used registers (PR #118489)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 3 05:36:18 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-regalloc
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/118489.diff
1 Files Affected:
- (modified) llvm/lib/CodeGen/MLRegAllocEvictAdvisor.cpp (+4-5)
``````````diff
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,
``````````
</details>
https://github.com/llvm/llvm-project/pull/118489
More information about the llvm-commits
mailing list