Slightly simplify the iN::partial_cmp MIR

This saves some debug and scope metadata in every single function that calls it.

Normally wouldn't be worth it, but with the derives there's *so* many of these.
This commit is contained in:
Scott McMurray 2024-03-24 10:01:37 -07:00
parent 3da115a93b
commit 8d5977d6af
2 changed files with 19 additions and 20 deletions

View File

@ -1548,8 +1548,15 @@ mod impls {
impl PartialOrd for $t { impl PartialOrd for $t {
#[inline] #[inline]
fn partial_cmp(&self, other: &$t) -> Option<Ordering> { fn partial_cmp(&self, other: &$t) -> Option<Ordering> {
#[cfg(bootstrap)]
{
Some(self.cmp(other)) Some(self.cmp(other))
} }
#[cfg(not(bootstrap))]
{
Some(crate::intrinsics::three_way_compare(*self, *other))
}
}
#[inline(always)] #[inline(always)]
fn lt(&self, other: &$t) -> bool { (*self) < (*other) } fn lt(&self, other: &$t) -> bool { (*self) < (*other) }
#[inline(always)] #[inline(always)]

View File

@ -14,26 +14,18 @@ fn <impl at $DIR/derived_ord.rs:6:10: 6:20>::partial_cmp(_1: &MultiField, _2: &M
debug cmp => _8; debug cmp => _8;
} }
scope 2 (inlined std::cmp::impls::<impl PartialOrd for char>::partial_cmp) { scope 2 (inlined std::cmp::impls::<impl PartialOrd for char>::partial_cmp) {
debug self => _3;
debug other => _4;
let mut _7: std::cmp::Ordering;
scope 3 (inlined std::cmp::impls::<impl Ord for char>::cmp) {
debug self => _3; debug self => _3;
debug other => _4; debug other => _4;
let mut _5: char; let mut _5: char;
let mut _6: char; let mut _6: char;
let mut _7: std::cmp::Ordering;
} }
} scope 3 (inlined std::cmp::impls::<impl PartialOrd for i16>::partial_cmp) {
scope 4 (inlined std::cmp::impls::<impl PartialOrd for i16>::partial_cmp) {
debug self => _10;
debug other => _11;
let mut _14: std::cmp::Ordering;
scope 5 (inlined std::cmp::impls::<impl Ord for i16>::cmp) {
debug self => _10; debug self => _10;
debug other => _11; debug other => _11;
let mut _12: i16; let mut _12: i16;
let mut _13: i16; let mut _13: i16;
} let mut _14: std::cmp::Ordering;
} }
bb0: { bb0: {