Skip to content

Commit c077822

Browse files
authored
Regalloc: Add operator >= to EvictionCost (llvm#160070)
Make the actual use context less ugly.
1 parent cecdff9 commit c077822

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

llvm/include/llvm/CodeGen/RegAllocEvictionAdvisor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ struct EvictionCost {
9191
return std::tie(BrokenHints, MaxWeight) <
9292
std::tie(O.BrokenHints, O.MaxWeight);
9393
}
94+
95+
bool operator>=(const EvictionCost &O) const { return !(*this < O); }
9496
};
9597

9698
/// Interface to the eviction advisor, which is responsible for making a

llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ bool DefaultEvictionAdvisor::canEvictInterferenceBasedOnCost(
308308
Cost.BrokenHints += BreaksHint;
309309
Cost.MaxWeight = std::max(Cost.MaxWeight, Intf->weight());
310310
// Abort if this would be too expensive.
311-
if (!(Cost < MaxCost))
311+
if (Cost >= MaxCost)
312312
return false;
313313
if (Urgent)
314314
continue;

0 commit comments

Comments
 (0)