1
Fork 0
rust/library/core/src
Matthias Krüger 7b78b6a78d
Rollup merge of #107022 - scottmcm:ordering-option-eq, r=m-ou-se
Implement `SpecOptionPartialEq` for `cmp::Ordering`

Noticed as I continue to explore options for having code using `partial_cmp` optimize better.

Before:
```llvm
; Function Attrs: mustprogress nofree nosync nounwind willreturn uwtable
define noundef zeroext i1 `@ordering_eq(i8` noundef %0, i8 noundef %1) unnamed_addr #0 {
start:
  %2 = icmp eq i8 %0, 2
  br i1 %2, label %bb1.i, label %bb3.i

bb1.i:                                            ; preds = %start
  %3 = icmp eq i8 %1, 2
  br label %"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit"

bb3.i:                                            ; preds = %start
  %.not.i = icmp ne i8 %1, 2
  %4 = icmp eq i8 %0, %1
  %spec.select.i = and i1 %.not.i, %4
  br label %"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit"

"_ZN55_$LT$T$u20$as$u20$core..option..SpecOptionPartialEq$GT$2eq17hb7e7beacecde585fE.exit": ; preds = %bb1.i, %bb3.i
  %.0.i = phi i1 [ %3, %bb1.i ], [ %spec.select.i, %bb3.i ]
  ret i1 %.0.i
}
```

After:
```llvm
; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone willreturn uwtable
define noundef zeroext i1 `@ordering_eq(i8` noundef %0, i8 noundef %1) unnamed_addr #1 {
start:
  %2 = icmp eq i8 %0, %1
  ret i1 %2
}
```

(Which <https://alive2.llvm.org/ce/z/-rop5r> says LLVM *could* just do itself, but there's probably an issue already open for that problem from when this was originally looked at for `Option<NonZeroU8>` and friends.)
2023-01-28 05:20:15 +01:00
..
alloc Rollup merge of #102207 - CraftSpider:const-layout, r=scottmcm 2022-11-22 01:26:07 -05:00
array Remove various double spaces in source comments. 2023-01-14 17:22:04 +01:00
async_iter use consistent terminology 2022-10-29 09:23:12 +02:00
cell Add OnceCell<T>: !Sync impl for diagnostics 2023-01-19 20:14:21 +01:00
char update stabilization version numbers 2022-12-28 09:18:42 -05:00
convert Implement From<bool> for f32, f64 2022-12-15 03:55:21 +00:00
ffi Implement va_list and va_arg for s390x FFI 2022-12-19 21:07:57 +01:00
fmt Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obk 2023-01-26 12:44:47 +00:00
future Transform async ResumeTy in generator transform 2023-01-19 09:03:05 +01:00
hash Fix some ~const usage in libcore 2022-12-20 15:01:37 +00:00
intrinsics Custom mir: Add support for some remaining, easy to support constructs 2023-01-26 03:29:28 -08:00
iter Rollup merge of #106860 - anden3:doc-double-spaces, r=Dylan-DPC 2023-01-14 18:45:29 +01:00
macros Remove HTML tags around warning 2023-01-06 13:20:58 +01:00
mem Rename assert_uninit_valid intrinsic 2022-12-13 18:08:35 +01:00
num Rollup merge of #106880 - tspiteri:borrowing-sub-typo, r=cuviper 2023-01-15 01:01:39 +01:00
ops Update bootstrap cfg 2022-12-28 09:18:43 -05:00
panic Replace libstd, libcore, liballoc in line comments. 2022-12-30 14:00:42 +01:00
prelude Replace libstd, libcore, liballoc in docs. 2022-12-30 14:00:40 +01:00
ptr sub_ptr() is equivalent to usize::try_from().unwrap_unchecked(), not usize::from().unwrap_unchecked(). 2023-01-23 14:42:32 +02:00
slice Rollup merge of #104672 - Voultapher:unify-sort-modules, r=thomcc 2023-01-20 21:33:21 -05:00
str Auto merge of #95644 - WaffleLapkin:str_split_as_str_refactor_take2, r=Amanieu 2023-01-03 11:06:08 +00:00
sync core: Support variety of atomic widths in width-agnostic functions 2023-01-25 10:44:03 +08:00
task Transform async ResumeTy in generator transform 2023-01-19 09:03:05 +01:00
unicode Replace libstd, libcore, liballoc in line comments. 2022-12-30 14:00:42 +01:00
any.rs Constify TypeId ordering impls 2023-01-16 21:26:03 +01:00
arch.rs move core::arch into separate file 2022-11-20 10:28:14 +01:00
ascii.rs Inline <EscapeDefault as Iterator>::next 2022-03-10 15:35:22 +01:00
asserting.rs [RFC 2011] Library code 2022-05-22 07:18:32 -03:00
bool.rs Add missing assertion 2022-09-22 02:12:06 -04:00
borrow.rs Minor grammar nit. 2022-12-12 16:22:01 -07:00
cell.rs impl DispatchFromDyn for Cell and UnsafeCell 2023-01-24 12:06:12 +01:00
clone.rs Make some trivial functions #[inline(always)] 2022-12-07 17:11:17 +01:00
cmp.rs test use in libcore 2023-01-12 02:28:38 +00:00
const_closure.rs Update bootstrap cfg 2022-12-28 09:18:43 -05:00
default.rs cfg-step code 2022-11-06 17:21:21 -05:00
error.md Small round of typo fixes 2022-11-04 20:06:18 -07:00
error.rs Revert "Implement allow-by-default multiple_supertrait_upcastable lint" 2022-12-29 00:47:23 -08:00
hint.rs Improve the documentation of black_box 2023-01-07 15:44:38 -05:00
internal_macros.rs ignore a doctest for the non-exported macro 2022-05-03 18:33:56 +09:00
intrinsics.rs Update bootstrap cfg 2022-12-28 09:18:43 -05:00
lib.rs Auto merge of #106004 - fee1-dead-contrib:const-closures, r=oli-obk 2023-01-13 05:04:48 +00:00
marker.rs Add rustc_on_unimplemented on Sync for cell types 2023-01-19 21:09:25 +01:00
option.rs Link to the LLVM issue from a comment on SpecOptionPartialEq 2023-01-27 19:09:52 -08:00
panic.rs Replace libstd, libcore, liballoc in docs. 2022-12-30 14:00:40 +01:00
panicking.rs Rollup merge of #106045 - RalfJung:oom-nounwind-panic, r=Amanieu 2023-01-03 17:19:26 -08:00
pin.rs Fix some missed double spaces. 2023-01-14 18:26:38 +01:00
primitive.rs
primitive_docs.rs disable strict-provenance-violating doctests in Miri 2022-11-22 11:49:02 +01:00
result.rs Improve wording for Option and Result 2022-12-13 14:49:10 -05:00
time.rs Bump version placeholders to release 2022-11-06 17:11:02 -05:00
tuple.rs const Compare Tuples 2022-11-09 09:52:04 +01:00
unit.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00