[llvm] [IPO] Use std::tie to implement operator< (NFC) (PR #143561)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 10 08:56:38 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
std::tie facilitates lexicographical comparisons through std::tuple's
built-in operator<.
---
Full diff: https://github.com/llvm/llvm-project/pull/143561.diff
1 Files Affected:
- (modified) llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h (+1-1)
``````````diff
diff --git a/llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h b/llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
index d34473f03c8de..7a03405b4f462 100644
--- a/llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
+++ b/llvm/include/llvm/Transforms/IPO/WholeProgramDevirt.h
@@ -113,7 +113,7 @@ struct TypeMemberInfo {
uint64_t Offset;
bool operator<(const TypeMemberInfo &other) const {
- return Bits < other.Bits || (Bits == other.Bits && Offset < other.Offset);
+ return std::tie(Bits, Offset) < std::tie(other.Bits, other.Offset);
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/143561
More information about the llvm-commits
mailing list