[llvm] Regalloc: Add operator >= to EvictionCost (PR #160070)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 22 03:51:22 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-regalloc
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
Make the actual use context less ugly.
---
Full diff: https://github.com/llvm/llvm-project/pull/160070.diff
2 Files Affected:
- (modified) llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h (+2)
- (modified) llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp (+1-1)
``````````diff
diff --git a/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h b/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h
index e4f0932c3edc8..1020c5f97dd31 100644
--- a/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h
+++ b/llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h
@@ -91,6 +91,8 @@ struct EvictionCost {
return std::tie(BrokenHints, MaxWeight) <
std::tie(O.BrokenHints, O.MaxWeight);
}
+
+ bool operator>=(const EvictionCost &O) const { return !(*this < O); }
};
/// Interface to the eviction advisor, which is responsible for making a
diff --git a/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp b/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp
index 9b23a6aac629a..0d44ddc428570 100644
--- a/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp
+++ b/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp
@@ -308,7 +308,7 @@ bool DefaultEvictionAdvisor::canEvictInterferenceBasedOnCost(
Cost.BrokenHints += BreaksHint;
Cost.MaxWeight = std::max(Cost.MaxWeight, Intf->weight());
// Abort if this would be too expensive.
- if (!(Cost < MaxCost))
+ if (Cost >= MaxCost)
return false;
if (Urgent)
continue;
``````````
</details>
https://github.com/llvm/llvm-project/pull/160070
More information about the llvm-commits
mailing list