Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

std::tie facilitates lexicographical comparisons through std::tuple's
built-in operator<.

std::tie facilitates lexicographical comparisons through std::tuple's
built-in operator<.
@llvmbot
Copy link
Member

llvmbot commented Jun 10, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

Changes

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 --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);
   }
 };
 

@kazutakahirata kazutakahirata merged commit 1befb24 into llvm:main Jun 10, 2025
9 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250610_operator_less_llvm branch June 10, 2025 18:32
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
std::tie facilitates lexicographical comparisons through std::tuple's
built-in operator<.
akuhlens pushed a commit to akuhlens/llvm-project that referenced this pull request Jun 24, 2025
std::tie facilitates lexicographical comparisons through std::tuple's
built-in operator<.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants