3ec4eeddef
There's no need for the `const_eval_select` dance here. And while I originally wrote the `.try_into().unwrap_unchecked()` implementation here, it's kinda a mess in MIR -- this new one is substantially simpler, as shown by the old one being above the inlining threshold but the new one being below it.
80 lines
1.9 KiB
Rust
80 lines
1.9 KiB
Rust
// MIR for `checked_shl` after PreCodegen
|
|
|
|
fn checked_shl(_1: u32, _2: u32) -> Option<u32> {
|
|
debug x => _1;
|
|
debug rhs => _2;
|
|
let mut _0: std::option::Option<u32>;
|
|
scope 1 (inlined core::num::<impl u32>::checked_shl) {
|
|
debug self => _1;
|
|
debug rhs => _2;
|
|
let mut _7: u32;
|
|
let mut _8: bool;
|
|
scope 2 {
|
|
debug a => _7;
|
|
debug b => _6;
|
|
}
|
|
scope 3 (inlined core::num::<impl u32>::overflowing_shl) {
|
|
debug self => _1;
|
|
debug rhs => _2;
|
|
let mut _5: u32;
|
|
let mut _6: bool;
|
|
scope 4 (inlined core::num::<impl u32>::wrapping_shl) {
|
|
debug self => _1;
|
|
debug rhs => _2;
|
|
let mut _3: u32;
|
|
let mut _4: u32;
|
|
scope 5 {
|
|
scope 6 (inlined core::num::<impl u32>::unchecked_shl) {
|
|
debug self => _1;
|
|
debug rhs => _4;
|
|
scope 7 {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
bb0: {
|
|
StorageLive(_6);
|
|
StorageLive(_7);
|
|
StorageLive(_5);
|
|
StorageLive(_4);
|
|
StorageLive(_3);
|
|
_3 = const 31_u32;
|
|
_4 = BitAnd(_2, move _3);
|
|
StorageDead(_3);
|
|
_5 = unchecked_shl::<u32>(_1, _4) -> [return: bb1, unwind unreachable];
|
|
}
|
|
|
|
bb1: {
|
|
StorageDead(_4);
|
|
_6 = Ge(_2, const _);
|
|
_7 = move _5;
|
|
StorageDead(_5);
|
|
StorageLive(_8);
|
|
_8 = unlikely(_6) -> [return: bb2, unwind unreachable];
|
|
}
|
|
|
|
bb2: {
|
|
switchInt(move _8) -> [0: bb3, otherwise: bb4];
|
|
}
|
|
|
|
bb3: {
|
|
_0 = Option::<u32>::Some(_7);
|
|
goto -> bb5;
|
|
}
|
|
|
|
bb4: {
|
|
_0 = Option::<u32>::None;
|
|
goto -> bb5;
|
|
}
|
|
|
|
bb5: {
|
|
StorageDead(_8);
|
|
StorageDead(_7);
|
|
StorageDead(_6);
|
|
return;
|
|
}
|
|
}
|