150265 disabled this because it was a net perf win, but let's see if we can tweak the structure of this to allow more inlining on this side while still not MIR-inlining the loop when it's not just `memcmp`. This should also allow MIR-inlining the length check, which was previously blocked.
534 lines
18 KiB
Diff
534 lines
18 KiB
Diff
- // MIR for `chained_conditions` before JumpThreading
|
|
+ // MIR for `chained_conditions` after JumpThreading
|
|
|
|
fn chained_conditions() -> u8 {
|
|
let mut _0: u8;
|
|
let _1: chained_conditions::BacktraceStyle;
|
|
let mut _2: std::option::Option<std::string::String>;
|
|
let mut _3: &std::option::Option<std::string::String>;
|
|
let mut _4: isize;
|
|
let _5: std::string::String;
|
|
let _6: &std::string::String;
|
|
let mut _7: bool;
|
|
let mut _8: &&std::string::String;
|
|
let _9: &std::string::String;
|
|
let mut _10: &&str;
|
|
let _11: &str;
|
|
let _12: std::string::String;
|
|
let _13: &std::string::String;
|
|
let mut _14: bool;
|
|
let mut _15: &&std::string::String;
|
|
let _16: &std::string::String;
|
|
let mut _17: &&str;
|
|
let _18: &str;
|
|
let mut _19: isize;
|
|
let mut _20: &&str;
|
|
let mut _21: &&str;
|
|
let mut _22: bool;
|
|
let mut _23: bool;
|
|
let mut _24: isize;
|
|
let mut _25: isize;
|
|
let mut _26: isize;
|
|
scope 1 {
|
|
debug format => _1;
|
|
}
|
|
scope 2 {
|
|
debug x => _5;
|
|
debug x => _6;
|
|
}
|
|
scope 3 {
|
|
debug x => _12;
|
|
debug x => _13;
|
|
}
|
|
scope 4 (inlined std::cmp::impls::<impl PartialEq<&str> for &String>::eq) {
|
|
let mut _27: &std::string::String;
|
|
let mut _28: &str;
|
|
scope 5 (inlined <String as PartialEq<str>>::eq) {
|
|
scope 6 (inlined #[track_caller] <String as Index<RangeFull>>::index) {
|
|
let _29: &str;
|
|
scope 7 (inlined String::as_str) {
|
|
let _30: &[u8];
|
|
scope 8 (inlined Vec::<u8>::as_slice) {
|
|
let _31: *const [u8];
|
|
let mut _32: *const u8;
|
|
let mut _33: usize;
|
|
scope 9 (inlined Vec::<u8>::as_ptr) {
|
|
scope 10 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
|
|
scope 11 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
|
|
scope 12 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
|
|
let mut _34: std::ptr::NonNull<u8>;
|
|
scope 13 (inlined std::ptr::Unique::<u8>::cast::<u8>) {
|
|
scope 14 (inlined NonNull::<u8>::cast::<u8>) {
|
|
scope 15 (inlined NonNull::<u8>::as_ptr) {
|
|
}
|
|
}
|
|
}
|
|
scope 16 (inlined std::ptr::Unique::<u8>::as_non_null_ptr) {
|
|
}
|
|
}
|
|
scope 17 (inlined NonNull::<u8>::as_ptr) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
scope 18 (inlined from_utf8_unchecked) {
|
|
}
|
|
}
|
|
scope 19 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
|
|
}
|
|
}
|
|
scope 20 (inlined #[track_caller] core::str::traits::<impl Index<RangeFull> for str>::index) {
|
|
scope 21 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
|
|
}
|
|
}
|
|
scope 22 (inlined core::str::traits::<impl PartialEq for str>::eq) {
|
|
let mut _35: &&[u8];
|
|
let _36: &[u8];
|
|
let mut _37: &&[u8];
|
|
let _38: &[u8];
|
|
scope 23 (inlined core::str::<impl str>::as_bytes) {
|
|
}
|
|
scope 24 (inlined core::str::<impl str>::as_bytes) {
|
|
}
|
|
scope 25 (inlined std::cmp::impls::<impl PartialEq for &[u8]>::eq) {
|
|
scope 26 (inlined core::slice::cmp::<impl PartialEq for [u8]>::eq) {
|
|
let _39: usize;
|
|
let mut _40: bool;
|
|
let mut _41: usize;
|
|
let mut _42: *const u8;
|
|
let mut _43: *const u8;
|
|
scope 27 {
|
|
scope 28 (inlined core::slice::<impl [u8]>::as_ptr) {
|
|
let mut _44: *const [u8];
|
|
}
|
|
scope 29 (inlined core::slice::<impl [u8]>::as_ptr) {
|
|
let mut _45: *const [u8];
|
|
}
|
|
scope 30 (inlined <u8 as core::slice::cmp::SlicePartialEq<u8>>::equal_same_length) {
|
|
let mut _46: i32;
|
|
scope 31 {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
scope 32 (inlined std::cmp::impls::<impl PartialEq<&str> for &String>::eq) {
|
|
let mut _47: &std::string::String;
|
|
let mut _48: &str;
|
|
scope 33 (inlined <String as PartialEq<str>>::eq) {
|
|
scope 34 (inlined #[track_caller] <String as Index<RangeFull>>::index) {
|
|
let _49: &str;
|
|
scope 35 (inlined String::as_str) {
|
|
let _50: &[u8];
|
|
scope 36 (inlined Vec::<u8>::as_slice) {
|
|
let _51: *const [u8];
|
|
let mut _52: *const u8;
|
|
let mut _53: usize;
|
|
scope 37 (inlined Vec::<u8>::as_ptr) {
|
|
scope 38 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
|
|
scope 39 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
|
|
scope 40 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
|
|
let mut _54: std::ptr::NonNull<u8>;
|
|
scope 41 (inlined std::ptr::Unique::<u8>::cast::<u8>) {
|
|
scope 42 (inlined NonNull::<u8>::cast::<u8>) {
|
|
scope 43 (inlined NonNull::<u8>::as_ptr) {
|
|
}
|
|
}
|
|
}
|
|
scope 44 (inlined std::ptr::Unique::<u8>::as_non_null_ptr) {
|
|
}
|
|
}
|
|
scope 45 (inlined NonNull::<u8>::as_ptr) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
scope 46 (inlined from_utf8_unchecked) {
|
|
}
|
|
}
|
|
scope 47 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
|
|
}
|
|
}
|
|
scope 48 (inlined #[track_caller] core::str::traits::<impl Index<RangeFull> for str>::index) {
|
|
scope 49 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
|
|
}
|
|
}
|
|
scope 50 (inlined core::str::traits::<impl PartialEq for str>::eq) {
|
|
let mut _55: &&[u8];
|
|
let _56: &[u8];
|
|
let mut _57: &&[u8];
|
|
let _58: &[u8];
|
|
scope 51 (inlined core::str::<impl str>::as_bytes) {
|
|
}
|
|
scope 52 (inlined core::str::<impl str>::as_bytes) {
|
|
}
|
|
scope 53 (inlined std::cmp::impls::<impl PartialEq for &[u8]>::eq) {
|
|
scope 54 (inlined core::slice::cmp::<impl PartialEq for [u8]>::eq) {
|
|
let _59: usize;
|
|
let mut _60: bool;
|
|
let mut _61: usize;
|
|
let mut _62: *const u8;
|
|
let mut _63: *const u8;
|
|
scope 55 {
|
|
scope 56 (inlined core::slice::<impl [u8]>::as_ptr) {
|
|
let mut _64: *const [u8];
|
|
}
|
|
scope 57 (inlined core::slice::<impl [u8]>::as_ptr) {
|
|
let mut _65: *const [u8];
|
|
}
|
|
scope 58 (inlined <u8 as core::slice::cmp::SlicePartialEq<u8>>::equal_same_length) {
|
|
let mut _66: i32;
|
|
scope 59 {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
bb0: {
|
|
_22 = const false;
|
|
_23 = const false;
|
|
StorageLive(_1);
|
|
StorageLive(_2);
|
|
_2 = env_var() -> [return: bb1, unwind unreachable];
|
|
}
|
|
|
|
bb1: {
|
|
_22 = const true;
|
|
_23 = const true;
|
|
_4 = discriminant(_2);
|
|
switchInt(move _4) -> [0: bb3, 1: bb4, otherwise: bb2];
|
|
}
|
|
|
|
bb2: {
|
|
unreachable;
|
|
}
|
|
|
|
bb3: {
|
|
_1 = chained_conditions::BacktraceStyle::Off;
|
|
- goto -> bb18;
|
|
+ goto -> bb29;
|
|
}
|
|
|
|
bb4: {
|
|
StorageLive(_6);
|
|
_6 = &((_2 as Some).0: std::string::String);
|
|
StorageLive(_7);
|
|
StorageLive(_8);
|
|
StorageLive(_9);
|
|
_9 = &(*_6);
|
|
_8 = &_9;
|
|
StorageLive(_10);
|
|
_21 = const chained_conditions::promoted[1];
|
|
_10 = &(*_21);
|
|
StorageLive(_27);
|
|
StorageLive(_28);
|
|
_27 = copy (*_8);
|
|
_28 = copy (*_10);
|
|
StorageLive(_29);
|
|
StorageLive(_30);
|
|
StorageLive(_31);
|
|
StorageLive(_32);
|
|
StorageLive(_34);
|
|
_34 = copy ((((((*_27).0: std::vec::Vec<u8>).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
|
|
_32 = copy _34 as *const u8 (Transmute);
|
|
StorageDead(_34);
|
|
StorageLive(_33);
|
|
_33 = copy (((*_27).0: std::vec::Vec<u8>).1: usize);
|
|
_31 = *const [u8] from (copy _32, move _33);
|
|
StorageDead(_33);
|
|
StorageDead(_32);
|
|
_30 = &(*_31);
|
|
StorageDead(_31);
|
|
_29 = copy _30 as &str (Transmute);
|
|
StorageDead(_30);
|
|
StorageLive(_36);
|
|
StorageLive(_38);
|
|
StorageLive(_39);
|
|
StorageLive(_42);
|
|
StorageLive(_43);
|
|
_36 = copy _29 as &[u8] (Transmute);
|
|
_38 = copy _28 as &[u8] (Transmute);
|
|
_39 = PtrMetadata(copy _36);
|
|
StorageLive(_40);
|
|
StorageLive(_41);
|
|
_41 = PtrMetadata(copy _38);
|
|
_40 = Eq(copy _39, move _41);
|
|
switchInt(move _40) -> [0: bb20, otherwise: bb19];
|
|
}
|
|
|
|
bb5: {
|
|
StorageDead(_10);
|
|
StorageDead(_9);
|
|
StorageDead(_8);
|
|
StorageDead(_7);
|
|
StorageLive(_5);
|
|
_23 = const false;
|
|
_5 = move ((_2 as Some).0: std::string::String);
|
|
_1 = chained_conditions::BacktraceStyle::Full;
|
|
drop(_5) -> [return: bb7, unwind unreachable];
|
|
}
|
|
|
|
bb6: {
|
|
StorageDead(_10);
|
|
StorageDead(_9);
|
|
StorageDead(_8);
|
|
StorageDead(_7);
|
|
StorageDead(_6);
|
|
StorageLive(_13);
|
|
_13 = &((_2 as Some).0: std::string::String);
|
|
StorageLive(_14);
|
|
StorageLive(_15);
|
|
StorageLive(_16);
|
|
_16 = &(*_13);
|
|
_15 = &_16;
|
|
StorageLive(_17);
|
|
_20 = const chained_conditions::promoted[0];
|
|
_17 = &(*_20);
|
|
StorageLive(_47);
|
|
StorageLive(_48);
|
|
_47 = copy (*_15);
|
|
_48 = copy (*_17);
|
|
StorageLive(_49);
|
|
StorageLive(_50);
|
|
StorageLive(_51);
|
|
StorageLive(_52);
|
|
StorageLive(_54);
|
|
_54 = copy ((((((*_47).0: std::vec::Vec<u8>).0: alloc::raw_vec::RawVec<u8>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
|
|
_52 = copy _54 as *const u8 (Transmute);
|
|
StorageDead(_54);
|
|
StorageLive(_53);
|
|
_53 = copy (((*_47).0: std::vec::Vec<u8>).1: usize);
|
|
_51 = *const [u8] from (copy _52, move _53);
|
|
StorageDead(_53);
|
|
StorageDead(_52);
|
|
_50 = &(*_51);
|
|
StorageDead(_51);
|
|
_49 = copy _50 as &str (Transmute);
|
|
StorageDead(_50);
|
|
StorageLive(_56);
|
|
StorageLive(_58);
|
|
StorageLive(_59);
|
|
StorageLive(_62);
|
|
StorageLive(_63);
|
|
_56 = copy _49 as &[u8] (Transmute);
|
|
_58 = copy _48 as &[u8] (Transmute);
|
|
_59 = PtrMetadata(copy _56);
|
|
StorageLive(_60);
|
|
StorageLive(_61);
|
|
_61 = PtrMetadata(copy _58);
|
|
_60 = Eq(copy _59, move _61);
|
|
switchInt(move _60) -> [0: bb24, otherwise: bb23];
|
|
}
|
|
|
|
bb7: {
|
|
StorageDead(_5);
|
|
StorageDead(_6);
|
|
- goto -> bb18;
|
|
+ goto -> bb27;
|
|
}
|
|
|
|
bb8: {
|
|
StorageDead(_17);
|
|
StorageDead(_16);
|
|
StorageDead(_15);
|
|
StorageDead(_14);
|
|
StorageLive(_12);
|
|
_23 = const false;
|
|
_12 = move ((_2 as Some).0: std::string::String);
|
|
_1 = chained_conditions::BacktraceStyle::Off;
|
|
drop(_12) -> [return: bb10, unwind unreachable];
|
|
}
|
|
|
|
bb9: {
|
|
StorageDead(_17);
|
|
StorageDead(_16);
|
|
StorageDead(_15);
|
|
StorageDead(_14);
|
|
StorageDead(_13);
|
|
_1 = chained_conditions::BacktraceStyle::Short;
|
|
- goto -> bb18;
|
|
+ goto -> bb29;
|
|
}
|
|
|
|
bb10: {
|
|
StorageDead(_12);
|
|
StorageDead(_13);
|
|
- goto -> bb18;
|
|
+ goto -> bb27;
|
|
}
|
|
|
|
bb11: {
|
|
_0 = const 3_u8;
|
|
goto -> bb14;
|
|
}
|
|
|
|
bb12: {
|
|
_0 = const 2_u8;
|
|
goto -> bb14;
|
|
}
|
|
|
|
bb13: {
|
|
_0 = const 1_u8;
|
|
goto -> bb14;
|
|
}
|
|
|
|
bb14: {
|
|
StorageDead(_1);
|
|
return;
|
|
}
|
|
|
|
bb15: {
|
|
_22 = const false;
|
|
_23 = const false;
|
|
StorageDead(_2);
|
|
_19 = discriminant(_1);
|
|
switchInt(move _19) -> [0: bb13, 1: bb12, 2: bb11, otherwise: bb2];
|
|
}
|
|
|
|
bb16: {
|
|
switchInt(copy _23) -> [0: bb15, otherwise: bb17];
|
|
}
|
|
|
|
bb17: {
|
|
drop(((_2 as Some).0: std::string::String)) -> [return: bb15, unwind unreachable];
|
|
}
|
|
|
|
bb18: {
|
|
_24 = discriminant(_2);
|
|
switchInt(move _24) -> [1: bb16, otherwise: bb15];
|
|
}
|
|
|
|
bb19: {
|
|
StorageDead(_41);
|
|
StorageLive(_44);
|
|
_44 = &raw const (*_36);
|
|
_42 = copy _44 as *const u8 (PtrToPtr);
|
|
StorageDead(_44);
|
|
StorageLive(_45);
|
|
_45 = &raw const (*_38);
|
|
_43 = copy _45 as *const u8 (PtrToPtr);
|
|
StorageDead(_45);
|
|
StorageLive(_46);
|
|
_46 = compare_bytes(move _42, move _43, move _39) -> [return: bb22, unwind unreachable];
|
|
}
|
|
|
|
bb20: {
|
|
StorageDead(_41);
|
|
_7 = const false;
|
|
- goto -> bb21;
|
|
+ goto -> bb32;
|
|
}
|
|
|
|
bb21: {
|
|
StorageDead(_40);
|
|
StorageDead(_43);
|
|
StorageDead(_42);
|
|
StorageDead(_39);
|
|
StorageDead(_38);
|
|
StorageDead(_36);
|
|
StorageDead(_29);
|
|
StorageDead(_28);
|
|
StorageDead(_27);
|
|
switchInt(move _7) -> [0: bb6, otherwise: bb5];
|
|
}
|
|
|
|
bb22: {
|
|
_7 = Eq(move _46, const 0_i32);
|
|
StorageDead(_46);
|
|
goto -> bb21;
|
|
}
|
|
|
|
bb23: {
|
|
StorageDead(_61);
|
|
StorageLive(_64);
|
|
_64 = &raw const (*_56);
|
|
_62 = copy _64 as *const u8 (PtrToPtr);
|
|
StorageDead(_64);
|
|
StorageLive(_65);
|
|
_65 = &raw const (*_58);
|
|
_63 = copy _65 as *const u8 (PtrToPtr);
|
|
StorageDead(_65);
|
|
StorageLive(_66);
|
|
_66 = compare_bytes(move _62, move _63, move _59) -> [return: bb26, unwind unreachable];
|
|
}
|
|
|
|
bb24: {
|
|
StorageDead(_61);
|
|
_14 = const false;
|
|
- goto -> bb25;
|
|
+ goto -> bb31;
|
|
}
|
|
|
|
bb25: {
|
|
StorageDead(_60);
|
|
StorageDead(_63);
|
|
StorageDead(_62);
|
|
StorageDead(_59);
|
|
StorageDead(_58);
|
|
StorageDead(_56);
|
|
StorageDead(_49);
|
|
StorageDead(_48);
|
|
StorageDead(_47);
|
|
switchInt(move _14) -> [0: bb9, otherwise: bb8];
|
|
}
|
|
|
|
bb26: {
|
|
_14 = Eq(move _66, const 0_i32);
|
|
StorageDead(_66);
|
|
goto -> bb25;
|
|
+ }
|
|
+
|
|
+ bb27: {
|
|
+ _24 = discriminant(_2);
|
|
+ switchInt(move _24) -> [1: bb28, otherwise: bb15];
|
|
+ }
|
|
+
|
|
+ bb28: {
|
|
+ goto -> bb15;
|
|
+ }
|
|
+
|
|
+ bb29: {
|
|
+ _24 = discriminant(_2);
|
|
+ switchInt(move _24) -> [1: bb30, otherwise: bb15];
|
|
+ }
|
|
+
|
|
+ bb30: {
|
|
+ goto -> bb17;
|
|
+ }
|
|
+
|
|
+ bb31: {
|
|
+ StorageDead(_60);
|
|
+ StorageDead(_63);
|
|
+ StorageDead(_62);
|
|
+ StorageDead(_59);
|
|
+ StorageDead(_58);
|
|
+ StorageDead(_56);
|
|
+ StorageDead(_49);
|
|
+ StorageDead(_48);
|
|
+ StorageDead(_47);
|
|
+ goto -> bb9;
|
|
+ }
|
|
+
|
|
+ bb32: {
|
|
+ StorageDead(_40);
|
|
+ StorageDead(_43);
|
|
+ StorageDead(_42);
|
|
+ StorageDead(_39);
|
|
+ StorageDead(_38);
|
|
+ StorageDead(_36);
|
|
+ StorageDead(_29);
|
|
+ StorageDead(_28);
|
|
+ StorageDead(_27);
|
|
+ goto -> bb6;
|
|
}
|
|
}
|
|
|