[libcxx-commits] [libcxx] [libc++] Check explicit values in the partial_ordering comparators for better code gen (PR #81366)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Apr 12 09:13:28 PDT 2024
================
@@ -62,39 +58,39 @@ class partial_ordering {
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering, partial_ordering) noexcept = default;
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept {
- return __v.__is_ordered() && __v.__value_ == 0;
+ return __v.__value_ == 0;
----------------
ldionne wrote:
Why don't we write these comparisons this way instead?
```c++
__v.__value_ == _OrdResult::__equiv
__v.__value_ == _OrdResult::__equiv || __v.__value_ == _OrdResult::__less
__v.__value_ == _OrdResult::__greater
// etc...
```
https://github.com/llvm/llvm-project/pull/81366
More information about the libcxx-commits
mailing list