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;