summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/pre-codegen
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/mir-opt/pre-codegen
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/mir-opt/pre-codegen')
-rw-r--r--tests/mir-opt/pre-codegen/chained_comparison.rs1
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.rs1
-rw-r--r--tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir43
-rw-r--r--tests/mir-opt/pre-codegen/duplicate_switch_targets.rs1
-rw-r--r--tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir11
-rw-r--r--tests/mir-opt/pre-codegen/intrinsics.rs1
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff123
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff92
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff123
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff92
-rw-r--r--tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs15
-rw-r--r--tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir23
-rw-r--r--tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir99
-rw-r--r--tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir46
-rw-r--r--tests/mir-opt/pre-codegen/loops.rs1
-rw-r--r--tests/mir-opt/pre-codegen/mem_replace.rs1
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff2
-rw-r--r--tests/mir-opt/pre-codegen/optimizes_into_variable.rs1
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir115
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir115
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir64
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir64
-rw-r--r--tests/mir-opt/pre-codegen/range_iter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir6
-rw-r--r--tests/mir-opt/pre-codegen/simple_option_map.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir252
-rw-r--r--tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir2
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.rs1
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir14
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir14
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir6
-rw-r--r--tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir6
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir131
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir131
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir49
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir49
-rw-r--r--tests/mir-opt/pre-codegen/slice_iter.rs1
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir25
-rw-r--r--tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir25
-rw-r--r--tests/mir-opt/pre-codegen/spans.rs1
-rw-r--r--tests/mir-opt/pre-codegen/try_identity.rs1
45 files changed, 1112 insertions, 645 deletions
diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs
index 430300419..d1d400af2 100644
--- a/tests/mir-opt/pre-codegen/chained_comparison.rs
+++ b/tests/mir-opt/pre-codegen/chained_comparison.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
#![crate_type = "lib"]
diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs
index 23d78e987..d386219f4 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.rs
+++ b/tests/mir-opt/pre-codegen/checked_ops.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
// needs-unwind
// only-x86_64
diff --git a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
index 75f81c5aa..cf7feef00 100644
--- a/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir
@@ -8,59 +8,62 @@ fn step_forward(_1: u32, _2: usize) -> u32 {
debug start => _1;
debug n => _2;
let _3: std::option::Option<u32>;
- let mut _6: bool;
- let mut _7: u32;
- let mut _8: &std::option::Option<u32>;
+ let mut _4: &std::option::Option<u32>;
+ let mut _7: bool;
+ let mut _8: u32;
scope 2 {
}
scope 3 (inlined Option::<u32>::is_none) {
- debug self => _8;
- let mut _5: bool;
+ debug self => _4;
+ let mut _6: bool;
scope 4 (inlined Option::<u32>::is_some) {
- debug self => _8;
- let mut _4: isize;
+ debug self => _4;
+ let mut _5: isize;
}
}
scope 5 (inlined core::num::<impl u32>::wrapping_add) {
debug self => _1;
- debug rhs => _7;
+ debug rhs => _8;
}
}
bb0: {
- StorageLive(_6);
- StorageLive(_8);
+ StorageLive(_7);
+ StorageLive(_4);
StorageLive(_3);
_3 = <u32 as Step>::forward_checked(_1, _2) -> [return: bb1, unwind continue];
}
bb1: {
+ _4 = &_3;
+ StorageLive(_6);
StorageLive(_5);
- _4 = discriminant(_3);
- _5 = Eq(_4, const 1_isize);
- _6 = Not(move _5);
+ _5 = discriminant(_3);
+ _6 = Eq(_5, const 1_isize);
StorageDead(_5);
- switchInt(move _6) -> [0: bb2, otherwise: bb3];
+ _7 = Not(move _6);
+ StorageDead(_6);
+ switchInt(move _7) -> [0: bb2, otherwise: bb3];
}
bb2: {
StorageDead(_3);
- StorageDead(_8);
+ StorageDead(_4);
goto -> bb4;
}
bb3: {
StorageDead(_3);
- StorageDead(_8);
+ StorageDead(_4);
assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> [success: bb4, unwind continue];
}
bb4: {
- StorageDead(_6);
- StorageLive(_7);
- _7 = _2 as u32 (IntToInt);
- _0 = Add(_1, _7);
StorageDead(_7);
+ StorageLive(_8);
+ _8 = _2 as u32 (IntToInt);
+ _0 = Add(_1, _8);
+ StorageDead(_8);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
index d8af6b14d..b1a00d293 100644
--- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
+++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=0
// ignore-debug: standard library debug assertions add a panic that breaks this optimization
diff --git a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
index 65d71199a..0114309db 100644
--- a/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/duplicate_switch_targets.ub_if_b.PreCodegen.after.mir
@@ -4,6 +4,7 @@ fn ub_if_b(_1: Thing) -> Thing {
debug t => _1;
let mut _0: Thing;
let mut _2: isize;
+ let mut _3: bool;
scope 1 (inlined unreachable_unchecked) {
scope 2 {
scope 3 (inlined unreachable_unchecked::runtime) {
@@ -13,15 +14,9 @@ fn ub_if_b(_1: Thing) -> Thing {
bb0: {
_2 = discriminant(_1);
- switchInt(move _2) -> [0: bb1, otherwise: bb2];
- }
-
- bb1: {
+ _3 = Eq(_2, const 0_isize);
+ assume(move _3);
_0 = move _1;
return;
}
-
- bb2: {
- unreachable;
- }
}
diff --git a/tests/mir-opt/pre-codegen/intrinsics.rs b/tests/mir-opt/pre-codegen/intrinsics.rs
index e32e04384..565bd89e5 100644
--- a/tests/mir-opt/pre-codegen/intrinsics.rs
+++ b/tests/mir-opt/pre-codegen/intrinsics.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
new file mode 100644
index 000000000..50189d192
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
@@ -0,0 +1,123 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined #[track_caller] Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap) {
+ debug self => _6;
+ let mut _12: isize;
+ let _13: std::alloc::AllocError;
+ let mut _14: !;
+ let _15: &str;
+ let mut _16: &dyn std::fmt::Debug;
+ let mut _17: &std::alloc::AllocError;
+ scope 7 {
+ debug t => _5;
+ }
+ scope 8 {
+ debug e => const std::alloc::AllocError;
+ }
+ }
+ scope 9 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _18: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): ptr::alignment::AlignmentEnum32) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb4, unwind unreachable];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageLive(_12);
+ StorageLive(_15);
+ _12 = discriminant(_6);
+ switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb2];
+ }
+
+ bb5: {
+ _15 = const "called `Result::unwrap()` on an `Err` value";
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &_13;
+ _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize));
+ StorageDead(_17);
+ _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable;
+ }
+
+ bb6: {
+ _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>);
+ StorageDead(_15);
+ StorageDead(_12);
+ StorageDead(_6);
+ StorageLive(_18);
+ _18 = (_5.0: *const [u8]);
+ _4 = move _18 as *mut [u8] (PtrToPtr);
+ StorageDead(_18);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 __ __ __ __ │ ....░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff
new file mode 100644
index 000000000..6966762a1
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-unwind.diff
@@ -0,0 +1,92 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _12: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageLive(_12);
+ _12 = (_5.0: *const [u8]);
+ _4 = move _12 as *mut [u8] (PtrToPtr);
+ StorageDead(_12);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+
+ bb2: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): ptr::alignment::AlignmentEnum32) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb5, unwind continue];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): ptr::alignment::AlignmentEnum32) }}, const false) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ _5 = Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue];
+ }
+ }
++
++ ALLOC0 (size: 8, align: 4) {
++ 00 00 00 00 __ __ __ __ │ ....░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff
new file mode 100644
index 000000000..08a185bad
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-abort.diff
@@ -0,0 +1,123 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined #[track_caller] Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap) {
+ debug self => _6;
+ let mut _12: isize;
+ let _13: std::alloc::AllocError;
+ let mut _14: !;
+ let _15: &str;
+ let mut _16: &dyn std::fmt::Debug;
+ let mut _17: &std::alloc::AllocError;
+ scope 7 {
+ debug t => _5;
+ }
+ scope 8 {
+ debug e => const std::alloc::AllocError;
+ }
+ }
+ scope 9 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _18: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb1, 1: bb3, otherwise: bb2];
+ }
+
+ bb1: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind unreachable;
+ }
+
+ bb2: {
+ unreachable;
+ }
+
+ bb3: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): ptr::alignment::AlignmentEnum64) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb4, unwind unreachable];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb4, unwind unreachable];
+ }
+
+ bb4: {
+ StorageLive(_12);
+ StorageLive(_15);
+ _12 = discriminant(_6);
+ switchInt(move _12) -> [0: bb6, 1: bb5, otherwise: bb2];
+ }
+
+ bb5: {
+ _15 = const "called `Result::unwrap()` on an `Err` value";
+ StorageLive(_16);
+ StorageLive(_17);
+ _17 = &_13;
+ _16 = move _17 as &dyn std::fmt::Debug (PointerCoercion(Unsize));
+ StorageDead(_17);
+ _14 = result::unwrap_failed(move _15, move _16) -> unwind unreachable;
+ }
+
+ bb6: {
+ _5 = move ((_6 as Ok).0: std::ptr::NonNull<[u8]>);
+ StorageDead(_15);
+ StorageDead(_12);
+ StorageDead(_6);
+ StorageLive(_18);
+ _18 = (_5.0: *const [u8]);
+ _4 = move _18 as *mut [u8] (PtrToPtr);
+ StorageDead(_18);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+ }
++
++ ALLOC0 (size: 16, align: 8) {
++ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff
new file mode 100644
index 000000000..6501cb85e
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.64bit.panic-unwind.diff
@@ -0,0 +1,92 @@
+- // MIR for `main` before GVN
++ // MIR for `main` after GVN
+
+ fn main() -> () {
+ let mut _0: ();
+ let _1: std::alloc::Layout;
+ let mut _2: std::option::Option<std::alloc::Layout>;
+ let mut _3: *mut u8;
+ let mut _4: *mut [u8];
+ let mut _5: std::ptr::NonNull<[u8]>;
+ let mut _6: std::result::Result<std::ptr::NonNull<[u8]>, std::alloc::AllocError>;
+ let mut _7: &std::alloc::Global;
+ let mut _8: std::alloc::Layout;
+ scope 1 {
+ debug layout => _1;
+ let mut _9: &std::alloc::Global;
+ scope 2 {
+ debug ptr => _3;
+ }
+ scope 5 (inlined <std::alloc::Global as Allocator>::allocate) {
+ debug self => _9;
+ debug layout => _1;
+ }
+ scope 6 (inlined NonNull::<[u8]>::as_ptr) {
+ debug self => _5;
+ let mut _12: *const [u8];
+ }
+ }
+ scope 3 (inlined #[track_caller] Option::<Layout>::unwrap) {
+ debug self => _2;
+ let mut _10: isize;
+ let mut _11: !;
+ scope 4 {
+ debug val => _1;
+ }
+ }
+
+ bb0: {
+ StorageLive(_2);
+- _2 = Option::<Layout>::None;
++ _2 = const Option::<Layout>::None;
+ StorageLive(_10);
+ _10 = const 0_isize;
+ switchInt(const 0_isize) -> [0: bb2, 1: bb4, otherwise: bb3];
+ }
+
+ bb1: {
+ StorageDead(_6);
+ StorageLive(_12);
+ _12 = (_5.0: *const [u8]);
+ _4 = move _12 as *mut [u8] (PtrToPtr);
+ StorageDead(_12);
+ StorageDead(_5);
+ _3 = move _4 as *mut u8 (PtrToPtr);
+ StorageDead(_4);
+ StorageDead(_3);
+ return;
+ }
+
+ bb2: {
+ _11 = core::panicking::panic(const "called `Option::unwrap()` on a `None` value") -> unwind continue;
+ }
+
+ bb3: {
+ unreachable;
+ }
+
+ bb4: {
+- _1 = move ((_2 as Some).0: std::alloc::Layout);
++ _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): ptr::alignment::AlignmentEnum64) }};
+ StorageDead(_10);
+ StorageDead(_2);
+ StorageLive(_3);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _9 = const _;
+- _6 = std::alloc::Global::alloc_impl(_9, _1, const false) -> [return: bb5, unwind continue];
++ _6 = std::alloc::Global::alloc_impl(const {ALLOC1: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): ptr::alignment::AlignmentEnum64) }}, const false) -> [return: bb5, unwind continue];
+ }
+
+ bb5: {
+ _5 = Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue];
+ }
+ }
++
++ ALLOC0 (size: 16, align: 8) {
++ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
++ }
++
++ ALLOC1 (size: 0, align: 1) {}
+
diff --git a/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs
new file mode 100644
index 000000000..c92424f29
--- /dev/null
+++ b/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs
@@ -0,0 +1,15 @@
+// Verify that we do not ICE when printing an invalid constant.
+// EMIT_MIR_FOR_EACH_BIT_WIDTH
+// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
+
+#![feature(allocator_api)]
+
+use std::alloc::{Allocator, Global, Layout};
+
+// EMIT_MIR issue_117368_print_invalid_constant.main.GVN.diff
+fn main() {
+ // CHECK-LABEL: fn main(
+ // CHECK: debug layout => const Layout
+ let layout: Layout = None.unwrap();
+ let ptr: *mut u8 = Global.allocate(layout).unwrap().as_ptr() as _;
+}
diff --git a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
index 4db829a5e..8dbb68899 100644
--- a/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir
@@ -6,19 +6,18 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
let mut _0: ();
let mut _3: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
let mut _4: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
- let mut _5: std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
+ let mut _5: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
let mut _8: std::option::Option<U>;
let mut _9: isize;
let _11: ();
- let mut _12: &mut std::iter::FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>>;
scope 1 {
- debug iter => _5;
+ debug iter => _4;
let _10: U;
scope 2 {
debug x => _10;
}
scope 4 (inlined <FilterMap<impl Iterator<Item = T>, impl Fn(T) -> Option<U>> as Iterator>::next) {
- debug self => _12;
+ debug self => _5;
let mut _6: &mut impl Iterator<Item = T>;
let mut _7: &mut impl Fn(T) -> Option<U>;
}
@@ -28,25 +27,22 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
}
bb0: {
- StorageLive(_4);
- StorageLive(_3);
_3 = <impl Iterator<Item = T> as Iterator>::filter_map::<U, impl Fn(T) -> Option<U>>(move _1, move _2) -> [return: bb1, unwind continue];
}
bb1: {
+ StorageLive(_4);
_4 = move _3;
- StorageDead(_3);
- StorageLive(_5);
- _5 = move _4;
goto -> bb2;
}
bb2: {
StorageLive(_8);
+ _5 = &mut _4;
StorageLive(_6);
- _6 = &mut (_5.0: impl Iterator<Item = T>);
+ _6 = &mut (_4.0: impl Iterator<Item = T>);
StorageLive(_7);
- _7 = &mut (_5.1: impl Fn(T) -> Option<U>);
+ _7 = &mut (_4.1: impl Fn(T) -> Option<U>);
_8 = <impl Iterator<Item = T> as Iterator>::find_map::<U, &mut impl Fn(T) -> Option<U>>(move _6, move _7) -> [return: bb3, unwind: bb9];
}
@@ -59,11 +55,10 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
bb4: {
StorageDead(_8);
- drop(_5) -> [return: bb5, unwind continue];
+ drop(_4) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_5);
StorageDead(_4);
return;
}
@@ -83,7 +78,7 @@ fn filter_mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> Option<U>) -> ()
}
bb9 (cleanup): {
- drop(_5) -> [return: bb10, unwind terminate(cleanup)];
+ drop(_4) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
index 0d79f2de1..49f685cfa 100644
--- a/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir
@@ -6,35 +6,35 @@ fn int_range(_1: usize, _2: usize) -> () {
let mut _0: ();
let mut _3: std::ops::Range<usize>;
let mut _4: std::ops::Range<usize>;
- let mut _8: std::option::Option<usize>;
- let mut _11: isize;
- let _13: ();
- let mut _14: &mut std::ops::Range<usize>;
+ let mut _5: &mut std::ops::Range<usize>;
+ let mut _11: std::option::Option<usize>;
+ let mut _14: isize;
+ let _16: ();
scope 1 {
debug iter => _4;
- let _12: usize;
+ let _15: usize;
scope 2 {
- debug i => _12;
+ debug i => _15;
}
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
- debug self => _14;
+ debug self => _5;
scope 5 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _14;
- let mut _7: bool;
- let _9: usize;
- let mut _10: usize;
- let mut _15: &usize;
- let mut _16: &usize;
+ debug self => _5;
+ let mut _6: &usize;
+ let mut _7: &usize;
+ let mut _10: bool;
+ let _12: usize;
+ let mut _13: usize;
scope 6 {
- debug old => _9;
+ debug old => _12;
scope 7 {
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
- debug self => _15;
- debug other => _16;
- let mut _5: usize;
- let mut _6: usize;
+ debug self => _6;
+ debug other => _7;
+ let mut _8: usize;
+ let mut _9: usize;
}
}
}
@@ -51,63 +51,66 @@ fn int_range(_1: usize, _2: usize) -> () {
}
bb1: {
+ StorageLive(_11);
+ _5 = &mut _4;
+ StorageLive(_12);
+ StorageLive(_10);
+ StorageLive(_6);
+ _6 = &(_4.0: usize);
+ StorageLive(_7);
+ _7 = &(_4.1: usize);
StorageLive(_8);
+ _8 = (_4.0: usize);
StorageLive(_9);
- StorageLive(_7);
- StorageLive(_15);
- StorageLive(_16);
- StorageLive(_5);
- _5 = (_4.0: usize);
- StorageLive(_6);
- _6 = (_4.1: usize);
- _7 = Lt(move _5, move _6);
- StorageDead(_6);
- StorageDead(_5);
- switchInt(move _7) -> [0: bb2, otherwise: bb3];
+ _9 = (_4.1: usize);
+ _10 = Lt(move _8, move _9);
+ StorageDead(_9);
+ StorageDead(_8);
+ switchInt(move _10) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_16);
- StorageDead(_15);
- _8 = Option::<usize>::None;
+ StorageDead(_7);
+ StorageDead(_6);
+ _11 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_16);
- StorageDead(_15);
- _9 = (_4.0: usize);
- StorageLive(_10);
- _10 = <usize as Step>::forward_unchecked(_9, const 1_usize) -> [return: bb4, unwind continue];
+ StorageDead(_7);
+ StorageDead(_6);
+ _12 = (_4.0: usize);
+ StorageLive(_13);
+ _13 = <usize as Step>::forward_unchecked(_12, const 1_usize) -> [return: bb4, unwind continue];
}
bb4: {
- (_4.0: usize) = move _10;
- StorageDead(_10);
- _8 = Option::<usize>::Some(_9);
+ (_4.0: usize) = move _13;
+ StorageDead(_13);
+ _11 = Option::<usize>::Some(_12);
goto -> bb5;
}
bb5: {
- StorageDead(_7);
- StorageDead(_9);
- _11 = discriminant(_8);
- switchInt(move _11) -> [0: bb6, 1: bb7, otherwise: bb9];
+ StorageDead(_10);
+ StorageDead(_12);
+ _14 = discriminant(_11);
+ switchInt(move _14) -> [0: bb6, 1: bb7, otherwise: bb9];
}
bb6: {
- StorageDead(_8);
+ StorageDead(_11);
StorageDead(_4);
return;
}
bb7: {
- _12 = ((_8 as Some).0: usize);
- _13 = opaque::<usize>(move _12) -> [return: bb8, unwind continue];
+ _15 = ((_11 as Some).0: usize);
+ _16 = opaque::<usize>(move _15) -> [return: bb8, unwind continue];
}
bb8: {
- StorageDead(_8);
+ StorageDead(_11);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
index c30df7425..30bdc1310 100644
--- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir
@@ -6,16 +6,15 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
let mut _0: ();
let mut _3: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
let mut _4: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
- let mut _5: std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
- let mut _6: &mut std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
- let mut _7: std::option::Option<U>;
- let mut _8: isize;
- let _10: ();
+ let mut _5: &mut std::iter::Map<impl Iterator<Item = T>, impl Fn(T) -> U>;
+ let mut _6: std::option::Option<U>;
+ let mut _7: isize;
+ let _9: ();
scope 1 {
- debug iter => _5;
- let _9: U;
+ debug iter => _4;
+ let _8: U;
scope 2 {
- debug x => _9;
+ debug x => _8;
}
}
scope 3 (inlined <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as IntoIterator>::into_iter) {
@@ -23,50 +22,45 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
}
bb0: {
- StorageLive(_4);
- StorageLive(_3);
_3 = <impl Iterator<Item = T> as Iterator>::map::<U, impl Fn(T) -> U>(move _1, move _2) -> [return: bb1, unwind continue];
}
bb1: {
+ StorageLive(_4);
_4 = move _3;
- StorageDead(_3);
- StorageLive(_5);
- _5 = move _4;
goto -> bb2;
}
bb2: {
- StorageLive(_7);
StorageLive(_6);
- _6 = &mut _5;
- _7 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(move _6) -> [return: bb3, unwind: bb9];
+ StorageLive(_5);
+ _5 = &mut _4;
+ _6 = <Map<impl Iterator<Item = T>, impl Fn(T) -> U> as Iterator>::next(move _5) -> [return: bb3, unwind: bb9];
}
bb3: {
- StorageDead(_6);
- _8 = discriminant(_7);
- switchInt(move _8) -> [0: bb4, 1: bb6, otherwise: bb8];
+ StorageDead(_5);
+ _7 = discriminant(_6);
+ switchInt(move _7) -> [0: bb4, 1: bb6, otherwise: bb8];
}
bb4: {
- StorageDead(_7);
- drop(_5) -> [return: bb5, unwind continue];
+ StorageDead(_6);
+ drop(_4) -> [return: bb5, unwind continue];
}
bb5: {
- StorageDead(_5);
StorageDead(_4);
return;
}
bb6: {
- _9 = move ((_7 as Some).0: U);
- _10 = opaque::<U>(move _9) -> [return: bb7, unwind: bb9];
+ _8 = move ((_6 as Some).0: U);
+ _9 = opaque::<U>(move _8) -> [return: bb7, unwind: bb9];
}
bb7: {
- StorageDead(_7);
+ StorageDead(_6);
goto -> bb2;
}
@@ -75,7 +69,7 @@ fn mapped(_1: impl Iterator<Item = T>, _2: impl Fn(T) -> U) -> () {
}
bb9 (cleanup): {
- drop(_5) -> [return: bb10, unwind terminate(cleanup)];
+ drop(_4) -> [return: bb10, unwind terminate(cleanup)];
}
bb10 (cleanup): {
diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs
index f3ba40922..7f9c26f4f 100644
--- a/tests/mir-opt/pre-codegen/loops.rs
+++ b/tests/mir-opt/pre-codegen/loops.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -g
// needs-unwind
diff --git a/tests/mir-opt/pre-codegen/mem_replace.rs b/tests/mir-opt/pre-codegen/mem_replace.rs
index a139848ba..18c4653d4 100644
--- a/tests/mir-opt/pre-codegen/mem_replace.rs
+++ b/tests/mir-opt/pre-codegen/mem_replace.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// ignore-debug the standard library debug assertions leak into this test
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
index 681e9666e..bddd961c9 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-abort.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
index db16b8d82..297ebd79f 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.32bit.panic-unwind.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
index 681e9666e..bddd961c9 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-abort.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
index db16b8d82..297ebd79f 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.main.ConstProp.64bit.panic-unwind.diff
@@ -57,7 +57,7 @@
}
+ }
+
-+ alloc5 (size: 8, align: 4) {
++ ALLOC0 (size: 8, align: 4) {
+ 04 00 00 00 00 __ __ __ │ .....░░░
}
diff --git a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
index 704f8f887..bb089ea44 100644
--- a/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
+++ b/tests/mir-opt/pre-codegen/optimizes_into_variable.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// compile-flags: -C overflow-checks=on
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
index 9664ccfb0..91c3731f4 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-abort.mir
@@ -7,37 +7,37 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
let mut _0: ();
let mut _4: std::ops::Range<u32>;
let mut _5: std::ops::Range<u32>;
- let mut _9: std::option::Option<u32>;
- let mut _12: isize;
- let mut _14: &impl Fn(u32);
- let mut _15: (u32,);
- let _16: ();
- let mut _17: &mut std::ops::Range<u32>;
+ let mut _6: &mut std::ops::Range<u32>;
+ let mut _12: std::option::Option<u32>;
+ let mut _15: isize;
+ let mut _17: &impl Fn(u32);
+ let mut _18: (u32,);
+ let _19: ();
scope 1 {
debug iter => _5;
- let _13: u32;
+ let _16: u32;
scope 2 {
- debug x => _13;
+ debug x => _16;
}
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
- debug self => _17;
+ debug self => _6;
scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _17;
- let mut _8: bool;
- let _10: u32;
- let mut _11: u32;
- let mut _18: &u32;
- let mut _19: &u32;
+ debug self => _6;
+ let mut _7: &u32;
+ let mut _8: &u32;
+ let mut _11: bool;
+ let _13: u32;
+ let mut _14: u32;
scope 6 {
- debug old => _10;
+ debug old => _13;
scope 7 {
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _18;
- debug other => _19;
- let mut _6: u32;
- let mut _7: u32;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: u32;
+ let mut _10: u32;
}
}
}
@@ -54,52 +54,55 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: u32);
+ StorageLive(_8);
+ _8 = &(_5.1: u32);
StorageLive(_9);
+ _9 = (_5.0: u32);
StorageLive(_10);
- StorageLive(_8);
- StorageLive(_18);
- StorageLive(_19);
- StorageLive(_6);
- _6 = (_5.0: u32);
- StorageLive(_7);
- _7 = (_5.1: u32);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: u32);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_19);
- StorageDead(_18);
- _9 = Option::<u32>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_19);
- StorageDead(_18);
- _10 = (_5.0: u32);
- StorageLive(_11);
- _11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: u32);
+ StorageLive(_14);
+ _14 = <u32 as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable];
}
bb4: {
- (_5.0: u32) = move _11;
- StorageDead(_11);
- _9 = Option::<u32>::Some(_10);
+ (_5.0: u32) = move _14;
+ StorageDead(_14);
+ _12 = Option::<u32>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_3) -> [return: bb7, unwind unreachable];
}
@@ -109,18 +112,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: u32);
- StorageLive(_14);
- _14 = &_3;
- StorageLive(_15);
- _15 = (_13,);
- _16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind unreachable];
+ _16 = ((_12 as Some).0: u32);
+ StorageLive(_17);
+ _17 = &_3;
+ StorageLive(_18);
+ _18 = (_16,);
+ _19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind unreachable];
}
bb9: {
- StorageDead(_15);
- StorageDead(_14);
- StorageDead(_9);
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
index dc8b46b6c..f76de02c9 100644
--- a/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.forward_loop.PreCodegen.after.panic-unwind.mir
@@ -7,37 +7,37 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
let mut _0: ();
let mut _4: std::ops::Range<u32>;
let mut _5: std::ops::Range<u32>;
- let mut _9: std::option::Option<u32>;
- let mut _12: isize;
- let mut _14: &impl Fn(u32);
- let mut _15: (u32,);
- let _16: ();
- let mut _17: &mut std::ops::Range<u32>;
+ let mut _6: &mut std::ops::Range<u32>;
+ let mut _12: std::option::Option<u32>;
+ let mut _15: isize;
+ let mut _17: &impl Fn(u32);
+ let mut _18: (u32,);
+ let _19: ();
scope 1 {
debug iter => _5;
- let _13: u32;
+ let _16: u32;
scope 2 {
- debug x => _13;
+ debug x => _16;
}
scope 4 (inlined iter::range::<impl Iterator for std::ops::Range<u32>>::next) {
- debug self => _17;
+ debug self => _6;
scope 5 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _17;
- let mut _8: bool;
- let _10: u32;
- let mut _11: u32;
- let mut _18: &u32;
- let mut _19: &u32;
+ debug self => _6;
+ let mut _7: &u32;
+ let mut _8: &u32;
+ let mut _11: bool;
+ let _13: u32;
+ let mut _14: u32;
scope 6 {
- debug old => _10;
+ debug old => _13;
scope 7 {
}
}
scope 8 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _18;
- debug other => _19;
- let mut _6: u32;
- let mut _7: u32;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: u32;
+ let mut _10: u32;
}
}
}
@@ -54,52 +54,55 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: u32);
+ StorageLive(_8);
+ _8 = &(_5.1: u32);
StorageLive(_9);
+ _9 = (_5.0: u32);
StorageLive(_10);
- StorageLive(_8);
- StorageLive(_18);
- StorageLive(_19);
- StorageLive(_6);
- _6 = (_5.0: u32);
- StorageLive(_7);
- _7 = (_5.1: u32);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: u32);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_19);
- StorageDead(_18);
- _9 = Option::<u32>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<u32>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_19);
- StorageDead(_18);
- _10 = (_5.0: u32);
- StorageLive(_11);
- _11 = <u32 as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb11];
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: u32);
+ StorageLive(_14);
+ _14 = <u32 as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb11];
}
bb4: {
- (_5.0: u32) = move _11;
- StorageDead(_11);
- _9 = Option::<u32>::Some(_10);
+ (_5.0: u32) = move _14;
+ StorageDead(_14);
+ _12 = Option::<u32>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_3) -> [return: bb7, unwind continue];
}
@@ -109,18 +112,18 @@ fn forward_loop(_1: u32, _2: u32, _3: impl Fn(u32)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: u32);
- StorageLive(_14);
- _14 = &_3;
- StorageLive(_15);
- _15 = (_13,);
- _16 = <impl Fn(u32) as Fn<(u32,)>>::call(move _14, move _15) -> [return: bb9, unwind: bb11];
+ _16 = ((_12 as Some).0: u32);
+ StorageLive(_17);
+ _17 = &_3;
+ StorageLive(_18);
+ _18 = (_16,);
+ _19 = <impl Fn(u32) as Fn<(u32,)>>::call(move _17, move _18) -> [return: bb9, unwind: bb11];
}
bb9: {
- StorageDead(_15);
- StorageDead(_14);
- StorageDead(_9);
+ StorageDead(_18);
+ StorageDead(_17);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
index fff713b5a..a7824f36d 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-abort.mir
@@ -7,65 +7,67 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
debug self => _1;
scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => _1;
- let mut _4: bool;
- let _5: u32;
- let mut _6: u32;
- let mut _7: &u32;
- let mut _8: &u32;
+ let mut _2: &u32;
+ let mut _3: &u32;
+ let mut _6: bool;
+ let _7: u32;
+ let mut _8: u32;
scope 3 {
- debug old => _5;
+ debug old => _7;
scope 4 {
}
}
scope 5 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _7;
- debug other => _8;
- let mut _2: u32;
- let mut _3: u32;
+ debug self => _2;
+ debug other => _3;
+ let mut _4: u32;
+ let mut _5: u32;
}
}
}
bb0: {
- StorageLive(_5);
- StorageLive(_4);
StorageLive(_7);
- StorageLive(_8);
+ StorageLive(_6);
StorageLive(_2);
- _2 = ((*_1).0: u32);
+ _2 = &((*_1).0: u32);
StorageLive(_3);
- _3 = ((*_1).1: u32);
- _4 = Lt(move _2, move _3);
- StorageDead(_3);
- StorageDead(_2);
- switchInt(move _4) -> [0: bb1, otherwise: bb2];
+ _3 = &((*_1).1: u32);
+ StorageLive(_4);
+ _4 = ((*_1).0: u32);
+ StorageLive(_5);
+ _5 = ((*_1).1: u32);
+ _6 = Lt(move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ switchInt(move _6) -> [0: bb1, otherwise: bb2];
}
bb1: {
- StorageDead(_8);
- StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_2);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
- StorageDead(_8);
- StorageDead(_7);
- _5 = ((*_1).0: u32);
- StorageLive(_6);
- _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind unreachable];
+ StorageDead(_3);
+ StorageDead(_2);
+ _7 = ((*_1).0: u32);
+ StorageLive(_8);
+ _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind unreachable];
}
bb3: {
- ((*_1).0: u32) = move _6;
- StorageDead(_6);
- _0 = Option::<u32>::Some(_5);
+ ((*_1).0: u32) = move _8;
+ StorageDead(_8);
+ _0 = Option::<u32>::Some(_7);
goto -> bb4;
}
bb4: {
- StorageDead(_4);
- StorageDead(_5);
+ StorageDead(_6);
+ StorageDead(_7);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
index cc12c0122..83c9e6c1a 100644
--- a/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/range_iter.range_iter_next.PreCodegen.after.panic-unwind.mir
@@ -7,65 +7,67 @@ fn range_iter_next(_1: &mut std::ops::Range<u32>) -> Option<u32> {
debug self => _1;
scope 2 (inlined <std::ops::Range<u32> as iter::range::RangeIteratorImpl>::spec_next) {
debug self => _1;
- let mut _4: bool;
- let _5: u32;
- let mut _6: u32;
- let mut _7: &u32;
- let mut _8: &u32;
+ let mut _2: &u32;
+ let mut _3: &u32;
+ let mut _6: bool;
+ let _7: u32;
+ let mut _8: u32;
scope 3 {
- debug old => _5;
+ debug old => _7;
scope 4 {
}
}
scope 5 (inlined cmp::impls::<impl PartialOrd for u32>::lt) {
- debug self => _7;
- debug other => _8;
- let mut _2: u32;
- let mut _3: u32;
+ debug self => _2;
+ debug other => _3;
+ let mut _4: u32;
+ let mut _5: u32;
}
}
}
bb0: {
- StorageLive(_5);
- StorageLive(_4);
StorageLive(_7);
- StorageLive(_8);
+ StorageLive(_6);
StorageLive(_2);
- _2 = ((*_1).0: u32);
+ _2 = &((*_1).0: u32);
StorageLive(_3);
- _3 = ((*_1).1: u32);
- _4 = Lt(move _2, move _3);
- StorageDead(_3);
- StorageDead(_2);
- switchInt(move _4) -> [0: bb1, otherwise: bb2];
+ _3 = &((*_1).1: u32);
+ StorageLive(_4);
+ _4 = ((*_1).0: u32);
+ StorageLive(_5);
+ _5 = ((*_1).1: u32);
+ _6 = Lt(move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ switchInt(move _6) -> [0: bb1, otherwise: bb2];
}
bb1: {
- StorageDead(_8);
- StorageDead(_7);
+ StorageDead(_3);
+ StorageDead(_2);
_0 = Option::<u32>::None;
goto -> bb4;
}
bb2: {
- StorageDead(_8);
- StorageDead(_7);
- _5 = ((*_1).0: u32);
- StorageLive(_6);
- _6 = <u32 as Step>::forward_unchecked(_5, const 1_usize) -> [return: bb3, unwind continue];
+ StorageDead(_3);
+ StorageDead(_2);
+ _7 = ((*_1).0: u32);
+ StorageLive(_8);
+ _8 = <u32 as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb3, unwind continue];
}
bb3: {
- ((*_1).0: u32) = move _6;
- StorageDead(_6);
- _0 = Option::<u32>::Some(_5);
+ ((*_1).0: u32) = move _8;
+ StorageDead(_8);
+ _0 = Option::<u32>::Some(_7);
goto -> bb4;
}
bb4: {
- StorageDead(_4);
- StorageDead(_5);
+ StorageDead(_6);
+ StorageDead(_7);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/range_iter.rs b/tests/mir-opt/pre-codegen/range_iter.rs
index 955214478..80b1a5b2f 100644
--- a/tests/mir-opt/pre-codegen/range_iter.rs
+++ b/tests/mir-opt/pre-codegen/range_iter.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
index 48b780aea..af5d385a9 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/simple_option_map.ezmap.PreCodegen.after.mir
@@ -3,9 +3,9 @@
fn ezmap(_1: Option<i32>) -> Option<i32> {
debug x => _1;
let mut _0: std::option::Option<i32>;
- scope 1 (inlined map::<i32, i32, {closure@$DIR/simple_option_map.rs:17:12: 17:15}>) {
+ scope 1 (inlined map::<i32, i32, {closure@$DIR/simple_option_map.rs:18:12: 18:15}>) {
debug slf => _1;
- debug f => const ZeroSized: {closure@$DIR/simple_option_map.rs:17:12: 17:15};
+ debug f => const ZeroSized: {closure@$DIR/simple_option_map.rs:18:12: 18:15};
let mut _2: isize;
let _3: i32;
let mut _4: i32;
@@ -18,6 +18,7 @@ fn ezmap(_1: Option<i32>) -> Option<i32> {
}
bb0: {
+ StorageLive(_2);
_2 = discriminant(_1);
switchInt(move _2) -> [0: bb1, 1: bb2, otherwise: bb4];
}
@@ -37,6 +38,7 @@ fn ezmap(_1: Option<i32>) -> Option<i32> {
}
bb3: {
+ StorageDead(_2);
return;
}
diff --git a/tests/mir-opt/pre-codegen/simple_option_map.rs b/tests/mir-opt/pre-codegen/simple_option_map.rs
index d4f28dda6..35f9ab3e1 100644
--- a/tests/mir-opt/pre-codegen/simple_option_map.rs
+++ b/tests/mir-opt/pre-codegen/simple_option_map.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
diff --git a/tests/mir-opt/pre-codegen/slice_filter.rs b/tests/mir-opt/pre-codegen/slice_filter.rs
index aba951acd..483e58766 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.rs
+++ b/tests/mir-opt/pre-codegen/slice_filter.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
// ignore-debug: standard library debug assertions add a panic that breaks this optimization
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
index ed286beb4..548767dca 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir
@@ -1,6 +1,6 @@
// MIR for `variant_a::{closure#0}` after PreCodegen
-fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2: &&(usize, usize, usize, usize)) -> bool {
+fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:8:25: 8:39}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: &usize;
@@ -10,74 +10,74 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
let _8: &usize;
let mut _9: &(usize, usize, usize, usize);
let _10: &usize;
- let _11: &usize;
- let mut _16: bool;
- let _17: &usize;
- let mut _22: bool;
- let _23: &usize;
- let mut _28: bool;
- let _29: &usize;
- let mut _34: &&usize;
+ let mut _11: &&usize;
+ let _12: &usize;
+ let mut _13: &&usize;
+ let mut _18: bool;
+ let mut _19: &&usize;
+ let _20: &usize;
+ let mut _21: &&usize;
+ let mut _26: bool;
+ let mut _27: &&usize;
+ let _28: &usize;
+ let mut _29: &&usize;
+ let mut _34: bool;
let mut _35: &&usize;
- let mut _36: &&usize;
+ let _36: &usize;
let mut _37: &&usize;
- let mut _38: &&usize;
- let mut _39: &&usize;
- let mut _40: &&usize;
- let mut _41: &&usize;
scope 1 {
debug a => _4;
debug b => _6;
debug c => _8;
debug d => _10;
scope 2 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _34;
- debug other => _35;
- let mut _12: &usize;
- let mut _13: &usize;
+ debug self => _11;
+ debug other => _13;
+ let mut _14: &usize;
+ let mut _15: &usize;
scope 3 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _12;
- debug other => _13;
- let mut _14: usize;
- let mut _15: usize;
+ debug self => _14;
+ debug other => _15;
+ let mut _16: usize;
+ let mut _17: usize;
}
}
scope 4 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _36;
- debug other => _37;
- let mut _18: &usize;
- let mut _19: &usize;
+ debug self => _19;
+ debug other => _21;
+ let mut _22: &usize;
+ let mut _23: &usize;
scope 5 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _18;
- debug other => _19;
- let mut _20: usize;
- let mut _21: usize;
+ debug self => _22;
+ debug other => _23;
+ let mut _24: usize;
+ let mut _25: usize;
}
}
scope 6 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _38;
- debug other => _39;
- let mut _24: &usize;
- let mut _25: &usize;
- scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
- debug self => _24;
- debug other => _25;
- let mut _26: usize;
- let mut _27: usize;
- }
- }
- scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
- debug self => _40;
- debug other => _41;
+ debug self => _27;
+ debug other => _29;
let mut _30: &usize;
let mut _31: &usize;
- scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
+ scope 7 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
debug self => _30;
debug other => _31;
let mut _32: usize;
let mut _33: usize;
}
}
+ scope 8 (inlined cmp::impls::<impl PartialOrd for &usize>::le) {
+ debug self => _35;
+ debug other => _37;
+ let mut _38: &usize;
+ let mut _39: &usize;
+ scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::le) {
+ debug self => _38;
+ debug other => _39;
+ let mut _40: usize;
+ let mut _41: usize;
+ }
+ }
}
bb0: {
@@ -93,123 +93,147 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
StorageLive(_10);
_9 = deref_copy (*_2);
_10 = &((*_9).3: usize);
- StorageLive(_16);
- StorageLive(_34);
- StorageLive(_35);
+ StorageLive(_18);
StorageLive(_11);
- _11 = _8;
- _12 = deref_copy _4;
- _13 = deref_copy _11;
+ _11 = &_4;
+ StorageLive(_13);
+ StorageLive(_12);
+ _12 = _8;
+ _13 = &_12;
StorageLive(_14);
- _14 = (*_12);
StorageLive(_15);
- _15 = (*_13);
- _16 = Le(move _14, move _15);
+ _14 = deref_copy _4;
+ _15 = deref_copy _12;
+ StorageLive(_16);
+ _16 = (*_14);
+ StorageLive(_17);
+ _17 = (*_15);
+ _18 = Le(move _16, move _17);
+ StorageDead(_17);
+ StorageDead(_16);
StorageDead(_15);
StorageDead(_14);
- switchInt(move _16) -> [0: bb1, otherwise: bb2];
+ switchInt(move _18) -> [0: bb1, otherwise: bb2];
}
bb1: {
+ StorageDead(_12);
+ StorageDead(_13);
StorageDead(_11);
- StorageDead(_35);
- StorageDead(_34);
goto -> bb4;
}
bb2: {
+ StorageDead(_12);
+ StorageDead(_13);
StorageDead(_11);
- StorageDead(_35);
- StorageDead(_34);
- StorageLive(_22);
- StorageLive(_36);
- StorageLive(_37);
- StorageLive(_17);
- _17 = _6;
- _18 = deref_copy _10;
- _19 = deref_copy _17;
- StorageLive(_20);
- _20 = (*_18);
+ StorageLive(_26);
+ StorageLive(_19);
+ _19 = &_10;
StorageLive(_21);
- _21 = (*_19);
- _22 = Le(move _20, move _21);
- StorageDead(_21);
- StorageDead(_20);
- switchInt(move _22) -> [0: bb3, otherwise: bb8];
+ StorageLive(_20);
+ _20 = _6;
+ _21 = &_20;
+ StorageLive(_22);
+ StorageLive(_23);
+ _22 = deref_copy _10;
+ _23 = deref_copy _20;
+ StorageLive(_24);
+ _24 = (*_22);
+ StorageLive(_25);
+ _25 = (*_23);
+ _26 = Le(move _24, move _25);
+ StorageDead(_25);
+ StorageDead(_24);
+ StorageDead(_23);
+ StorageDead(_22);
+ switchInt(move _26) -> [0: bb3, otherwise: bb8];
}
bb3: {
- StorageDead(_17);
- StorageDead(_37);
- StorageDead(_36);
+ StorageDead(_20);
+ StorageDead(_21);
+ StorageDead(_19);
goto -> bb4;
}
bb4: {
- StorageLive(_28);
- StorageLive(_38);
- StorageLive(_39);
- StorageLive(_23);
- _23 = _4;
- _24 = deref_copy _8;
- _25 = deref_copy _23;
- StorageLive(_26);
- _26 = (*_24);
+ StorageLive(_34);
StorageLive(_27);
- _27 = (*_25);
- _28 = Le(move _26, move _27);
- StorageDead(_27);
- StorageDead(_26);
- switchInt(move _28) -> [0: bb5, otherwise: bb6];
+ _27 = &_8;
+ StorageLive(_29);
+ StorageLive(_28);
+ _28 = _4;
+ _29 = &_28;
+ StorageLive(_30);
+ StorageLive(_31);
+ _30 = deref_copy _8;
+ _31 = deref_copy _28;
+ StorageLive(_32);
+ _32 = (*_30);
+ StorageLive(_33);
+ _33 = (*_31);
+ _34 = Le(move _32, move _33);
+ StorageDead(_33);
+ StorageDead(_32);
+ StorageDead(_31);
+ StorageDead(_30);
+ switchInt(move _34) -> [0: bb5, otherwise: bb6];
}
bb5: {
- StorageDead(_23);
- StorageDead(_39);
- StorageDead(_38);
+ StorageDead(_28);
+ StorageDead(_29);
+ StorageDead(_27);
_0 = const false;
goto -> bb7;
}
bb6: {
- StorageDead(_23);
- StorageDead(_39);
- StorageDead(_38);
+ StorageDead(_28);
+ StorageDead(_29);
+ StorageDead(_27);
+ StorageLive(_35);
+ _35 = &_6;
+ StorageLive(_37);
+ StorageLive(_36);
+ _36 = _10;
+ _37 = &_36;
+ StorageLive(_38);
+ StorageLive(_39);
+ _38 = deref_copy _6;
+ _39 = deref_copy _36;
StorageLive(_40);
+ _40 = (*_38);
StorageLive(_41);
- StorageLive(_29);
- _29 = _10;
- _30 = deref_copy _6;
- _31 = deref_copy _29;
- StorageLive(_32);
- _32 = (*_30);
- StorageLive(_33);
- _33 = (*_31);
- _0 = Le(move _32, move _33);
- StorageDead(_33);
- StorageDead(_32);
- StorageDead(_29);
+ _41 = (*_39);
+ _0 = Le(move _40, move _41);
StorageDead(_41);
StorageDead(_40);
+ StorageDead(_39);
+ StorageDead(_38);
+ StorageDead(_36);
+ StorageDead(_37);
+ StorageDead(_35);
goto -> bb7;
}
bb7: {
- StorageDead(_28);
+ StorageDead(_34);
goto -> bb9;
}
bb8: {
- StorageDead(_17);
- StorageDead(_37);
- StorageDead(_36);
+ StorageDead(_20);
+ StorageDead(_21);
+ StorageDead(_19);
_0 = const true;
goto -> bb9;
}
bb9: {
- StorageDead(_22);
- StorageDead(_16);
+ StorageDead(_26);
+ StorageDead(_18);
StorageDead(_10);
StorageDead(_8);
StorageDead(_6);
diff --git a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
index 80c8cebff..e2ed1d101 100644
--- a/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
+++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir
@@ -1,6 +1,6 @@
// MIR for `variant_b::{closure#0}` after PreCodegen
-fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41}, _2: &&(usize, usize, usize, usize)) -> bool {
+fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:12:25: 12:41}, _2: &&(usize, usize, usize, usize)) -> bool {
let mut _0: bool;
let mut _3: &(usize, usize, usize, usize);
let _4: usize;
diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs
index 57ffb07e2..5225fc5c6 100644
--- a/tests/mir-opt/pre-codegen/slice_index.rs
+++ b/tests/mir-opt/pre-codegen/slice_index.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// ignore-debug the standard library debug assertions leak into this test
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
index 2fd669aee..729841ec5 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir
@@ -19,11 +19,9 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
- let _15: usize;
- let _16: usize;
scope 4 {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
scope 5 {
let _6: usize;
scope 6 {
@@ -56,8 +54,8 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
}
}
scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
debug slice => _5;
scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
debug self => _5;
@@ -82,8 +80,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_5 = &raw mut (*_1);
StorageLive(_6);
StorageLive(_14);
- StorageLive(_15);
- StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@@ -104,8 +100,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- StorageDead(_16);
- StorageDead(_15);
StorageDead(_14);
StorageDead(_6);
StorageDead(_5);
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
index 2fd669aee..729841ec5 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir
@@ -19,11 +19,9 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
debug slice => _5;
let mut _7: *mut u32;
let mut _8: *mut u32;
- let _15: usize;
- let _16: usize;
scope 4 {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
scope 5 {
let _6: usize;
scope 6 {
@@ -56,8 +54,8 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
}
}
scope 7 (inlined <std::ops::Range<usize> as SliceIndex<[T]>>::get_unchecked_mut::runtime::<u32>) {
- debug ((this: std::ops::Range<usize>).0: usize) => _15;
- debug ((this: std::ops::Range<usize>).1: usize) => _16;
+ debug ((this: std::ops::Range<usize>).0: usize) => _3;
+ debug ((this: std::ops::Range<usize>).1: usize) => _4;
debug slice => _5;
scope 8 (inlined ptr::mut_ptr::<impl *mut [u32]>::len) {
debug self => _5;
@@ -82,8 +80,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
_5 = &raw mut (*_1);
StorageLive(_6);
StorageLive(_14);
- StorageLive(_15);
- StorageLive(_16);
_6 = SubUnchecked(_4, _3);
StorageLive(_8);
StorageLive(_7);
@@ -104,8 +100,6 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- StorageDead(_16);
- StorageDead(_15);
StorageDead(_14);
StorageDead(_6);
StorageDead(_5);
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir
index df6d2263d..d97c96ac8 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir
@@ -7,17 +7,13 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) {
debug self => _1;
debug index => _2;
- let _3: &[u32];
}
bb0: {
- StorageLive(_3);
- _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable];
+ _0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind unreachable];
}
bb1: {
- _0 = _3;
- StorageDead(_3);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir
index cc1795c3f..4a976002f 100644
--- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir
@@ -7,17 +7,13 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
scope 1 (inlined #[track_caller] core::slice::index::<impl Index<std::ops::Range<usize>> for [u32]>::index) {
debug self => _1;
debug index => _2;
- let _3: &[u32];
}
bb0: {
- StorageLive(_3);
- _3 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue];
+ _0 = <std::ops::Range<usize> as SliceIndex<[u32]>>::index(move _2, move _1) -> [return: bb1, unwind continue];
}
bb1: {
- _0 = _3;
- StorageDead(_3);
return;
}
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
index 4afe2eda1..ac1de7b4c 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-abort.mir
@@ -7,43 +7,43 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
let mut _3: usize;
let mut _4: std::ops::Range<usize>;
let mut _5: std::ops::Range<usize>;
- let mut _9: std::option::Option<usize>;
- let mut _12: isize;
- let mut _14: usize;
- let mut _15: bool;
- let mut _17: &impl Fn(usize, &T);
- let mut _18: (usize, &T);
- let _19: ();
- let mut _20: &mut std::ops::Range<usize>;
+ let mut _6: &mut std::ops::Range<usize>;
+ let mut _12: std::option::Option<usize>;
+ let mut _15: isize;
+ let mut _17: usize;
+ let mut _18: bool;
+ let mut _20: &impl Fn(usize, &T);
+ let mut _21: (usize, &T);
+ let _22: ();
scope 1 {
debug iter => _5;
- let _13: usize;
+ let _16: usize;
scope 2 {
- debug i => _13;
- let _16: &T;
+ debug i => _16;
+ let _19: &T;
scope 3 {
- debug x => _16;
+ debug x => _19;
}
}
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
- debug self => _20;
+ debug self => _6;
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _20;
- let mut _8: bool;
- let _10: usize;
- let mut _11: usize;
- let mut _21: &usize;
- let mut _22: &usize;
+ debug self => _6;
+ let mut _7: &usize;
+ let mut _8: &usize;
+ let mut _11: bool;
+ let _13: usize;
+ let mut _14: usize;
scope 7 {
- debug old => _10;
+ debug old => _13;
scope 8 {
}
}
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
- debug self => _21;
- debug other => _22;
- let mut _6: usize;
- let mut _7: usize;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: usize;
+ let mut _10: usize;
}
}
}
@@ -63,52 +63,55 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: usize);
+ StorageLive(_8);
+ _8 = &(_5.1: usize);
StorageLive(_9);
+ _9 = (_5.0: usize);
StorageLive(_10);
- StorageLive(_8);
- StorageLive(_21);
- StorageLive(_22);
- StorageLive(_6);
- _6 = (_5.0: usize);
- StorageLive(_7);
- _7 = (_5.1: usize);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: usize);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_22);
- StorageDead(_21);
- _9 = Option::<usize>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_22);
- StorageDead(_21);
- _10 = (_5.0: usize);
- StorageLive(_11);
- _11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind unreachable];
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: usize);
+ StorageLive(_14);
+ _14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind unreachable];
}
bb4: {
- (_5.0: usize) = move _11;
- StorageDead(_11);
- _9 = Option::<usize>::Some(_10);
+ (_5.0: usize) = move _14;
+ StorageDead(_14);
+ _12 = Option::<usize>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_2) -> [return: bb7, unwind unreachable];
}
@@ -118,25 +121,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: usize);
- _14 = Len((*_1));
- _15 = Lt(_13, _14);
- assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind unreachable];
+ _16 = ((_12 as Some).0: usize);
+ _17 = Len((*_1));
+ _18 = Lt(_16, _17);
+ assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind unreachable];
}
bb9: {
- _16 = &(*_1)[_13];
- StorageLive(_17);
- _17 = &_2;
- StorageLive(_18);
- _18 = (_13, _16);
- _19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind unreachable];
+ _19 = &(*_1)[_16];
+ StorageLive(_20);
+ _20 = &_2;
+ StorageLive(_21);
+ _21 = (_16, _19);
+ _22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind unreachable];
}
bb10: {
- StorageDead(_18);
- StorageDead(_17);
- StorageDead(_9);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
index 48092608d..3c49ecf95 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
@@ -7,43 +7,43 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
let mut _3: usize;
let mut _4: std::ops::Range<usize>;
let mut _5: std::ops::Range<usize>;
- let mut _9: std::option::Option<usize>;
- let mut _12: isize;
- let mut _14: usize;
- let mut _15: bool;
- let mut _17: &impl Fn(usize, &T);
- let mut _18: (usize, &T);
- let _19: ();
- let mut _20: &mut std::ops::Range<usize>;
+ let mut _6: &mut std::ops::Range<usize>;
+ let mut _12: std::option::Option<usize>;
+ let mut _15: isize;
+ let mut _17: usize;
+ let mut _18: bool;
+ let mut _20: &impl Fn(usize, &T);
+ let mut _21: (usize, &T);
+ let _22: ();
scope 1 {
debug iter => _5;
- let _13: usize;
+ let _16: usize;
scope 2 {
- debug i => _13;
- let _16: &T;
+ debug i => _16;
+ let _19: &T;
scope 3 {
- debug x => _16;
+ debug x => _19;
}
}
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
- debug self => _20;
+ debug self => _6;
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
- debug self => _20;
- let mut _8: bool;
- let _10: usize;
- let mut _11: usize;
- let mut _21: &usize;
- let mut _22: &usize;
+ debug self => _6;
+ let mut _7: &usize;
+ let mut _8: &usize;
+ let mut _11: bool;
+ let _13: usize;
+ let mut _14: usize;
scope 7 {
- debug old => _10;
+ debug old => _13;
scope 8 {
}
}
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
- debug self => _21;
- debug other => _22;
- let mut _6: usize;
- let mut _7: usize;
+ debug self => _7;
+ debug other => _8;
+ let mut _9: usize;
+ let mut _10: usize;
}
}
}
@@ -63,52 +63,55 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb1: {
+ StorageLive(_12);
+ _6 = &mut _5;
+ StorageLive(_13);
+ StorageLive(_11);
+ StorageLive(_7);
+ _7 = &(_5.0: usize);
+ StorageLive(_8);
+ _8 = &(_5.1: usize);
StorageLive(_9);
+ _9 = (_5.0: usize);
StorageLive(_10);
- StorageLive(_8);
- StorageLive(_21);
- StorageLive(_22);
- StorageLive(_6);
- _6 = (_5.0: usize);
- StorageLive(_7);
- _7 = (_5.1: usize);
- _8 = Lt(move _6, move _7);
- StorageDead(_7);
- StorageDead(_6);
- switchInt(move _8) -> [0: bb2, otherwise: bb3];
+ _10 = (_5.1: usize);
+ _11 = Lt(move _9, move _10);
+ StorageDead(_10);
+ StorageDead(_9);
+ switchInt(move _11) -> [0: bb2, otherwise: bb3];
}
bb2: {
- StorageDead(_22);
- StorageDead(_21);
- _9 = Option::<usize>::None;
+ StorageDead(_8);
+ StorageDead(_7);
+ _12 = Option::<usize>::None;
goto -> bb5;
}
bb3: {
- StorageDead(_22);
- StorageDead(_21);
- _10 = (_5.0: usize);
- StorageLive(_11);
- _11 = <usize as Step>::forward_unchecked(_10, const 1_usize) -> [return: bb4, unwind: bb12];
+ StorageDead(_8);
+ StorageDead(_7);
+ _13 = (_5.0: usize);
+ StorageLive(_14);
+ _14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb12];
}
bb4: {
- (_5.0: usize) = move _11;
- StorageDead(_11);
- _9 = Option::<usize>::Some(_10);
+ (_5.0: usize) = move _14;
+ StorageDead(_14);
+ _12 = Option::<usize>::Some(_13);
goto -> bb5;
}
bb5: {
- StorageDead(_8);
- StorageDead(_10);
- _12 = discriminant(_9);
- switchInt(move _12) -> [0: bb6, 1: bb8, otherwise: bb11];
+ StorageDead(_11);
+ StorageDead(_13);
+ _15 = discriminant(_12);
+ switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11];
}
bb6: {
- StorageDead(_9);
+ StorageDead(_12);
StorageDead(_5);
drop(_2) -> [return: bb7, unwind continue];
}
@@ -118,25 +121,25 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
}
bb8: {
- _13 = ((_9 as Some).0: usize);
- _14 = Len((*_1));
- _15 = Lt(_13, _14);
- assert(move _15, "index out of bounds: the length is {} but the index is {}", move _14, _13) -> [success: bb9, unwind: bb12];
+ _16 = ((_12 as Some).0: usize);
+ _17 = Len((*_1));
+ _18 = Lt(_16, _17);
+ assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind: bb12];
}
bb9: {
- _16 = &(*_1)[_13];
- StorageLive(_17);
- _17 = &_2;
- StorageLive(_18);
- _18 = (_13, _16);
- _19 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _17, move _18) -> [return: bb10, unwind: bb12];
+ _19 = &(*_1)[_16];
+ StorageLive(_20);
+ _20 = &_2;
+ StorageLive(_21);
+ _21 = (_16, _19);
+ _22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind: bb12];
}
bb10: {
- StorageDead(_18);
- StorageDead(_17);
- StorageDead(_9);
+ StorageDead(_21);
+ StorageDead(_20);
+ StorageDead(_12);
goto -> bb1;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
index 549cb4f46..f3760463f 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir
@@ -7,21 +7,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
let mut _13: std::slice::Iter<'_, T>;
let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
- let mut _17: std::option::Option<&T>;
- let mut _18: isize;
- let mut _20: &impl Fn(&T);
- let mut _21: (&T,);
- let _22: ();
- let mut _23: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _16: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _18: std::option::Option<&T>;
+ let mut _19: isize;
+ let mut _21: &impl Fn(&T);
+ let mut _22: (&T,);
+ let _23: ();
scope 1 {
debug iter => _15;
- let _19: &T;
+ let _20: &T;
scope 2 {
- debug x => _19;
+ debug x => _20;
}
scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
- debug self => _23;
- let mut _16: &mut std::slice::Iter<'_, T>;
+ debug self => _16;
+ let mut _17: &mut std::slice::Iter<'_, T>;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@@ -153,20 +153,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb4: {
+ StorageLive(_18);
+ _16 = &mut _15;
StorageLive(_17);
- StorageLive(_16);
- _16 = &mut (_15.0: std::slice::Iter<'_, T>);
- _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind unreachable];
+ _17 = &mut (_15.0: std::slice::Iter<'_, T>);
+ _18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind unreachable];
}
bb5: {
- StorageDead(_16);
- _18 = discriminant(_17);
- switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_17);
+ _19 = discriminant(_18);
+ switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_17);
+ StorageDead(_18);
StorageDead(_15);
drop(_2) -> [return: bb7, unwind unreachable];
}
@@ -176,18 +177,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb8: {
- _19 = ((_17 as Some).0: &T);
- StorageLive(_20);
- _20 = &_2;
+ _20 = ((_18 as Some).0: &T);
StorageLive(_21);
- _21 = (_19,);
- _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind unreachable];
+ _21 = &_2;
+ StorageLive(_22);
+ _22 = (_20,);
+ _23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind unreachable];
}
bb9: {
+ StorageDead(_22);
StorageDead(_21);
- StorageDead(_20);
- StorageDead(_17);
+ StorageDead(_18);
goto -> bb4;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
index 3cdc49f60..e63f8b893 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir
@@ -7,21 +7,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
let mut _13: std::slice::Iter<'_, T>;
let mut _14: std::iter::Rev<std::slice::Iter<'_, T>>;
let mut _15: std::iter::Rev<std::slice::Iter<'_, T>>;
- let mut _17: std::option::Option<&T>;
- let mut _18: isize;
- let mut _20: &impl Fn(&T);
- let mut _21: (&T,);
- let _22: ();
- let mut _23: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _16: &mut std::iter::Rev<std::slice::Iter<'_, T>>;
+ let mut _18: std::option::Option<&T>;
+ let mut _19: isize;
+ let mut _21: &impl Fn(&T);
+ let mut _22: (&T,);
+ let _23: ();
scope 1 {
debug iter => _15;
- let _19: &T;
+ let _20: &T;
scope 2 {
- debug x => _19;
+ debug x => _20;
}
scope 25 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) {
- debug self => _23;
- let mut _16: &mut std::slice::Iter<'_, T>;
+ debug self => _16;
+ let mut _17: &mut std::slice::Iter<'_, T>;
}
}
scope 3 (inlined core::slice::<impl [T]>::iter) {
@@ -153,20 +153,21 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb4: {
+ StorageLive(_18);
+ _16 = &mut _15;
StorageLive(_17);
- StorageLive(_16);
- _16 = &mut (_15.0: std::slice::Iter<'_, T>);
- _17 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _16) -> [return: bb5, unwind: bb11];
+ _17 = &mut (_15.0: std::slice::Iter<'_, T>);
+ _18 = <std::slice::Iter<'_, T> as DoubleEndedIterator>::next_back(move _17) -> [return: bb5, unwind: bb11];
}
bb5: {
- StorageDead(_16);
- _18 = discriminant(_17);
- switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10];
+ StorageDead(_17);
+ _19 = discriminant(_18);
+ switchInt(move _19) -> [0: bb6, 1: bb8, otherwise: bb10];
}
bb6: {
- StorageDead(_17);
+ StorageDead(_18);
StorageDead(_15);
drop(_2) -> [return: bb7, unwind continue];
}
@@ -176,18 +177,18 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () {
}
bb8: {
- _19 = ((_17 as Some).0: &T);
- StorageLive(_20);
- _20 = &_2;
+ _20 = ((_18 as Some).0: &T);
StorageLive(_21);
- _21 = (_19,);
- _22 = <impl Fn(&T) as Fn<(&T,)>>::call(move _20, move _21) -> [return: bb9, unwind: bb11];
+ _21 = &_2;
+ StorageLive(_22);
+ _22 = (_20,);
+ _23 = <impl Fn(&T) as Fn<(&T,)>>::call(move _21, move _22) -> [return: bb9, unwind: bb11];
}
bb9: {
+ StorageDead(_22);
StorageDead(_21);
- StorageDead(_20);
- StorageDead(_17);
+ StorageDead(_18);
goto -> bb4;
}
diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs
index 179005636..10a5c3070 100644
--- a/tests/mir-opt/pre-codegen/slice_iter.rs
+++ b/tests/mir-opt/pre-codegen/slice_iter.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit
// ignore-debug the standard library debug assertions leak into this test
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
index 1d3317efd..485dc9179 100644
--- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-abort.mir
@@ -1,21 +1,18 @@
// MIR for `outer` after PreCodegen
fn outer(_1: u8) -> u8 {
- debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15
- let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26
- let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13
- _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13
- _0 = inner(move _2) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/spans.rs:10:5: 10:14
- // mir::ConstOperand
- // + span: $DIR/spans.rs:10:5: 10:10
- // + const_: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(inner) }
+ debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15
+ let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26
+ let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13
+ scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14
+ debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15
}
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14
- return; // scope 0 at $DIR/spans.rs:11:2: 11:2
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
+ return; // scope 0 at $DIR/spans.rs:12:2: 12:2
}
}
diff --git a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
index aba66861f..485dc9179 100644
--- a/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
+++ b/tests/mir-opt/pre-codegen/spans.outer.PreCodegen.after.panic-unwind.mir
@@ -1,21 +1,18 @@
// MIR for `outer` after PreCodegen
fn outer(_1: u8) -> u8 {
- debug v => _1; // in scope 0 at $DIR/spans.rs:9:14: 9:15
- let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:9:24: 9:26
- let mut _2: &u8; // in scope 0 at $DIR/spans.rs:10:11: 10:13
-
- bb0: {
- StorageLive(_2); // scope 0 at $DIR/spans.rs:10:11: 10:13
- _2 = &_1; // scope 0 at $DIR/spans.rs:10:11: 10:13
- _0 = inner(move _2) -> [return: bb1, unwind continue]; // scope 0 at $DIR/spans.rs:10:5: 10:14
- // mir::ConstOperand
- // + span: $DIR/spans.rs:10:5: 10:10
- // + const_: Const { ty: for<'a> fn(&'a u8) -> u8 {inner}, val: Value(inner) }
+ debug v => _1; // in scope 0 at $DIR/spans.rs:10:14: 10:15
+ let mut _0: u8; // return place in scope 0 at $DIR/spans.rs:10:24: 10:26
+ let mut _2: &u8; // in scope 0 at $DIR/spans.rs:11:11: 11:13
+ scope 1 (inlined inner) { // at $DIR/spans.rs:11:5: 11:14
+ debug x => _2; // in scope 1 at $DIR/spans.rs:14:14: 14:15
}
- bb1: {
- StorageDead(_2); // scope 0 at $DIR/spans.rs:10:13: 10:14
- return; // scope 0 at $DIR/spans.rs:11:2: 11:2
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _2 = &_1; // scope 0 at $DIR/spans.rs:11:11: 11:13
+ _0 = _1; // scope 1 at $DIR/spans.rs:15:5: 15:7
+ StorageDead(_2); // scope 0 at $DIR/spans.rs:11:13: 11:14
+ return; // scope 0 at $DIR/spans.rs:12:2: 12:2
}
}
diff --git a/tests/mir-opt/pre-codegen/spans.rs b/tests/mir-opt/pre-codegen/spans.rs
index 295eb0476..aa36648ce 100644
--- a/tests/mir-opt/pre-codegen/spans.rs
+++ b/tests/mir-opt/pre-codegen/spans.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// Test that the comments we emit in MIR opts are accurate.
//
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
diff --git a/tests/mir-opt/pre-codegen/try_identity.rs b/tests/mir-opt/pre-codegen/try_identity.rs
index a227c82d6..b6e4eaad7 100644
--- a/tests/mir-opt/pre-codegen/try_identity.rs
+++ b/tests/mir-opt/pre-codegen/try_identity.rs
@@ -1,3 +1,4 @@
+// skip-filecheck
// compile-flags: -O -C debuginfo=0 -Zmir-opt-level=2
// only-64bit