[flang-commits] [flang] [libcxx] Unifying __is_trivial_equality_predicate and __is_trivial_plus_operation into __desugars_to (PR #68642)

Anton Rydahl via flang-commits flang-commits at lists.llvm.org
Sun Oct 15 21:07:34 PDT 2023


================
@@ -41,13 +42,12 @@ _LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 boo
   return true;
 }
 
-template <
-    class _Tp,
-    class _Up,
-    class _BinaryPredicate,
-    __enable_if_t<__is_trivial_equality_predicate<_BinaryPredicate, _Tp, _Up>::value && !is_volatile<_Tp>::value &&
-                      !is_volatile<_Up>::value && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value,
-                  int> = 0>
+template < class _Tp,
+           class _Up,
+           class _BinaryPredicate,
+           __enable_if_t<__desugars_to<_BinaryPredicate, equal_to<_Tp> >::value && !is_volatile<_Tp>::value &&
----------------
AntonRydahl wrote:

Thanks a lot, Louis! I have tried to verify that the patch produces identical assembly for the above example compared to the main branch. Just to make sure that we are on the same page, this meant that I also had to remove
```
template <class _Tp>
struct __desugars_to<equal_to<_Tp>, equal_to<void> > : true_type {};
```
since otherwise all equality operators would be considered transparent.

https://github.com/llvm/llvm-project/pull/68642


More information about the flang-commits mailing list