Reinstate bonus for unused UbChecks.

This commit is contained in:
Camille Gillot
2025-12-21 00:42:34 +00:00
parent a02dc3487a
commit c67b99fa09
4 changed files with 862 additions and 60 deletions
@@ -60,7 +60,27 @@ fn instantiate_ty(&self, v: Ty<'tcx>) -> Ty<'tcx> {
}
impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
fn visit_statement(&mut self, statement: &Statement<'tcx>, _: Location) {
fn visit_operand(&mut self, operand: &Operand<'tcx>, _: Location) {
match operand {
Operand::RuntimeChecks(RuntimeChecks::UbChecks) => {
if !self
.tcx
.sess
.opts
.unstable_opts
.inline_mir_preserve_debug
.unwrap_or(self.tcx.sess.ub_checks())
{
// If this is in optimized MIR it's because it's used later, so if we don't need UB
// checks this session, give a bonus here to offset the cost of the call later.
self.bonus += CALL_PENALTY;
}
}
_ => {}
}
}
fn visit_statement(&mut self, statement: &Statement<'tcx>, loc: Location) {
// Most costs are in rvalues and terminators, not in statements.
match statement.kind {
StatementKind::Intrinsic(ref ndi) => {
@@ -72,9 +92,10 @@ fn visit_statement(&mut self, statement: &Statement<'tcx>, _: Location) {
StatementKind::Assign(..) => self.penalty += INSTR_COST,
_ => {}
}
self.super_statement(statement, loc)
}
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, _: Location) {
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, loc: Location) {
match &terminator.kind {
TerminatorKind::Drop { place, unwind, .. } => {
// If the place doesn't actually need dropping, treat it like a regular goto.
@@ -151,6 +172,7 @@ fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, _: Location) {
bug!("{kind:?} should not be in runtime MIR");
}
}
self.super_terminator(terminator, loc)
}
}
+2 -2
View File
@@ -8,7 +8,7 @@
#[no_mangle]
pub fn slice_iter_len_eq_zero(y: std::slice::Iter<'_, Demo>) -> bool {
// CHECK-NOT: sub
// CHECK: %[[RET:.+]] = icmp eq ptr {{%0, %1|%1, %0}}
// CHECK: %[[RET:.+]] = icmp eq ptr {{%y.0, %y.1|%y.1, %y.0}}
// CHECK: ret i1 %[[RET]]
y.len() == 0
}
@@ -31,7 +31,7 @@ pub fn slice_iter_len_eq_zero_ref(y: &mut std::slice::Iter<'_, Demo>) -> bool {
// CHECK-LABEL: @slice_zst_iter_len_eq_zero
#[no_mangle]
pub fn slice_zst_iter_len_eq_zero(y: std::slice::Iter<'_, MyZST>) -> bool {
// CHECK: %[[RET:.+]] = icmp eq ptr %1, null
// CHECK: %[[RET:.+]] = icmp eq ptr %y.1, null
// CHECK: ret i1 %[[RET]]
y.len() == 0
}
@@ -43,10 +43,192 @@
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];
let mut _31: &std::vec::Vec<u8>;
scope 8 (inlined Vec::<u8>::as_slice) {
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 Unique::<u8>::cast::<u8>) {
scope 14 (inlined NonNull::<u8>::cast::<u8>) {
scope 15 (inlined NonNull::<u8>::as_ptr) {
}
}
}
scope 16 (inlined Unique::<u8>::as_non_null_ptr) {
}
}
scope 17 (inlined NonNull::<u8>::as_ptr) {
}
}
}
}
scope 18 (inlined #[track_caller] std::slice::from_raw_parts::<'_, u8>) {
let _35: ();
let mut _36: *mut ();
let _37: *const [u8];
scope 19 (inlined ub_checks::check_language_ub) {
scope 20 (inlined ub_checks::check_language_ub::runtime) {
}
}
scope 21 (inlined std::mem::size_of::<u8>) {
}
scope 22 (inlined std::mem::align_of::<u8>) {
}
scope 23 (inlined slice_from_raw_parts::<u8>) {
scope 24 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
}
}
}
}
scope 25 (inlined from_utf8_unchecked) {
}
}
scope 26 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
}
}
scope 27 (inlined #[track_caller] core::str::traits::<impl Index<RangeFull> for str>::index) {
scope 28 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
}
}
scope 29 (inlined core::str::traits::<impl PartialEq for str>::eq) {
let mut _38: &&[u8];
let _39: &[u8];
let mut _40: &&[u8];
let _41: &[u8];
scope 30 (inlined core::str::<impl str>::as_bytes) {
}
scope 31 (inlined core::str::<impl str>::as_bytes) {
}
scope 32 (inlined std::cmp::impls::<impl PartialEq for &[u8]>::eq) {
scope 33 (inlined core::slice::cmp::<impl PartialEq for [u8]>::eq) {
scope 34 (inlined <[u8] as core::slice::cmp::SlicePartialEq<u8>>::equal) {
let mut _42: bool;
let mut _43: usize;
let mut _44: usize;
let _45: usize;
let mut _46: i32;
let mut _47: *const u8;
let mut _48: *const u8;
scope 35 {
scope 37 (inlined core::slice::<impl [u8]>::as_ptr) {
let mut _50: *const [u8];
}
scope 38 (inlined core::slice::<impl [u8]>::as_ptr) {
let mut _51: *const [u8];
}
}
scope 36 (inlined std::mem::size_of_val::<[u8]>) {
let mut _49: *const [u8];
}
}
}
}
}
}
}
scope 5 (inlined std::cmp::impls::<impl PartialEq<&str> for &String>::eq) {
let mut _29: &std::string::String;
let mut _30: &str;
scope 39 (inlined std::cmp::impls::<impl PartialEq<&str> for &String>::eq) {
let mut _52: &std::string::String;
let mut _53: &str;
scope 40 (inlined <String as PartialEq<str>>::eq) {
scope 41 (inlined #[track_caller] <String as Index<RangeFull>>::index) {
let _54: &str;
scope 42 (inlined String::as_str) {
let _55: &[u8];
let mut _56: &std::vec::Vec<u8>;
scope 43 (inlined Vec::<u8>::as_slice) {
let mut _57: *const u8;
let mut _58: usize;
scope 44 (inlined Vec::<u8>::as_ptr) {
scope 45 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
scope 46 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
scope 47 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
let mut _59: std::ptr::NonNull<u8>;
scope 48 (inlined Unique::<u8>::cast::<u8>) {
scope 49 (inlined NonNull::<u8>::cast::<u8>) {
scope 50 (inlined NonNull::<u8>::as_ptr) {
}
}
}
scope 51 (inlined Unique::<u8>::as_non_null_ptr) {
}
}
scope 52 (inlined NonNull::<u8>::as_ptr) {
}
}
}
}
scope 53 (inlined #[track_caller] std::slice::from_raw_parts::<'_, u8>) {
let _60: ();
let mut _61: *mut ();
let _62: *const [u8];
scope 54 (inlined ub_checks::check_language_ub) {
scope 55 (inlined ub_checks::check_language_ub::runtime) {
}
}
scope 56 (inlined std::mem::size_of::<u8>) {
}
scope 57 (inlined std::mem::align_of::<u8>) {
}
scope 58 (inlined slice_from_raw_parts::<u8>) {
scope 59 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
}
}
}
}
scope 60 (inlined from_utf8_unchecked) {
}
}
scope 61 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
}
}
scope 62 (inlined #[track_caller] core::str::traits::<impl Index<RangeFull> for str>::index) {
scope 63 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
}
}
scope 64 (inlined core::str::traits::<impl PartialEq for str>::eq) {
let mut _63: &&[u8];
let _64: &[u8];
let mut _65: &&[u8];
let _66: &[u8];
scope 65 (inlined core::str::<impl str>::as_bytes) {
}
scope 66 (inlined core::str::<impl str>::as_bytes) {
}
scope 67 (inlined std::cmp::impls::<impl PartialEq for &[u8]>::eq) {
scope 68 (inlined core::slice::cmp::<impl PartialEq for [u8]>::eq) {
scope 69 (inlined <[u8] as core::slice::cmp::SlicePartialEq<u8>>::equal) {
let mut _67: bool;
let mut _68: usize;
let mut _69: usize;
let _70: usize;
let mut _71: i32;
let mut _72: *const u8;
let mut _73: *const u8;
scope 70 {
scope 72 (inlined core::slice::<impl [u8]>::as_ptr) {
let mut _75: *const [u8];
}
scope 73 (inlined core::slice::<impl [u8]>::as_ptr) {
let mut _76: *const [u8];
}
}
scope 71 (inlined std::mem::size_of_val::<[u8]>) {
let mut _74: *const [u8];
}
}
}
}
}
}
}
bb0: {
@@ -71,7 +253,7 @@
bb3: {
_1 = chained_conditions::BacktraceStyle::Off;
- goto -> bb18;
+ goto -> bb23;
+ goto -> bb37;
}
bb4: {
@@ -89,7 +271,16 @@
StorageLive(_28);
_27 = copy (*_8);
_28 = copy (*_10);
_7 = <String as PartialEq<str>>::eq(move _27, move _28) -> [return: bb19, unwind unreachable];
StorageLive(_29);
StorageLive(_35);
StorageLive(_30);
StorageLive(_34);
StorageLive(_32);
_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);
StorageLive(_33);
_33 = copy (((*_27).0: std::vec::Vec<u8>).1: usize);
switchInt(UbChecks) -> [0: bb21, otherwise: bb19];
}
bb5: {
@@ -120,18 +311,27 @@
StorageLive(_17);
_20 = const chained_conditions::promoted[0];
_17 = &(*_20);
StorageLive(_29);
StorageLive(_30);
_29 = copy (*_15);
_30 = copy (*_17);
_14 = <String as PartialEq<str>>::eq(move _29, move _30) -> [return: bb20, unwind unreachable];
StorageLive(_52);
StorageLive(_53);
_52 = copy (*_15);
_53 = copy (*_17);
StorageLive(_54);
StorageLive(_60);
StorageLive(_55);
StorageLive(_59);
StorageLive(_57);
_59 = copy ((((((*_52).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>);
_57 = copy _59 as *const u8 (Transmute);
StorageLive(_58);
_58 = copy (((*_52).0: std::vec::Vec<u8>).1: usize);
switchInt(UbChecks) -> [0: bb29, otherwise: bb27];
}
bb7: {
StorageDead(_5);
StorageDead(_6);
- goto -> bb18;
+ goto -> bb21;
+ goto -> bb39;
}
bb8: {
@@ -154,14 +354,14 @@
StorageDead(_13);
_1 = chained_conditions::BacktraceStyle::Short;
- goto -> bb18;
+ goto -> bb23;
+ goto -> bb37;
}
bb10: {
StorageDead(_12);
StorageDead(_13);
- goto -> bb18;
+ goto -> bb21;
+ goto -> bb39;
}
bb11: {
@@ -206,33 +406,223 @@
}
bb19: {
StorageLive(_36);
_36 = copy _34 as *mut () (Transmute);
_35 = std::slice::from_raw_parts::precondition_check(move _36, const <u8 as std::mem::SizedTypeProperties>::SIZE, const <u8 as std::mem::SizedTypeProperties>::ALIGN, copy _33) -> [return: bb20, unwind unreachable];
}
bb20: {
StorageDead(_36);
goto -> bb21;
}
bb21: {
StorageLive(_37);
_37 = *const [u8] from (copy _32, copy _33);
_30 = &(*_37);
StorageDead(_37);
StorageDead(_33);
StorageDead(_32);
StorageDead(_34);
_29 = copy _30 as &str (Transmute);
StorageDead(_30);
StorageLive(_39);
StorageLive(_41);
_39 = copy _29 as &[u8] (Transmute);
_41 = copy _28 as &[u8] (Transmute);
StorageLive(_45);
StorageLive(_50);
StorageLive(_51);
StorageLive(_42);
StorageLive(_43);
_43 = PtrMetadata(copy _39);
StorageLive(_44);
_44 = PtrMetadata(copy _41);
_42 = Ne(move _43, move _44);
switchInt(move _42) -> [0: bb24, otherwise: bb23];
}
bb22: {
StorageDead(_51);
StorageDead(_50);
StorageDead(_45);
StorageDead(_41);
StorageDead(_39);
StorageDead(_35);
StorageDead(_29);
StorageDead(_28);
StorageDead(_27);
switchInt(move _7) -> [0: bb6, otherwise: bb5];
}
bb20: {
StorageDead(_30);
StorageDead(_29);
bb23: {
StorageDead(_44);
StorageDead(_43);
_7 = const false;
StorageDead(_42);
- goto -> bb22;
+ goto -> bb35;
}
bb24: {
StorageDead(_44);
StorageDead(_43);
StorageDead(_42);
StorageLive(_49);
_49 = &raw const (*_39);
_45 = std::intrinsics::size_of_val::<[u8]>(move _49) -> [return: bb26, unwind unreachable];
}
bb25: {
StorageDead(_48);
StorageDead(_47);
_7 = Eq(move _46, const 0_i32);
StorageDead(_46);
goto -> bb22;
}
bb26: {
StorageDead(_49);
StorageLive(_46);
StorageLive(_47);
_50 = &raw const (*_39);
_47 = copy _50 as *const u8 (PtrToPtr);
StorageLive(_48);
_51 = &raw const (*_41);
_48 = copy _51 as *const u8 (PtrToPtr);
_46 = compare_bytes(move _47, move _48, move _45) -> [return: bb25, unwind unreachable];
}
bb27: {
StorageLive(_61);
_61 = copy _59 as *mut () (Transmute);
_60 = std::slice::from_raw_parts::precondition_check(move _61, const <u8 as std::mem::SizedTypeProperties>::SIZE, const <u8 as std::mem::SizedTypeProperties>::ALIGN, copy _58) -> [return: bb28, unwind unreachable];
}
bb28: {
StorageDead(_61);
goto -> bb29;
}
bb29: {
StorageLive(_62);
_62 = *const [u8] from (copy _57, copy _58);
_55 = &(*_62);
StorageDead(_62);
StorageDead(_58);
StorageDead(_57);
StorageDead(_59);
_54 = copy _55 as &str (Transmute);
StorageDead(_55);
StorageLive(_64);
StorageLive(_66);
_64 = copy _54 as &[u8] (Transmute);
_66 = copy _53 as &[u8] (Transmute);
StorageLive(_70);
StorageLive(_75);
StorageLive(_76);
StorageLive(_67);
StorageLive(_68);
_68 = PtrMetadata(copy _64);
StorageLive(_69);
_69 = PtrMetadata(copy _66);
_67 = Ne(move _68, move _69);
switchInt(move _67) -> [0: bb32, otherwise: bb31];
}
bb30: {
StorageDead(_76);
StorageDead(_75);
StorageDead(_70);
StorageDead(_66);
StorageDead(_64);
StorageDead(_60);
StorageDead(_54);
StorageDead(_53);
StorageDead(_52);
switchInt(move _14) -> [0: bb9, otherwise: bb8];
}
bb31: {
StorageDead(_69);
StorageDead(_68);
_14 = const false;
StorageDead(_67);
- goto -> bb30;
+ goto -> bb36;
}
bb32: {
StorageDead(_69);
StorageDead(_68);
StorageDead(_67);
StorageLive(_74);
_74 = &raw const (*_64);
_70 = std::intrinsics::size_of_val::<[u8]>(move _74) -> [return: bb34, unwind unreachable];
}
bb33: {
StorageDead(_73);
StorageDead(_72);
_14 = Eq(move _71, const 0_i32);
StorageDead(_71);
goto -> bb30;
}
bb34: {
StorageDead(_74);
StorageLive(_71);
StorageLive(_72);
_75 = &raw const (*_64);
_72 = copy _75 as *const u8 (PtrToPtr);
StorageLive(_73);
_76 = &raw const (*_66);
_73 = copy _76 as *const u8 (PtrToPtr);
_71 = compare_bytes(move _72, move _73, move _70) -> [return: bb33, unwind unreachable];
+ }
+
+ bb21: {
+ bb35: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageDead(_45);
+ StorageDead(_41);
+ StorageDead(_39);
+ StorageDead(_35);
+ StorageDead(_29);
+ StorageDead(_28);
+ StorageDead(_27);
+ goto -> bb6;
+ }
+
+ bb36: {
+ StorageDead(_76);
+ StorageDead(_75);
+ StorageDead(_70);
+ StorageDead(_66);
+ StorageDead(_64);
+ StorageDead(_60);
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageDead(_52);
+ goto -> bb9;
+ }
+
+ bb37: {
+ _24 = discriminant(_2);
+ switchInt(move _24) -> [1: bb22, otherwise: bb15];
+ switchInt(move _24) -> [1: bb38, otherwise: bb15];
+ }
+
+ bb22: {
+ goto -> bb15;
+ }
+
+ bb23: {
+ _24 = discriminant(_2);
+ switchInt(move _24) -> [1: bb24, otherwise: bb15];
+ }
+
+ bb24: {
+ bb38: {
+ goto -> bb17;
+ }
+
+ bb39: {
+ _24 = discriminant(_2);
+ switchInt(move _24) -> [1: bb40, otherwise: bb15];
+ }
+
+ bb40: {
+ goto -> bb15;
}
}
@@ -43,10 +43,192 @@
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];
let mut _31: &std::vec::Vec<u8>;
scope 8 (inlined Vec::<u8>::as_slice) {
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 Unique::<u8>::cast::<u8>) {
scope 14 (inlined NonNull::<u8>::cast::<u8>) {
scope 15 (inlined NonNull::<u8>::as_ptr) {
}
}
}
scope 16 (inlined Unique::<u8>::as_non_null_ptr) {
}
}
scope 17 (inlined NonNull::<u8>::as_ptr) {
}
}
}
}
scope 18 (inlined #[track_caller] std::slice::from_raw_parts::<'_, u8>) {
let _35: ();
let mut _36: *mut ();
let _37: *const [u8];
scope 19 (inlined ub_checks::check_language_ub) {
scope 20 (inlined ub_checks::check_language_ub::runtime) {
}
}
scope 21 (inlined std::mem::size_of::<u8>) {
}
scope 22 (inlined std::mem::align_of::<u8>) {
}
scope 23 (inlined slice_from_raw_parts::<u8>) {
scope 24 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
}
}
}
}
scope 25 (inlined from_utf8_unchecked) {
}
}
scope 26 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
}
}
scope 27 (inlined #[track_caller] core::str::traits::<impl Index<RangeFull> for str>::index) {
scope 28 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
}
}
scope 29 (inlined core::str::traits::<impl PartialEq for str>::eq) {
let mut _38: &&[u8];
let _39: &[u8];
let mut _40: &&[u8];
let _41: &[u8];
scope 30 (inlined core::str::<impl str>::as_bytes) {
}
scope 31 (inlined core::str::<impl str>::as_bytes) {
}
scope 32 (inlined std::cmp::impls::<impl PartialEq for &[u8]>::eq) {
scope 33 (inlined core::slice::cmp::<impl PartialEq for [u8]>::eq) {
scope 34 (inlined <[u8] as core::slice::cmp::SlicePartialEq<u8>>::equal) {
let mut _42: bool;
let mut _43: usize;
let mut _44: usize;
let _45: usize;
let mut _46: i32;
let mut _47: *const u8;
let mut _48: *const u8;
scope 35 {
scope 37 (inlined core::slice::<impl [u8]>::as_ptr) {
let mut _50: *const [u8];
}
scope 38 (inlined core::slice::<impl [u8]>::as_ptr) {
let mut _51: *const [u8];
}
}
scope 36 (inlined std::mem::size_of_val::<[u8]>) {
let mut _49: *const [u8];
}
}
}
}
}
}
}
scope 5 (inlined std::cmp::impls::<impl PartialEq<&str> for &String>::eq) {
let mut _29: &std::string::String;
let mut _30: &str;
scope 39 (inlined std::cmp::impls::<impl PartialEq<&str> for &String>::eq) {
let mut _52: &std::string::String;
let mut _53: &str;
scope 40 (inlined <String as PartialEq<str>>::eq) {
scope 41 (inlined #[track_caller] <String as Index<RangeFull>>::index) {
let _54: &str;
scope 42 (inlined String::as_str) {
let _55: &[u8];
let mut _56: &std::vec::Vec<u8>;
scope 43 (inlined Vec::<u8>::as_slice) {
let mut _57: *const u8;
let mut _58: usize;
scope 44 (inlined Vec::<u8>::as_ptr) {
scope 45 (inlined alloc::raw_vec::RawVec::<u8>::ptr) {
scope 46 (inlined alloc::raw_vec::RawVecInner::ptr::<u8>) {
scope 47 (inlined alloc::raw_vec::RawVecInner::non_null::<u8>) {
let mut _59: std::ptr::NonNull<u8>;
scope 48 (inlined Unique::<u8>::cast::<u8>) {
scope 49 (inlined NonNull::<u8>::cast::<u8>) {
scope 50 (inlined NonNull::<u8>::as_ptr) {
}
}
}
scope 51 (inlined Unique::<u8>::as_non_null_ptr) {
}
}
scope 52 (inlined NonNull::<u8>::as_ptr) {
}
}
}
}
scope 53 (inlined #[track_caller] std::slice::from_raw_parts::<'_, u8>) {
let _60: ();
let mut _61: *mut ();
let _62: *const [u8];
scope 54 (inlined ub_checks::check_language_ub) {
scope 55 (inlined ub_checks::check_language_ub::runtime) {
}
}
scope 56 (inlined std::mem::size_of::<u8>) {
}
scope 57 (inlined std::mem::align_of::<u8>) {
}
scope 58 (inlined slice_from_raw_parts::<u8>) {
scope 59 (inlined std::ptr::from_raw_parts::<[u8], u8>) {
}
}
}
}
scope 60 (inlined from_utf8_unchecked) {
}
}
scope 61 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
}
}
scope 62 (inlined #[track_caller] core::str::traits::<impl Index<RangeFull> for str>::index) {
scope 63 (inlined #[track_caller] core::str::traits::<impl SliceIndex<str> for RangeFull>::index) {
}
}
scope 64 (inlined core::str::traits::<impl PartialEq for str>::eq) {
let mut _63: &&[u8];
let _64: &[u8];
let mut _65: &&[u8];
let _66: &[u8];
scope 65 (inlined core::str::<impl str>::as_bytes) {
}
scope 66 (inlined core::str::<impl str>::as_bytes) {
}
scope 67 (inlined std::cmp::impls::<impl PartialEq for &[u8]>::eq) {
scope 68 (inlined core::slice::cmp::<impl PartialEq for [u8]>::eq) {
scope 69 (inlined <[u8] as core::slice::cmp::SlicePartialEq<u8>>::equal) {
let mut _67: bool;
let mut _68: usize;
let mut _69: usize;
let _70: usize;
let mut _71: i32;
let mut _72: *const u8;
let mut _73: *const u8;
scope 70 {
scope 72 (inlined core::slice::<impl [u8]>::as_ptr) {
let mut _75: *const [u8];
}
scope 73 (inlined core::slice::<impl [u8]>::as_ptr) {
let mut _76: *const [u8];
}
}
scope 71 (inlined std::mem::size_of_val::<[u8]>) {
let mut _74: *const [u8];
}
}
}
}
}
}
}
bb0: {
@@ -71,7 +253,7 @@
bb3: {
_1 = chained_conditions::BacktraceStyle::Off;
- goto -> bb19;
+ goto -> bb27;
+ goto -> bb41;
}
bb4: {
@@ -89,7 +271,16 @@
StorageLive(_28);
_27 = copy (*_8);
_28 = copy (*_10);
_7 = <String as PartialEq<str>>::eq(move _27, move _28) -> [return: bb23, unwind: bb22];
StorageLive(_29);
StorageLive(_35);
StorageLive(_30);
StorageLive(_34);
StorageLive(_32);
_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);
StorageLive(_33);
_33 = copy (((*_27).0: std::vec::Vec<u8>).1: usize);
switchInt(UbChecks) -> [0: bb25, otherwise: bb23];
}
bb5: {
@@ -120,18 +311,27 @@
StorageLive(_17);
_20 = const chained_conditions::promoted[0];
_17 = &(*_20);
StorageLive(_29);
StorageLive(_30);
_29 = copy (*_15);
_30 = copy (*_17);
_14 = <String as PartialEq<str>>::eq(move _29, move _30) -> [return: bb24, unwind: bb22];
StorageLive(_52);
StorageLive(_53);
_52 = copy (*_15);
_53 = copy (*_17);
StorageLive(_54);
StorageLive(_60);
StorageLive(_55);
StorageLive(_59);
StorageLive(_57);
_59 = copy ((((((*_52).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>);
_57 = copy _59 as *const u8 (Transmute);
StorageLive(_58);
_58 = copy (((*_52).0: std::vec::Vec<u8>).1: usize);
switchInt(UbChecks) -> [0: bb33, otherwise: bb31];
}
bb7: {
StorageDead(_5);
StorageDead(_6);
- goto -> bb19;
+ goto -> bb25;
+ goto -> bb43;
}
bb8: {
@@ -154,14 +354,14 @@
StorageDead(_13);
_1 = chained_conditions::BacktraceStyle::Short;
- goto -> bb19;
+ goto -> bb27;
+ goto -> bb41;
}
bb10: {
StorageDead(_12);
StorageDead(_13);
- goto -> bb19;
+ goto -> bb25;
+ goto -> bb43;
}
bb11: {
@@ -223,33 +423,223 @@
}
bb23: {
StorageLive(_36);
_36 = copy _34 as *mut () (Transmute);
_35 = std::slice::from_raw_parts::precondition_check(move _36, const <u8 as std::mem::SizedTypeProperties>::SIZE, const <u8 as std::mem::SizedTypeProperties>::ALIGN, copy _33) -> [return: bb24, unwind unreachable];
}
bb24: {
StorageDead(_36);
goto -> bb25;
}
bb25: {
StorageLive(_37);
_37 = *const [u8] from (copy _32, copy _33);
_30 = &(*_37);
StorageDead(_37);
StorageDead(_33);
StorageDead(_32);
StorageDead(_34);
_29 = copy _30 as &str (Transmute);
StorageDead(_30);
StorageLive(_39);
StorageLive(_41);
_39 = copy _29 as &[u8] (Transmute);
_41 = copy _28 as &[u8] (Transmute);
StorageLive(_45);
StorageLive(_50);
StorageLive(_51);
StorageLive(_42);
StorageLive(_43);
_43 = PtrMetadata(copy _39);
StorageLive(_44);
_44 = PtrMetadata(copy _41);
_42 = Ne(move _43, move _44);
switchInt(move _42) -> [0: bb28, otherwise: bb27];
}
bb26: {
StorageDead(_51);
StorageDead(_50);
StorageDead(_45);
StorageDead(_41);
StorageDead(_39);
StorageDead(_35);
StorageDead(_29);
StorageDead(_28);
StorageDead(_27);
switchInt(move _7) -> [0: bb6, otherwise: bb5];
}
bb24: {
StorageDead(_30);
StorageDead(_29);
bb27: {
StorageDead(_44);
StorageDead(_43);
_7 = const false;
StorageDead(_42);
- goto -> bb26;
+ goto -> bb39;
}
bb28: {
StorageDead(_44);
StorageDead(_43);
StorageDead(_42);
StorageLive(_49);
_49 = &raw const (*_39);
_45 = std::intrinsics::size_of_val::<[u8]>(move _49) -> [return: bb30, unwind unreachable];
}
bb29: {
StorageDead(_48);
StorageDead(_47);
_7 = Eq(move _46, const 0_i32);
StorageDead(_46);
goto -> bb26;
}
bb30: {
StorageDead(_49);
StorageLive(_46);
StorageLive(_47);
_50 = &raw const (*_39);
_47 = copy _50 as *const u8 (PtrToPtr);
StorageLive(_48);
_51 = &raw const (*_41);
_48 = copy _51 as *const u8 (PtrToPtr);
_46 = compare_bytes(move _47, move _48, move _45) -> [return: bb29, unwind unreachable];
}
bb31: {
StorageLive(_61);
_61 = copy _59 as *mut () (Transmute);
_60 = std::slice::from_raw_parts::precondition_check(move _61, const <u8 as std::mem::SizedTypeProperties>::SIZE, const <u8 as std::mem::SizedTypeProperties>::ALIGN, copy _58) -> [return: bb32, unwind unreachable];
}
bb32: {
StorageDead(_61);
goto -> bb33;
}
bb33: {
StorageLive(_62);
_62 = *const [u8] from (copy _57, copy _58);
_55 = &(*_62);
StorageDead(_62);
StorageDead(_58);
StorageDead(_57);
StorageDead(_59);
_54 = copy _55 as &str (Transmute);
StorageDead(_55);
StorageLive(_64);
StorageLive(_66);
_64 = copy _54 as &[u8] (Transmute);
_66 = copy _53 as &[u8] (Transmute);
StorageLive(_70);
StorageLive(_75);
StorageLive(_76);
StorageLive(_67);
StorageLive(_68);
_68 = PtrMetadata(copy _64);
StorageLive(_69);
_69 = PtrMetadata(copy _66);
_67 = Ne(move _68, move _69);
switchInt(move _67) -> [0: bb36, otherwise: bb35];
}
bb34: {
StorageDead(_76);
StorageDead(_75);
StorageDead(_70);
StorageDead(_66);
StorageDead(_64);
StorageDead(_60);
StorageDead(_54);
StorageDead(_53);
StorageDead(_52);
switchInt(move _14) -> [0: bb9, otherwise: bb8];
}
bb35: {
StorageDead(_69);
StorageDead(_68);
_14 = const false;
StorageDead(_67);
- goto -> bb34;
+ goto -> bb40;
}
bb36: {
StorageDead(_69);
StorageDead(_68);
StorageDead(_67);
StorageLive(_74);
_74 = &raw const (*_64);
_70 = std::intrinsics::size_of_val::<[u8]>(move _74) -> [return: bb38, unwind unreachable];
}
bb37: {
StorageDead(_73);
StorageDead(_72);
_14 = Eq(move _71, const 0_i32);
StorageDead(_71);
goto -> bb34;
}
bb38: {
StorageDead(_74);
StorageLive(_71);
StorageLive(_72);
_75 = &raw const (*_64);
_72 = copy _75 as *const u8 (PtrToPtr);
StorageLive(_73);
_76 = &raw const (*_66);
_73 = copy _76 as *const u8 (PtrToPtr);
_71 = compare_bytes(move _72, move _73, move _70) -> [return: bb37, unwind unreachable];
+ }
+
+ bb25: {
+ bb39: {
+ StorageDead(_51);
+ StorageDead(_50);
+ StorageDead(_45);
+ StorageDead(_41);
+ StorageDead(_39);
+ StorageDead(_35);
+ StorageDead(_29);
+ StorageDead(_28);
+ StorageDead(_27);
+ goto -> bb6;
+ }
+
+ bb40: {
+ StorageDead(_76);
+ StorageDead(_75);
+ StorageDead(_70);
+ StorageDead(_66);
+ StorageDead(_64);
+ StorageDead(_60);
+ StorageDead(_54);
+ StorageDead(_53);
+ StorageDead(_52);
+ goto -> bb9;
+ }
+
+ bb41: {
+ _24 = discriminant(_2);
+ switchInt(move _24) -> [1: bb26, otherwise: bb16];
+ switchInt(move _24) -> [1: bb42, otherwise: bb16];
+ }
+
+ bb26: {
+ goto -> bb16;
+ }
+
+ bb27: {
+ _24 = discriminant(_2);
+ switchInt(move _24) -> [1: bb28, otherwise: bb16];
+ }
+
+ bb28: {
+ bb42: {
+ goto -> bb18;
+ }
+
+ bb43: {
+ _24 = discriminant(_2);
+ switchInt(move _24) -> [1: bb44, otherwise: bb16];
+ }
+
+ bb44: {
+ goto -> bb16;
}
}