From ae6f97c43d0462272d7701a6ccfcf89b6ceafc1f Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 7 May 2023 17:08:22 +0000 Subject: [PATCH 01/10] Make slice_filter a pre-codegen test. --- tests/mir-opt/pre-codegen/slice_filter.rs | 15 + ...variant_a-{closure#0}.PreCodegen.after.mir | 231 +++++++++++++++ ...variant_b-{closure#0}.PreCodegen.after.mir | 95 ++++++ tests/mir-opt/slice_filter.rs | 20 -- ...filter.variant_a-{closure#0}.CopyProp.diff | 279 ------------------ ..._a-{closure#0}.DestinationPropagation.diff | 165 ----------- ...nt_a-{closure#0}.ReferencePropagation.diff | 267 ----------------- ...filter.variant_b-{closure#0}.CopyProp.diff | 139 --------- ..._b-{closure#0}.DestinationPropagation.diff | 109 ------- ...nt_b-{closure#0}.ReferencePropagation.diff | 103 ------- 10 files changed, 341 insertions(+), 1082 deletions(-) create mode 100644 tests/mir-opt/pre-codegen/slice_filter.rs create mode 100644 tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir delete mode 100644 tests/mir-opt/slice_filter.rs delete mode 100644 tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff delete mode 100644 tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff delete mode 100644 tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff delete mode 100644 tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff delete mode 100644 tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff delete mode 100644 tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff diff --git a/tests/mir-opt/pre-codegen/slice_filter.rs b/tests/mir-opt/pre-codegen/slice_filter.rs new file mode 100644 index 0000000000000..aba951acdd08d --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_filter.rs @@ -0,0 +1,15 @@ +// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 +// ignore-debug: standard library debug assertions add a panic that breaks this optimization + +#![crate_type = "lib"] + +pub fn variant_a(input: &[(usize, usize, usize, usize)]) -> usize { + input.iter().filter(|(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count() +} + +pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize { + input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count() +} + +// EMIT_MIR slice_filter.variant_a-{closure#0}.PreCodegen.after.mir +// EMIT_MIR slice_filter.variant_b-{closure#0}.PreCodegen.after.mir 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 new file mode 100644 index 0000000000000..492cb022bed49 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_a-{closure#0}.PreCodegen.after.mir @@ -0,0 +1,231 @@ +// 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 { + let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40 + let mut _3: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let _4: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + let mut _5: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let _6: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + let mut _7: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let _8: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + let mut _9: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let _10: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + let mut _11: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41 + let _12: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 + let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 + let mut _18: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46 + let mut _19: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56 + let mut _20: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51 + let _21: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 + let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 + let mut _27: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56 + let mut _28: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61 + let _29: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 + let mut _30: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 + let mut _35: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66 + let mut _36: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76 + let mut _37: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71 + let _38: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + let mut _39: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + let mut _44: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76 + scope 1 { + debug a => _4; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 + debug b => _6; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 + debug c => _8; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 + debug d => _10; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 + scope 2 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:7:40: 7:46 + debug self => _11; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _13; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _14: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _15: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 3 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => _14; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _15; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _16: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _17: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + scope 4 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:7:60: 7:66 + debug self => _28; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _30; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _31: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _32: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 5 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => _31; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _32; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _33: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _34: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + scope 6 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:7:50: 7:56 + debug self => _20; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _22; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _23: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _24: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 7 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => _23; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _24; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _25: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _26: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + scope 8 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:7:70: 7:76 + debug self => _37; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _39; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _40: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _41: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 9 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => _40; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _41; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _42: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _43: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + _3 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + _4 = &((*_3).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + _5 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + _6 = &((*_5).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + StorageLive(_8); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + _7 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + _8 = &((*_7).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + StorageLive(_10); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + _9 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + _10 = &((*_9).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46 + StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 + _11 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 + StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + _12 = _8; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + _13 = &_12; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + _14 = deref_copy (*_11); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + _15 = deref_copy (*_13); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_16); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + _16 = (*_14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_17); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + _17 = (*_15); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + _18 = Le(move _16, move _17); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_17); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_16); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + switchInt(move _18) -> [0: bb1, otherwise: bb2]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + } + + bb1: { + _19 = const false; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + } + + bb2: { + StorageLive(_27); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 + StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 + _20 = &_10; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 + StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _21 = _6; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _22 = &_21; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _23 = deref_copy (*_20); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + _24 = deref_copy (*_22); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_25); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _25 = (*_23); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_26); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _26 = (*_24); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _27 = Le(move _25, move _26); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_26); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_25); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _19 = move _27; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + } + + bb3: { + StorageDead(_27); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + switchInt(move _19) -> [0: bb4, otherwise: bb8]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + } + + bb4: { + StorageLive(_36); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + StorageLive(_35); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66 + StorageLive(_28); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 + _28 = &_8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 + StorageLive(_30); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + StorageLive(_29); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + _29 = _4; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + _30 = &_29; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + _31 = deref_copy (*_28); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + _32 = deref_copy (*_30); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_33); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _33 = (*_31); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_34); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _34 = (*_32); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _35 = Le(move _33, move _34); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_34); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_33); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_29); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + StorageDead(_30); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + StorageDead(_28); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + switchInt(move _35) -> [0: bb5, otherwise: bb6]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + } + + bb5: { + _36 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + goto -> bb7; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + } + + bb6: { + StorageLive(_44); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 + StorageLive(_37); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 + _37 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 + StorageLive(_39); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageLive(_38); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _38 = _10; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _39 = &_38; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _40 = deref_copy (*_37); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + _41 = deref_copy (*_39); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_42); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _42 = (*_40); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_43); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _43 = (*_41); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _44 = Le(move _42, move _43); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_43); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_42); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_38); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_39); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_37); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _36 = move _44; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + goto -> bb7; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + } + + bb7: { + StorageDead(_44); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_35); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _0 = move _36; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + goto -> bb9; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + } + + bb8: { + _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + goto -> bb9; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + } + + bb9: { + StorageDead(_36); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_10); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_8); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 + } +} 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 new file mode 100644 index 0000000000000..8ab69bc7b2732 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_filter.variant_b-{closure#0}.PreCodegen.after.mir @@ -0,0 +1,95 @@ +// 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 { + let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42 + let mut _3: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + let _4: usize; // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 + let mut _5: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + let _6: usize; // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 + let mut _7: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + let _8: usize; // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 + let mut _9: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + let _10: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 + let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48 + let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58 + let mut _13: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58 + let mut _14: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68 + let mut _15: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78 + let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78 + scope 1 { + debug a => _4; // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30 + debug b => _6; // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33 + debug c => _8; // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36 + debug d => _10; // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39 + } + + bb0: { + _3 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 + _4 = ((*_3).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 + _5 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 + _6 = ((*_5).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 + _7 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 + _8 = ((*_7).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 + _9 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 + _10 = ((*_9).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 + StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 + _11 = Le(_4, _8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 + switchInt(move _11) -> [0: bb1, otherwise: bb2]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + } + + bb1: { + _12 = const false; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + } + + bb2: { + StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 + _13 = Le(_10, _6); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 + _12 = move _13; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + } + + bb3: { + StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + switchInt(move _12) -> [0: bb4, otherwise: bb8]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + } + + bb4: { + StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 + _14 = Le(_8, _4); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 + switchInt(move _14) -> [0: bb5, otherwise: bb6]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + } + + bb5: { + _15 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + goto -> bb7; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + } + + bb6: { + StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 + _16 = Le(_6, _10); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 + _15 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + goto -> bb7; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + } + + bb7: { + StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + _0 = move _15; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + goto -> bb9; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + } + + bb8: { + _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + goto -> bb9; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + } + + bb9: { + StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78 + } +} diff --git a/tests/mir-opt/slice_filter.rs b/tests/mir-opt/slice_filter.rs deleted file mode 100644 index be32f40f13227..0000000000000 --- a/tests/mir-opt/slice_filter.rs +++ /dev/null @@ -1,20 +0,0 @@ -fn main() { - let input = vec![]; - let _variant_a_result = variant_a(&input); - let _variant_b_result = variant_b(&input); -} - -pub fn variant_a(input: &[(usize, usize, usize, usize)]) -> usize { - input.iter().filter(|(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count() -} - -pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize { - input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count() -} - -// EMIT_MIR slice_filter.variant_a-{closure#0}.ReferencePropagation.diff -// EMIT_MIR slice_filter.variant_a-{closure#0}.CopyProp.diff -// EMIT_MIR slice_filter.variant_a-{closure#0}.DestinationPropagation.diff -// EMIT_MIR slice_filter.variant_b-{closure#0}.CopyProp.diff -// EMIT_MIR slice_filter.variant_b-{closure#0}.ReferencePropagation.diff -// EMIT_MIR slice_filter.variant_b-{closure#0}.DestinationPropagation.diff diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff deleted file mode 100644 index 60e5056c7a926..0000000000000 --- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff +++ /dev/null @@ -1,279 +0,0 @@ -- // MIR for `variant_a::{closure#0}` before CopyProp -+ // MIR for `variant_a::{closure#0}` after CopyProp - - 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; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40 - let _3: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - let _4: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - let _5: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - let _6: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56 - let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46 - let mut _9: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41 - let mut _10: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 - let _11: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 - let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56 - let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51 - let mut _14: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 - let _15: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 - let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76 - let mut _17: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66 - let mut _18: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61 - let mut _19: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 - let _20: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 - let mut _21: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76 - let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71 - let mut _23: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - let _24: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - let mut _25: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _26: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _31: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _32: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _37: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _38: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _43: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _44: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _49: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _50: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 1 { - debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 - debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 - debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 - debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 - scope 2 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:40: 8:46 - debug self => _9; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _10; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _29: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _30: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 3 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug self => _31; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _32; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => _29; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => _30; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _33: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _34: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - scope 4 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:60: 8:66 - debug self => _18; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _19; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _35: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _36: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 5 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug self => _37; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _38; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => _35; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => _36; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _39: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _40: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - scope 6 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:50: 8:56 - debug self => _13; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _14; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _41: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _42: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 7 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug self => _43; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _44; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => _41; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => _42; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _45: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _46: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - scope 8 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:70: 8:76 - debug self => _22; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _23; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _47: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _48: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 9 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug self => _49; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _50; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => _47; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => _48; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _51: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _52: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46 - StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 - _9 = &_3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 - StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - _10 = &_11; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - _29 = deref_copy (*_9); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - _30 = deref_copy (*_10); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageLive(_31); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _31 = _29; // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageLive(_32); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _32 = _30; // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _33 = (*_31); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _33 = (*_29); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _34 = (*_32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _34 = (*_30); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - _8 = Le(move _33, move _34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_32); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_31); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - } - - bb1: { - _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - } - - bb2: { - StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66 - StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 - _18 = &_5; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 - StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - _19 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - _35 = deref_copy (*_18); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - _36 = deref_copy (*_19); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageLive(_37); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _37 = _35; // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageLive(_38); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _38 = _36; // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _39 = (*_37); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _39 = (*_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _40 = (*_38); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _40 = (*_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - _17 = Le(move _39, move _40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_38); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_37); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - } - - bb3: { - StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 - } - - bb4: { - _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - } - - bb5: { - StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 - StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 - _13 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 - StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _14 = &_15; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _41 = deref_copy (*_13); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - _42 = deref_copy (*_14); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageLive(_43); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _43 = _41; // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageLive(_44); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _44 = _42; // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _45 = (*_43); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _45 = (*_41); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _46 = (*_44); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _46 = (*_42); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - _12 = Le(move _45, move _46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_44); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_43); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _7 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - } - - bb6: { - _16 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - } - - bb7: { - StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 - StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 - _22 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 - StorageLive(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _23 = &_24; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _47 = deref_copy (*_22); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - _48 = deref_copy (*_23); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageLive(_49); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _49 = _47; // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageLive(_50); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _50 = _48; // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _51 = (*_49); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _51 = (*_47); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _52 = (*_50); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _52 = (*_48); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - _21 = Le(move _51, move _52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_50); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_49); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _16 = move _21; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - } - - bb8: { - StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _0 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - } - } - diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff deleted file mode 100644 index afdcf57815f38..0000000000000 --- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff +++ /dev/null @@ -1,165 +0,0 @@ -- // MIR for `variant_a::{closure#0}` before DestinationPropagation -+ // MIR for `variant_a::{closure#0}` after DestinationPropagation - - 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; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40 - let mut _3: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56 - let mut _4: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46 - let mut _5: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56 - let mut _6: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76 - let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66 - let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76 - let mut _9: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _10: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _11: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _12: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - scope 1 { - debug a => &((*_9).0: usize); // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 - debug b => &((*_10).1: usize); // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 - debug c => &((*_11).2: usize); // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 - debug d => &((*_12).3: usize); // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 - scope 2 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:40: 8:46 - debug self => &&((*_9).0: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => &&((*_11).2: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 3 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL - debug self => &((*_9).0: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => &((*_11).2: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _13: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _14: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - scope 4 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:60: 8:66 - debug self => &&((*_11).2: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => &&((*_9).0: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 5 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL - debug self => &((*_11).2: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => &((*_9).0: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _15: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _16: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - scope 6 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:50: 8:56 - debug self => &&((*_12).3: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => &&((*_10).1: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 7 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL - debug self => &((*_12).3: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => &((*_10).1: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _17: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _18: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - scope 8 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:70: 8:76 - debug self => &&((*_10).1: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => &&((*_12).3: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 9 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL - debug self => &((*_10).1: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => &((*_12).3: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _19: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _20: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - } - - bb0: { - _9 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - _10 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - _11 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - _12 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 -- StorageLive(_3); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - StorageLive(_4); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46 - StorageLive(_13); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - _13 = ((*_9).0: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - _14 = ((*_11).2: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - _4 = Le(move _13, move _14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_14); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_13); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - switchInt(move _4) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - } - - bb1: { - _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - } - - bb2: { -- StorageLive(_6); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66 - StorageLive(_15); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - _15 = ((*_11).2: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - _16 = ((*_9).0: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - _7 = Le(move _15, move _16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_16); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_15); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - switchInt(move _7) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - } - - bb3: { -- StorageDead(_6); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_3); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 - } - - bb4: { -- StorageDead(_5); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_4); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - } - - bb5: { -- StorageLive(_5); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 - StorageLive(_17); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - _17 = ((*_12).3: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - _18 = ((*_10).1: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - _5 = Le(move _17, move _18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_18); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_17); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _3 = move _5; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 -- StorageDead(_5); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_4); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -- switchInt(move _3) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 -+ switchInt(move _5) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - } - - bb6: { -- _6 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 -+ _0 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - } - - bb7: { -- StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 - StorageLive(_19); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - _19 = ((*_10).1: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - _20 = ((*_12).3: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _8 = Le(move _19, move _20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _0 = Le(move _19, move _20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_20); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_19); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _6 = move _8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - } - - bb8: { -- StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- _0 = move _6; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - } - } - diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff deleted file mode 100644 index 2534eeef43297..0000000000000 --- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff +++ /dev/null @@ -1,267 +0,0 @@ -- // MIR for `variant_a::{closure#0}` before ReferencePropagation -+ // MIR for `variant_a::{closure#0}` after ReferencePropagation - - 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; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40 - let _3: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - let _4: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - let _5: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - let _6: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56 - let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46 - let mut _9: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41 - let mut _10: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 - let _11: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 - let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56 - let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51 - let mut _14: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 - let _15: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 - let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76 - let mut _17: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66 - let mut _18: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61 - let mut _19: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 - let _20: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 - let mut _21: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76 - let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71 - let mut _23: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - let _24: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - let mut _25: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _26: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 - let mut _31: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _32: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _37: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _38: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _43: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _44: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _49: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _50: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 1 { -- debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 -- debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 -- debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 -- debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 -+ debug a => &((*_25).0: usize); // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 -+ debug b => &((*_26).1: usize); // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 -+ debug c => &((*_27).2: usize); // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 -+ debug d => &((*_28).3: usize); // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 - scope 2 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:40: 8:46 -- debug self => _9; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _10; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => &&((*_25).0: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => &&((*_27).2: usize); // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _29: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _30: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 3 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug self => _29; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _30; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => &((*_25).0: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => &((*_27).2: usize); // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _33: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _34: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - scope 4 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:60: 8:66 -- debug self => _18; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _19; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => &&((*_27).2: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => &&((*_25).0: usize); // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _35: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _36: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 5 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug self => _35; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _36; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => &((*_27).2: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => &((*_25).0: usize); // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _39: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _40: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - scope 6 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:50: 8:56 -- debug self => _13; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _14; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => &&((*_28).3: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => &&((*_26).1: usize); // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _41: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _42: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 7 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug self => _41; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _42; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => &((*_28).3: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => &((*_26).1: usize); // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _45: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _46: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - scope 8 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:70: 8:76 -- debug self => _22; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _23; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => &&((*_26).1: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => &&((*_28).3: usize); // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _47: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _48: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - scope 9 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug self => _47; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- debug other => _48; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug self => &((*_26).1: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ debug other => &((*_28).3: usize); // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _51: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _52: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - } - } - } - - bb0: { -- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 -- _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 -- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 -- _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 -- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 -- _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 -- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 -- _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46 -- StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 -- _9 = &_3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 -- StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 -- StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 -- _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 -- _10 = &_11; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 -- _29 = deref_copy (*_9); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _30 = deref_copy (*_10); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _33 = (*_29); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _33 = ((*_25).0: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _34 = (*_30); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _34 = ((*_27).2: usize); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - _8 = Le(move _33, move _34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 -- StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 -- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - } - - bb1: { - _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - } - - bb2: { - StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66 -- StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 -- _18 = &_5; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 -- StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 -- StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 -- _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 -- _19 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 -- _35 = deref_copy (*_18); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _36 = deref_copy (*_19); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _39 = (*_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _39 = ((*_27).2: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _40 = (*_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _40 = ((*_25).0: usize); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - _17 = Le(move _39, move _40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 -- StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 -- StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - } - - bb3: { - StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 - return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 - } - - bb4: { - _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - } - - bb5: { - StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 -- StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 -- _13 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 -- StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -- StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -- _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -- _14 = &_15; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -- _41 = deref_copy (*_13); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _42 = deref_copy (*_14); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _45 = (*_41); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _45 = ((*_28).3: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _46 = (*_42); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _46 = ((*_26).1: usize); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - _12 = Le(move _45, move _46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -- StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 -- StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _7 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - } - - bb6: { - _16 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - } - - bb7: { - StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 -- StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 -- _22 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 -- StorageLive(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- _23 = &_24; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- _47 = deref_copy (*_22); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _48 = deref_copy (*_23); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _51 = (*_47); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _51 = ((*_26).1: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- _52 = (*_48); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -+ _52 = ((*_28).3: usize); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - _21 = Le(move _51, move _52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL -- StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _16 = move _21; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - } - - bb8: { - StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _0 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - } - } - diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff deleted file mode 100644 index 5e4bdbdfa2e2f..0000000000000 --- a/tests/mir-opt/slice_filter.variant_b-{closure#0}.CopyProp.diff +++ /dev/null @@ -1,139 +0,0 @@ -- // MIR for `variant_b::{closure#0}` before CopyProp -+ // MIR for `variant_b::{closure#0}` after CopyProp - - 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; // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42 - let _3: usize; // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 - let _4: usize; // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 - let _5: usize; // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 - let _6: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 - let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58 - let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48 - let mut _9: usize; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:43 - let mut _10: usize; // in scope 0 at $DIR/slice_filter.rs:+0:47: +0:48 - let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58 - let mut _12: usize; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:53 - let mut _13: usize; // in scope 0 at $DIR/slice_filter.rs:+0:57: +0:58 - let mut _14: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78 - let mut _15: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68 - let mut _16: usize; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:63 - let mut _17: usize; // in scope 0 at $DIR/slice_filter.rs:+0:67: +0:68 - let mut _18: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78 - let mut _19: usize; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:73 - let mut _20: usize; // in scope 0 at $DIR/slice_filter.rs:+0:77: +0:78 - let mut _21: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - let mut _22: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - let mut _23: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - let mut _24: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - scope 1 { - debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30 - debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33 - debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36 - debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39 - } - - bb0: { -- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 - _21 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 - _3 = ((*_21).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 -- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 - _22 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 - _4 = ((*_22).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 -- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 - _23 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 - _5 = ((*_23).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 -- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 - _24 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 - _6 = ((*_24).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 - StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 -- StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:43 -- _9 = _3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:43 -- StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48 -- _10 = _5; // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48 -- _8 = Le(move _9, move _10); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 -- StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48 -- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:47: +0:48 -+ _8 = Le(_3, _5); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 - switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - } - - bb1: { - _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - } - - bb2: { - StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 -- StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:63 -- _16 = _5; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:63 -- StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68 -- _17 = _3; // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68 -- _15 = Le(move _16, move _17); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 -- StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68 -- StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:67: +0:68 -+ _15 = Le(_5, _3); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 - switchInt(move _15) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - } - - bb3: { - StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 - StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 -- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78 -- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78 -- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78 -- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:77: +0:78 - return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78 - } - - bb4: { - _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - } - - bb5: { - StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 -- StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:53 -- _12 = _6; // scope 1 at $DIR/slice_filter.rs:+0:52: +0:53 -- StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 -- _13 = _4; // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 -- _11 = Le(move _12, move _13); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 -- StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 -- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 -+ _11 = Le(_6, _4); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 - _7 = move _11; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - } - - bb6: { - _14 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - } - - bb7: { - StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 -- StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:73 -- _19 = _4; // scope 1 at $DIR/slice_filter.rs:+0:72: +0:73 -- StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 -- _20 = _6; // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 -- _18 = Le(move _19, move _20); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 -- StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 -- StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 -+ _18 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 - _14 = move _18; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - } - - bb8: { - StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 - StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 - _0 = move _14; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - } - } - diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff deleted file mode 100644 index 45af6600cd4e8..0000000000000 --- a/tests/mir-opt/slice_filter.variant_b-{closure#0}.DestinationPropagation.diff +++ /dev/null @@ -1,109 +0,0 @@ -- // MIR for `variant_b::{closure#0}` before DestinationPropagation -+ // MIR for `variant_b::{closure#0}` after DestinationPropagation - - 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; // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42 - let _3: usize; // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 - let _4: usize; // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 - let _5: usize; // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 - let _6: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 - let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58 - let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48 - let mut _9: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58 - let mut _10: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78 - let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68 - let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78 - let mut _13: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - let mut _14: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - let mut _15: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - let mut _16: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - scope 1 { - debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30 - debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33 - debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36 - debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39 - } - - bb0: { - _13 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 - _3 = ((*_13).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 - _14 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 - _4 = ((*_14).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 - _15 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 - _5 = ((*_15).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 - _16 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 - _6 = ((*_16).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 -- StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 - _8 = Le(_3, _5); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 - switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - } - - bb1: { - _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - } - - bb2: { -- StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 - _11 = Le(_5, _3); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 - switchInt(move _11) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - } - - bb3: { -- StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 -- StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 - return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78 - } - - bb4: { -- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - } - - bb5: { -- StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 - _9 = Le(_6, _4); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 -- _7 = move _9; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 -- StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 -- switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 -+ switchInt(move _9) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - } - - bb6: { -- _10 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 -+ _0 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - } - - bb7: { -- StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 -- _12 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 -- _10 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 -+ _0 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - } - - bb8: { -- StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 - StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 -- _0 = move _10; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 -+ nop; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - } - } - diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff deleted file mode 100644 index d1241c6b0245c..0000000000000 --- a/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff +++ /dev/null @@ -1,103 +0,0 @@ -- // MIR for `variant_b::{closure#0}` before ReferencePropagation -+ // MIR for `variant_b::{closure#0}` after ReferencePropagation - - 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; // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42 - let _3: usize; // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 - let _4: usize; // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 - let _5: usize; // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 - let _6: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 - let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58 - let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48 - let mut _9: usize; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:43 - let mut _10: usize; // in scope 0 at $DIR/slice_filter.rs:+0:47: +0:48 - let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58 - let mut _12: usize; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:53 - let mut _13: usize; // in scope 0 at $DIR/slice_filter.rs:+0:57: +0:58 - let mut _14: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78 - let mut _15: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68 - let mut _16: usize; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:63 - let mut _17: usize; // in scope 0 at $DIR/slice_filter.rs:+0:67: +0:68 - let mut _18: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78 - let mut _19: usize; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:73 - let mut _20: usize; // in scope 0 at $DIR/slice_filter.rs:+0:77: +0:78 - let mut _21: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - let mut _22: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - let mut _23: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - let mut _24: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 - scope 1 { - debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30 - debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33 - debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36 - debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39 - } - - bb0: { - _21 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 - _3 = ((*_21).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 - _22 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 - _4 = ((*_22).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 - _23 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 - _5 = ((*_23).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 - _24 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 - _6 = ((*_24).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 - StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 - _8 = Le(_3, _5); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 - switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - } - - bb1: { - _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - } - - bb2: { - StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 - _15 = Le(_5, _3); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 - switchInt(move _15) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - } - - bb3: { - StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 - StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 - return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78 - } - - bb4: { - _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - } - - bb5: { - StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 - _11 = Le(_6, _4); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 - _7 = move _11; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - } - - bb6: { - _14 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - } - - bb7: { - StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 - _18 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 - _14 = move _18; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - } - - bb8: { - StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 - StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 - _0 = move _14; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - } - } - From 2c6f137d9a2ee2d53149876317ea9775ee23dd30 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 5 Feb 2023 19:10:33 +0000 Subject: [PATCH 02/10] Add loop tests. --- .../loops.int_range.PreCodegen.after.mir | 70 ++ tests/mir-opt/pre-codegen/loops.rs | 54 ++ .../loops.vec_iter.PreCodegen.after.mir | 570 +++++++++++++++++ ...ps.vec_iter_enumerate.PreCodegen.after.mir | 604 ++++++++++++++++++ .../loops.vec_move.PreCodegen.after.mir | 83 +++ .../loops.vec_range.PreCodegen.after.mir | 204 ++++++ 6 files changed, 1585 insertions(+) create mode 100644 tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/loops.rs create mode 100644 tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir 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 new file mode 100644 index 0000000000000..78e5502f39d64 --- /dev/null +++ b/tests/mir-opt/pre-codegen/loops.int_range.PreCodegen.after.mir @@ -0,0 +1,70 @@ +// MIR for `int_range` after PreCodegen + +fn int_range(_1: usize, _2: usize) -> () { + debug start => _1; // in scope 0 at $DIR/loops.rs:+0:18: +0:23 + debug end => _2; // in scope 0 at $DIR/loops.rs:+0:32: +0:35 + let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:44: +0:44 + let mut _3: std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + let mut _4: std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + let mut _5: &mut std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + let mut _6: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + let mut _7: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 + let _9: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + scope 1 { + debug iter => _4; // in scope 1 at $DIR/loops.rs:+1:14: +1:24 + let _8: usize; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 + scope 2 { + debug i => _8; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 + } + scope 4 (inlined iter::range::>::next) { // at $DIR/loops.rs:7:14: 7:24 + debug self => _5; // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + } + scope 3 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:7:14: 7:24 + debug self => _3; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + _3 = std::ops::Range:: { start: _1, end: _2 }; // scope 0 at $DIR/loops.rs:+1:14: +1:24 + StorageLive(_4); // scope 0 at $DIR/loops.rs:+1:14: +1:24 + _4 = move _3; // scope 0 at $DIR/loops.rs:+1:14: +1:24 + goto -> bb1; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb1: { + StorageLive(_6); // scope 1 at $DIR/loops.rs:+1:14: +1:24 + _5 = &mut _4; // scope 1 at $DIR/loops.rs:+1:14: +1:24 + _6 = as iter::range::RangeIteratorImpl>::spec_next(_5) -> bb2; // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } + } + + bb2: { + _7 = discriminant(_6); // scope 1 at $DIR/loops.rs:+1:14: +1:24 + switchInt(move _7) -> [0: bb3, 1: bb4, otherwise: bb6]; // scope 1 at $DIR/loops.rs:+1:14: +1:24 + } + + bb3: { + StorageDead(_6); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + StorageDead(_4); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + return; // scope 0 at $DIR/loops.rs:+4:2: +4:2 + } + + bb4: { + _8 = ((_6 as Some).0: usize); // scope 1 at $DIR/loops.rs:+1:9: +1:10 + _9 = opaque::(_8) -> bb5; // scope 2 at $DIR/loops.rs:+2:9: +2:18 + // mir::Constant + // + span: $DIR/loops.rs:8:9: 8:15 + // + literal: Const { ty: fn(usize) {opaque::}, val: Value() } + } + + bb5: { + StorageDead(_6); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + goto -> bb1; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb6: { + unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:24 + } +} diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs new file mode 100644 index 0000000000000..a09fcd9c990ed --- /dev/null +++ b/tests/mir-opt/pre-codegen/loops.rs @@ -0,0 +1,54 @@ +// compile-flags: -O -Zmir-opt-level=2 -g +// ignore-debug + +#![crate_type = "lib"] + +pub fn int_range(start: usize, end: usize) { + for i in start..end { + opaque(i) + } +} + +pub fn vec_range(mut v: Vec) { + for i in 0..v.len() { + let x = &mut v[i]; + opaque((i, x)) + } + for i in 0..v.len() { + let x = &v[i]; + opaque((i, x)) + } +} + +pub fn vec_iter(mut v: Vec) { + for x in v.iter_mut() { + opaque(x) + } + for x in v.iter() { + opaque(x) + } +} + +pub fn vec_iter_enumerate(mut v: Vec) { + for (i, x) in v.iter_mut().enumerate() { + opaque((i, x)) + } + for (i, x) in v.iter().enumerate() { + opaque((i, x)) + } +} + +pub fn vec_move(mut v: Vec) { + for x in v { + opaque(x) + } +} + +#[inline(never)] +fn opaque(_: impl Sized) {} + +// EMIT_MIR loops.int_range.PreCodegen.after.mir +// EMIT_MIR loops.vec_range.PreCodegen.after.mir +// EMIT_MIR loops.vec_iter.PreCodegen.after.mir +// EMIT_MIR loops.vec_iter_enumerate.PreCodegen.after.mir +// EMIT_MIR loops.vec_move.PreCodegen.after.mir diff --git a/tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir new file mode 100644 index 0000000000000..5fdd0363f3c9b --- /dev/null +++ b/tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir @@ -0,0 +1,570 @@ +// MIR for `vec_iter` after PreCodegen + +fn vec_iter(_1: Vec) -> () { + debug v => _1; // in scope 0 at $DIR/loops.rs:+0:17: +0:22 + let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:41: +0:41 + let mut _2: &mut std::vec::Vec; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 + let mut _14: &mut [impl Sized]; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 + let mut _26: std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 + let mut _27: std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 + let mut _28: &mut std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 + let mut _29: std::option::Option<&mut impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 + let mut _30: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 + let mut _31: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 + let _43: &[impl Sized]; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 + let mut _54: std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 + let mut _55: std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 + let mut _56: &mut std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 + let mut _57: std::option::Option<&impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 + let mut _58: isize; // in scope 0 at $DIR/loops.rs:+4:5: +6:6 + let _60: (); // in scope 0 at $DIR/loops.rs:+4:14: +4:22 + let _62: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:26 + scope 1 { + debug iter => _27; // in scope 1 at $DIR/loops.rs:+1:14: +1:26 + let _61: &mut impl Sized; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 + scope 2 { + debug x => _61; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 + } + } + scope 3 { + debug iter => _55; // in scope 3 at $DIR/loops.rs:+4:14: +4:22 + let _59: &impl Sized; // in scope 3 at $DIR/loops.rs:+4:9: +4:10 + scope 4 { + debug x => _59; // in scope 4 at $DIR/loops.rs:+4:9: +4:10 + } + } + scope 5 (inlined as DerefMut>::deref_mut) { // at $DIR/loops.rs:24:14: 24:26 + debug self => _2; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _7: *mut impl Sized; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _8: usize; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + scope 6 { + scope 7 (inlined Vec::::as_mut_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug self => _2; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _3: &alloc::raw_vec::RawVec; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + scope 8 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug self => _3; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + let mut _4: std::ptr::Unique; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + scope 9 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + debug self => _4; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + let mut _5: std::ptr::NonNull; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + scope 10 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + debug self => _5; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _6: *const impl Sized; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + } + } + } + } + scope 11 (inlined std::slice::from_raw_parts_mut::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug data => _7; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug len => _8; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + let mut _13: *mut [impl Sized]; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + let mut _63: *mut impl Sized; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _64: usize; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 12 { + scope 13 (inlined std::slice::from_raw_parts_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug data => _63; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug len => _64; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 14 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug len => _64; // in scope 14 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 15 { + debug max_len => const _; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + scope 16 (inlined slice_from_raw_parts_mut::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug data => _7; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug len => _8; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + let mut _9: *mut (); // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 17 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug self => _7; // in scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + scope 18 (inlined std::ptr::from_raw_parts_mut::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug data_address => _9; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug metadata => _8; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _10: *const (); // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _11: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _12: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + scope 19 { + } + } + } + } + } + } + } + scope 20 (inlined core::slice::::iter_mut) { // at $DIR/loops.rs:24:16: 24:26 + debug self => _14; // in scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 21 (inlined std::slice::IterMut::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _14; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _16: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _17: bool; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _18: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _19: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _21: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _22: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _24: std::ptr::NonNull; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _25: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 22 { + debug ptr => _16; // in scope 22 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 23 { + let _20: *mut impl Sized; // in scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 24 { + debug end => _20; // in scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 30 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _16; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _23: *const impl Sized; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _65: *mut impl Sized; // in scope 30 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 31 { + scope 32 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _65; // in scope 32 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 33 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _65; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _66: *mut u8; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 34 { + scope 35 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _66; // in scope 35 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 36 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _66; // in scope 36 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 37 { + scope 38 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _66; // in scope 38 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 26 (inlined invalid_mut::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _22; // in scope 26 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 27 { + } + } + scope 28 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _16; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug count => _19; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 29 { + } + } + } + } + scope 25 (inlined core::slice::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _14; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _15: *mut [impl Sized]; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 39 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:24:14: 24:26 + debug self => _26; // in scope 39 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + scope 40 (inlined as Deref>::deref) { // at $DIR/loops.rs:27:14: 27:22 + debug self => _31; // in scope 40 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _37: *const impl Sized; // in scope 40 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _38: usize; // in scope 40 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + scope 41 { + scope 42 (inlined Vec::::as_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug self => _31; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _32: &alloc::raw_vec::RawVec; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _36: *mut impl Sized; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + scope 43 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug self => _32; // in scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + let mut _33: std::ptr::Unique; // in scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + scope 44 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + debug self => _33; // in scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + let mut _34: std::ptr::NonNull; // in scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + scope 45 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + debug self => _34; // in scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _35: *const impl Sized; // in scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + } + } + } + } + scope 46 (inlined std::slice::from_raw_parts::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug data => _37; // in scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug len => _38; // in scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + let _42: *const [impl Sized]; // in scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + let mut _67: *const impl Sized; // in scope 46 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _68: usize; // in scope 46 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 47 { + scope 48 (inlined std::slice::from_raw_parts::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug data => _67; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug len => _68; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 49 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug len => _68; // in scope 49 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 50 { + debug max_len => const _; // in scope 50 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + scope 51 (inlined slice_from_raw_parts::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug data => _37; // in scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug len => _38; // in scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + let mut _39: *const (); // in scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 52 (inlined ptr::const_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug self => _37; // in scope 52 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + } + scope 53 (inlined std::ptr::from_raw_parts::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug data_address => _39; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug metadata => _38; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _40: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _41: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + scope 54 { + } + } + } + } + } + } + } + scope 55 (inlined core::slice::::iter) { // at $DIR/loops.rs:27:16: 27:22 + debug self => _43; // in scope 55 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 56 (inlined std::slice::Iter::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _43; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _45: *const impl Sized; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _46: bool; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _47: usize; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _49: usize; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _50: *mut impl Sized; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _52: std::ptr::NonNull; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _53: *const impl Sized; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 57 { + debug ptr => _45; // in scope 57 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 58 { + let _48: *const impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 59 { + debug end => _48; // in scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 65 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _50; // in scope 65 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _51: *const impl Sized; // in scope 65 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _69: *mut impl Sized; // in scope 65 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 66 { + scope 67 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _69; // in scope 67 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 68 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _69; // in scope 68 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _70: *mut u8; // in scope 68 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 69 { + scope 70 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _70; // in scope 70 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 71 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _70; // in scope 71 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 72 { + scope 73 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _70; // in scope 73 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 61 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _49; // in scope 61 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 62 { + } + } + scope 63 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _45; // in scope 63 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _47; // in scope 63 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + scope 64 { + } + } + } + } + scope 60 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _43; // in scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _44: *const [impl Sized]; // in scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 74 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:27:14: 27:22 + debug self => _54; // in scope 74 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:14: +1:26 + _2 = &mut _1; // scope 0 at $DIR/loops.rs:+1:14: +1:26 + StorageLive(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + _3 = &((*_2).0: alloc::raw_vec::RawVec); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + _4 = ((*_3).0: std::ptr::Unique); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + StorageLive(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + _5 = (_4.0: std::ptr::NonNull); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + StorageLive(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _6 = (_5.0: *const impl Sized); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _7 = move _6 as *mut impl Sized (PtrToPtr); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + StorageDead(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + StorageDead(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + _8 = ((*_2).1: usize); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_63); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_64); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageLive(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _9 = _7 as *mut () (PtrToPtr); // scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageLive(_12); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _10 = _9 as *const () (Pointer(MutToConstPointer)); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _11 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: move _10, metadata: _8 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _12 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _11 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _13 = (_12.1: *mut [impl Sized]); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_12); // scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _14 = &mut (*_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageDead(_13); // scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageDead(_64); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_63); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_2); // scope 0 at $DIR/loops.rs:+1:14: +1:15 + StorageLive(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _15 = &raw mut (*_14); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _16 = move _15 as *mut impl Sized (PtrToPtr); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _17 = const _; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _17) -> [0: bb1, otherwise: bb2]; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb1: { + StorageLive(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _18 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _19 = Len((*_18)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _20 = Offset(_16, _19); // scope 29 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageDead(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb2: { + StorageLive(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _21 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _22 = Len((*_21)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _20 = _22 as *mut impl Sized (Transmute); // scope 27 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb3: { + StorageDead(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_65); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_66); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _23 = _16 as *const impl Sized (Pointer(MutToConstPointer)); // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _24 = NonNull:: { pointer: _23 }; // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_66); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_65); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _25 = _20; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _26 = std::slice::IterMut::<'_, impl Sized> { ptr: move _24, end: move _25, _marker: const ZeroSized: PhantomData<&mut impl Sized> }; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&mut impl Sized>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_27); // scope 0 at $DIR/loops.rs:+1:14: +1:26 + _27 = move _26; // scope 0 at $DIR/loops.rs:+1:14: +1:26 + goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb4: { + StorageLive(_29); // scope 1 at $DIR/loops.rs:+1:14: +1:26 + _28 = &mut _27; // scope 1 at $DIR/loops.rs:+1:14: +1:26 + _29 = as Iterator>::next(_28) -> [return: bb5, unwind: bb19]; // scope 1 at $DIR/loops.rs:+1:14: +1:26 + // mir::Constant + // + span: $DIR/loops.rs:24:14: 24:26 + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::IterMut<'_, impl Sized>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } + } + + bb5: { + _30 = discriminant(_29); // scope 1 at $DIR/loops.rs:+1:14: +1:26 + switchInt(move _30) -> [0: bb6, 1: bb16, otherwise: bb18]; // scope 1 at $DIR/loops.rs:+1:14: +1:26 + } + + bb6: { + StorageDead(_29); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + StorageDead(_27); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + StorageLive(_31); // scope 0 at $DIR/loops.rs:+4:14: +4:22 + _31 = &_1; // scope 0 at $DIR/loops.rs:+4:14: +4:22 + StorageLive(_37); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_36); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_32); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + _32 = &((*_31).0: alloc::raw_vec::RawVec); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_33); // scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + _33 = ((*_32).0: std::ptr::Unique); // scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + StorageLive(_34); // scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + _34 = (_33.0: std::ptr::NonNull); // scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + StorageLive(_35); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _35 = (_34.0: *const impl Sized); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _36 = move _35 as *mut impl Sized (PtrToPtr); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_35); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_34); // scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + StorageDead(_33); // scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + _37 = move _36 as *const impl Sized (Pointer(MutToConstPointer)); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_32); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_36); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_38); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + _38 = ((*_31).1: usize); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_67); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_68); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_42); // scope 47 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageLive(_39); // scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _39 = _37 as *const () (PtrToPtr); // scope 52 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageLive(_41); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_40); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _40 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: _39, metadata: _38 }; // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _41 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _40 }; // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_40); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _42 = (_41.0: *const [impl Sized]); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_41); // scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_39); // scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _43 = &(*_42); // scope 47 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageDead(_42); // scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageDead(_68); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_67); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_38); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_37); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_31); // scope 0 at $DIR/loops.rs:+4:14: +4:15 + StorageLive(_45); // scope 55 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_44); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _44 = &raw const (*_43); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _45 = move _44 as *const impl Sized (PtrToPtr); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_44); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_48); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_46); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _46 = const _; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _46) -> [0: bb7, otherwise: bb8]; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb7: { + StorageLive(_47); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _47 = Len((*_43)); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _48 = Offset(_45, _47); // scope 64 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_47); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb9; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb8: { + StorageLive(_49); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _49 = Len((*_43)); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _48 = _49 as *const impl Sized (Transmute); // scope 62 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_49); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb9; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb9: { + StorageDead(_46); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_52); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_50); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _50 = _45 as *mut impl Sized (PtrToPtr); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_51); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_69); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_70); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _51 = _50 as *const impl Sized (Pointer(MutToConstPointer)); // scope 66 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _52 = NonNull:: { pointer: _51 }; // scope 66 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_70); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_69); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_51); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_50); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_53); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _53 = _48; // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _54 = std::slice::Iter::<'_, impl Sized> { ptr: move _52, end: move _53, _marker: const ZeroSized: PhantomData<&impl Sized> }; // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&impl Sized>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_53); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_52); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_48); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_45); // scope 55 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_55); // scope 0 at $DIR/loops.rs:+4:14: +4:22 + _55 = move _54; // scope 0 at $DIR/loops.rs:+4:14: +4:22 + goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 + } + + bb10: { + StorageLive(_57); // scope 3 at $DIR/loops.rs:+4:14: +4:22 + _56 = &mut _55; // scope 3 at $DIR/loops.rs:+4:14: +4:22 + _57 = as Iterator>::next(_56) -> [return: bb11, unwind: bb19]; // scope 3 at $DIR/loops.rs:+4:14: +4:22 + // mir::Constant + // + span: $DIR/loops.rs:27:14: 27:22 + // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, impl Sized>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } + } + + bb11: { + _58 = discriminant(_57); // scope 3 at $DIR/loops.rs:+4:14: +4:22 + switchInt(move _58) -> [0: bb12, 1: bb14, otherwise: bb18]; // scope 3 at $DIR/loops.rs:+4:14: +4:22 + } + + bb12: { + StorageDead(_57); // scope 3 at $DIR/loops.rs:+6:5: +6:6 + StorageDead(_55); // scope 0 at $DIR/loops.rs:+6:5: +6:6 + drop(_1) -> bb13; // scope 0 at $DIR/loops.rs:+7:1: +7:2 + } + + bb13: { + return; // scope 0 at $DIR/loops.rs:+7:2: +7:2 + } + + bb14: { + _59 = ((_57 as Some).0: &impl Sized); // scope 3 at $DIR/loops.rs:+4:9: +4:10 + _60 = opaque::<&impl Sized>(_59) -> [return: bb15, unwind: bb19]; // scope 4 at $DIR/loops.rs:+5:9: +5:18 + // mir::Constant + // + span: $DIR/loops.rs:28:9: 28:15 + // + literal: Const { ty: fn(&impl Sized) {opaque::<&impl Sized>}, val: Value() } + } + + bb15: { + StorageDead(_57); // scope 3 at $DIR/loops.rs:+6:5: +6:6 + goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 + } + + bb16: { + _61 = move ((_29 as Some).0: &mut impl Sized); // scope 1 at $DIR/loops.rs:+1:9: +1:10 + _62 = opaque::<&mut impl Sized>(move _61) -> [return: bb17, unwind: bb19]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 + // mir::Constant + // + span: $DIR/loops.rs:25:9: 25:15 + // + literal: Const { ty: fn(&mut impl Sized) {opaque::<&mut impl Sized>}, val: Value() } + } + + bb17: { + StorageDead(_29); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb18: { + unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:26 + } + + bb19 (cleanup): { + drop(_1) -> [return: bb20, unwind terminate]; // scope 0 at $DIR/loops.rs:+7:1: +7:2 + } + + bb20 (cleanup): { + resume; // scope 0 at $DIR/loops.rs:+0:1: +7:2 + } +} diff --git a/tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir new file mode 100644 index 0000000000000..7cc982bfea00a --- /dev/null +++ b/tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir @@ -0,0 +1,604 @@ +// MIR for `vec_iter_enumerate` after PreCodegen + +fn vec_iter_enumerate(_1: Vec) -> () { + debug v => _1; // in scope 0 at $DIR/loops.rs:+0:27: +0:32 + let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:51: +0:51 + let mut _2: &mut std::vec::Vec; // in scope 0 at $DIR/loops.rs:+1:19: +1:31 + let mut _14: &mut [impl Sized]; // in scope 0 at $DIR/loops.rs:+1:19: +1:31 + let mut _26: std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:19: +1:31 + let mut _27: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 + let mut _28: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 + let mut _29: &mut std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 + let mut _30: std::option::Option<(usize, &mut impl Sized)>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 + let mut _31: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 + let mut _32: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+4:19: +4:27 + let _44: &[impl Sized]; // in scope 0 at $DIR/loops.rs:+4:19: +4:27 + let mut _55: std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:19: +4:27 + let mut _56: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 + let mut _57: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 + let mut _58: &mut std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 + let mut _59: std::option::Option<(usize, &impl Sized)>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 + let mut _60: isize; // in scope 0 at $DIR/loops.rs:+4:5: +6:6 + let mut _63: (usize, &impl Sized); // in scope 0 at $DIR/loops.rs:+5:16: +5:22 + let _64: (); // in scope 0 at $DIR/loops.rs:+4:19: +4:39 + let mut _67: (usize, &mut impl Sized); // in scope 0 at $DIR/loops.rs:+2:16: +2:22 + let _68: (); // in scope 0 at $DIR/loops.rs:+1:19: +1:43 + scope 1 { + debug iter => _28; // in scope 1 at $DIR/loops.rs:+1:19: +1:43 + let _65: usize; // in scope 1 at $DIR/loops.rs:+1:10: +1:11 + let _66: &mut impl Sized; // in scope 1 at $DIR/loops.rs:+1:13: +1:14 + scope 2 { + debug i => _65; // in scope 2 at $DIR/loops.rs:+1:10: +1:11 + debug x => _66; // in scope 2 at $DIR/loops.rs:+1:13: +1:14 + } + } + scope 3 { + debug iter => _57; // in scope 3 at $DIR/loops.rs:+4:19: +4:39 + let _61: usize; // in scope 3 at $DIR/loops.rs:+4:10: +4:11 + let _62: &impl Sized; // in scope 3 at $DIR/loops.rs:+4:13: +4:14 + scope 4 { + debug i => _61; // in scope 4 at $DIR/loops.rs:+4:10: +4:11 + debug x => _62; // in scope 4 at $DIR/loops.rs:+4:13: +4:14 + } + } + scope 5 (inlined as DerefMut>::deref_mut) { // at $DIR/loops.rs:33:19: 33:31 + debug self => _2; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _7: *mut impl Sized; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _8: usize; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + scope 6 { + scope 7 (inlined Vec::::as_mut_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug self => _2; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _3: &alloc::raw_vec::RawVec; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + scope 8 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug self => _3; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + let mut _4: std::ptr::Unique; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + scope 9 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + debug self => _4; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + let mut _5: std::ptr::NonNull; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + scope 10 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + debug self => _5; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _6: *const impl Sized; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + } + } + } + } + scope 11 (inlined std::slice::from_raw_parts_mut::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug data => _7; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug len => _8; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + let mut _13: *mut [impl Sized]; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + let mut _69: *mut impl Sized; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _70: usize; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 12 { + scope 13 (inlined std::slice::from_raw_parts_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug data => _69; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug len => _70; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 14 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug len => _70; // in scope 14 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 15 { + debug max_len => const _; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + scope 16 (inlined slice_from_raw_parts_mut::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug data => _7; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug len => _8; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + let mut _9: *mut (); // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 17 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug self => _7; // in scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + scope 18 (inlined std::ptr::from_raw_parts_mut::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug data_address => _9; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug metadata => _8; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _10: *const (); // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _11: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _12: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + scope 19 { + } + } + } + } + } + } + } + scope 20 (inlined core::slice::::iter_mut) { // at $DIR/loops.rs:33:21: 33:31 + debug self => _14; // in scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 21 (inlined std::slice::IterMut::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _14; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _16: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _17: bool; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _18: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _19: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _21: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _22: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _24: std::ptr::NonNull; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _25: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 22 { + debug ptr => _16; // in scope 22 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 23 { + let _20: *mut impl Sized; // in scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 24 { + debug end => _20; // in scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 30 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _16; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _23: *const impl Sized; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _71: *mut impl Sized; // in scope 30 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 31 { + scope 32 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _71; // in scope 32 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 33 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _71; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _72: *mut u8; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 34 { + scope 35 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _72; // in scope 35 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 36 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _72; // in scope 36 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 37 { + scope 38 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _72; // in scope 38 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 26 (inlined invalid_mut::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _22; // in scope 26 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 27 { + } + } + scope 28 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _16; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug count => _19; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 29 { + } + } + } + } + scope 25 (inlined core::slice::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _14; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _15: *mut [impl Sized]; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 39 (inlined as Iterator>::enumerate) { // at $DIR/loops.rs:33:32: 33:43 + debug self => _26; // in scope 39 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + scope 40 (inlined Enumerate::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + debug iter => _26; // in scope 40 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL + } + } + scope 41 (inlined > as IntoIterator>::into_iter) { // at $DIR/loops.rs:33:19: 33:43 + debug self => _27; // in scope 41 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + scope 42 (inlined as Deref>::deref) { // at $DIR/loops.rs:36:19: 36:27 + debug self => _32; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _38: *const impl Sized; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _39: usize; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + scope 43 { + scope 44 (inlined Vec::::as_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug self => _32; // in scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _33: &alloc::raw_vec::RawVec; // in scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + let mut _37: *mut impl Sized; // in scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + scope 45 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug self => _33; // in scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + let mut _34: std::ptr::Unique; // in scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + scope 46 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + debug self => _34; // in scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + let mut _35: std::ptr::NonNull; // in scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + scope 47 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + debug self => _35; // in scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _36: *const impl Sized; // in scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + } + } + } + } + scope 48 (inlined std::slice::from_raw_parts::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + debug data => _38; // in scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug len => _39; // in scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + let _43: *const [impl Sized]; // in scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + let mut _73: *const impl Sized; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _74: usize; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 49 { + scope 50 (inlined std::slice::from_raw_parts::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug data => _73; // in scope 50 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug len => _74; // in scope 50 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 51 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug len => _74; // in scope 51 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 52 { + debug max_len => const _; // in scope 52 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + scope 53 (inlined slice_from_raw_parts::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL + debug data => _38; // in scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug len => _39; // in scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + let mut _40: *const (); // in scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 54 (inlined ptr::const_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug self => _38; // in scope 54 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + } + scope 55 (inlined std::ptr::from_raw_parts::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug data_address => _40; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug metadata => _39; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _41: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _42: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + scope 56 { + } + } + } + } + } + } + } + scope 57 (inlined core::slice::::iter) { // at $DIR/loops.rs:36:21: 36:27 + debug self => _44; // in scope 57 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 58 (inlined std::slice::Iter::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _44; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _46: *const impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _47: bool; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _48: usize; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _50: usize; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _51: *mut impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _53: std::ptr::NonNull; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _54: *const impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 59 { + debug ptr => _46; // in scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 60 { + let _49: *const impl Sized; // in scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 61 { + debug end => _49; // in scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 67 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _51; // in scope 67 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _52: *const impl Sized; // in scope 67 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _75: *mut impl Sized; // in scope 67 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 68 { + scope 69 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _75; // in scope 69 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 70 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _75; // in scope 70 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _76: *mut u8; // in scope 70 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 71 { + scope 72 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _76; // in scope 72 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 73 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _76; // in scope 73 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 74 { + scope 75 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _76; // in scope 75 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 63 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _50; // in scope 63 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 64 { + } + } + scope 65 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _46; // in scope 65 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _48; // in scope 65 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + scope 66 { + } + } + } + } + scope 62 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _44; // in scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _45: *const [impl Sized]; // in scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 76 (inlined as Iterator>::enumerate) { // at $DIR/loops.rs:36:28: 36:39 + debug self => _55; // in scope 76 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + scope 77 (inlined Enumerate::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + debug iter => _55; // in scope 77 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL + } + } + scope 78 (inlined > as IntoIterator>::into_iter) { // at $DIR/loops.rs:36:19: 36:39 + debug self => _56; // in scope 78 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_26); // scope 0 at $DIR/loops.rs:+1:19: +1:31 + StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:19: +1:31 + _2 = &mut _1; // scope 0 at $DIR/loops.rs:+1:19: +1:31 + StorageLive(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + _3 = &((*_2).0: alloc::raw_vec::RawVec); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + _4 = ((*_3).0: std::ptr::Unique); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + StorageLive(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + _5 = (_4.0: std::ptr::NonNull); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + StorageLive(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _6 = (_5.0: *const impl Sized); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _7 = move _6 as *mut impl Sized (PtrToPtr); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + StorageDead(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + StorageDead(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + _8 = ((*_2).1: usize); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_69); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_70); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageLive(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _9 = _7 as *mut () (PtrToPtr); // scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageLive(_12); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _10 = _9 as *const () (Pointer(MutToConstPointer)); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _11 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: move _10, metadata: _8 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _12 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _11 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _13 = (_12.1: *mut [impl Sized]); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_12); // scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _14 = &mut (*_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageDead(_13); // scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageDead(_70); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_69); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_2); // scope 0 at $DIR/loops.rs:+1:19: +1:20 + StorageLive(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _15 = &raw mut (*_14); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _16 = move _15 as *mut impl Sized (PtrToPtr); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _17 = const _; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _17) -> [0: bb1, otherwise: bb2]; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb1: { + StorageLive(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _18 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _19 = Len((*_18)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _20 = Offset(_16, _19); // scope 29 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageDead(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb2: { + StorageLive(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _21 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _22 = Len((*_21)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _20 = _22 as *mut impl Sized (Transmute); // scope 27 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb3: { + StorageDead(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_71); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_72); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _23 = _16 as *const impl Sized (Pointer(MutToConstPointer)); // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _24 = NonNull:: { pointer: _23 }; // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_72); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_71); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _25 = _20; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _26 = std::slice::IterMut::<'_, impl Sized> { ptr: move _24, end: move _25, _marker: const ZeroSized: PhantomData<&mut impl Sized> }; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&mut impl Sized>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _27 = Enumerate::> { iter: move _26, count: const 0_usize }; // scope 40 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL + StorageDead(_26); // scope 0 at $DIR/loops.rs:+1:42: +1:43 + StorageLive(_28); // scope 0 at $DIR/loops.rs:+1:19: +1:43 + _28 = move _27; // scope 0 at $DIR/loops.rs:+1:19: +1:43 + goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb4: { + StorageLive(_30); // scope 1 at $DIR/loops.rs:+1:19: +1:43 + _29 = &mut _28; // scope 1 at $DIR/loops.rs:+1:19: +1:43 + _30 = > as Iterator>::next(_29) -> [return: bb5, unwind: bb19]; // scope 1 at $DIR/loops.rs:+1:19: +1:43 + // mir::Constant + // + span: $DIR/loops.rs:33:19: 33:43 + // + literal: Const { ty: for<'a> fn(&'a mut Enumerate>) -> Option<> as Iterator>::Item> {> as Iterator>::next}, val: Value() } + } + + bb5: { + _31 = discriminant(_30); // scope 1 at $DIR/loops.rs:+1:19: +1:43 + switchInt(move _31) -> [0: bb6, 1: bb16, otherwise: bb18]; // scope 1 at $DIR/loops.rs:+1:19: +1:43 + } + + bb6: { + StorageDead(_30); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + StorageDead(_28); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + StorageLive(_55); // scope 0 at $DIR/loops.rs:+4:19: +4:27 + StorageLive(_32); // scope 0 at $DIR/loops.rs:+4:19: +4:27 + _32 = &_1; // scope 0 at $DIR/loops.rs:+4:19: +4:27 + StorageLive(_38); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_37); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_33); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + _33 = &((*_32).0: alloc::raw_vec::RawVec); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_34); // scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + _34 = ((*_33).0: std::ptr::Unique); // scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + StorageLive(_35); // scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + _35 = (_34.0: std::ptr::NonNull); // scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + StorageLive(_36); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _36 = (_35.0: *const impl Sized); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _37 = move _36 as *mut impl Sized (PtrToPtr); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_36); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_35); // scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL + StorageDead(_34); // scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL + _38 = move _37 as *const impl Sized (Pointer(MutToConstPointer)); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_33); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_37); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_39); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + _39 = ((*_32).1: usize); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_73); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_74); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageLive(_43); // scope 49 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageLive(_40); // scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _40 = _38 as *const () (PtrToPtr); // scope 54 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageLive(_42); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_41); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _41 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: _40, metadata: _39 }; // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _42 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _41 }; // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_41); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _43 = (_42.0: *const [impl Sized]); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_42); // scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_40); // scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + _44 = &(*_43); // scope 49 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageDead(_43); // scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL + StorageDead(_74); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_73); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_39); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_38); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_32); // scope 0 at $DIR/loops.rs:+4:19: +4:20 + StorageLive(_46); // scope 57 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_45); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _45 = &raw const (*_44); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _46 = move _45 as *const impl Sized (PtrToPtr); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_45); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_49); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_47); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _47 = const _; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _47) -> [0: bb7, otherwise: bb8]; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb7: { + StorageLive(_48); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _48 = Len((*_44)); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _49 = Offset(_46, _48); // scope 66 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_48); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb9; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb8: { + StorageLive(_50); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _50 = Len((*_44)); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _49 = _50 as *const impl Sized (Transmute); // scope 64 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_50); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb9; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb9: { + StorageDead(_47); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_53); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_51); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _51 = _46 as *mut impl Sized (PtrToPtr); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_52); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_75); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_76); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _52 = _51 as *const impl Sized (Pointer(MutToConstPointer)); // scope 68 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _53 = NonNull:: { pointer: _52 }; // scope 68 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_76); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_75); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_52); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_51); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_54); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _54 = _49; // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _55 = std::slice::Iter::<'_, impl Sized> { ptr: move _53, end: move _54, _marker: const ZeroSized: PhantomData<&impl Sized> }; // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&impl Sized>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_54); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_53); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_49); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_46); // scope 57 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _56 = Enumerate::> { iter: move _55, count: const 0_usize }; // scope 77 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL + StorageDead(_55); // scope 0 at $DIR/loops.rs:+4:38: +4:39 + StorageLive(_57); // scope 0 at $DIR/loops.rs:+4:19: +4:39 + _57 = move _56; // scope 0 at $DIR/loops.rs:+4:19: +4:39 + goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 + } + + bb10: { + StorageLive(_59); // scope 3 at $DIR/loops.rs:+4:19: +4:39 + _58 = &mut _57; // scope 3 at $DIR/loops.rs:+4:19: +4:39 + _59 = > as Iterator>::next(_58) -> [return: bb11, unwind: bb19]; // scope 3 at $DIR/loops.rs:+4:19: +4:39 + // mir::Constant + // + span: $DIR/loops.rs:36:19: 36:39 + // + literal: Const { ty: for<'a> fn(&'a mut Enumerate>) -> Option<> as Iterator>::Item> {> as Iterator>::next}, val: Value() } + } + + bb11: { + _60 = discriminant(_59); // scope 3 at $DIR/loops.rs:+4:19: +4:39 + switchInt(move _60) -> [0: bb12, 1: bb14, otherwise: bb18]; // scope 3 at $DIR/loops.rs:+4:19: +4:39 + } + + bb12: { + StorageDead(_59); // scope 3 at $DIR/loops.rs:+6:5: +6:6 + StorageDead(_57); // scope 0 at $DIR/loops.rs:+6:5: +6:6 + drop(_1) -> bb13; // scope 0 at $DIR/loops.rs:+7:1: +7:2 + } + + bb13: { + return; // scope 0 at $DIR/loops.rs:+7:2: +7:2 + } + + bb14: { + _61 = (((_59 as Some).0: (usize, &impl Sized)).0: usize); // scope 3 at $DIR/loops.rs:+4:10: +4:11 + _62 = (((_59 as Some).0: (usize, &impl Sized)).1: &impl Sized); // scope 3 at $DIR/loops.rs:+4:13: +4:14 + StorageLive(_63); // scope 4 at $DIR/loops.rs:+5:16: +5:22 + _63 = (_61, _62); // scope 4 at $DIR/loops.rs:+5:16: +5:22 + _64 = opaque::<(usize, &impl Sized)>(move _63) -> [return: bb15, unwind: bb19]; // scope 4 at $DIR/loops.rs:+5:9: +5:23 + // mir::Constant + // + span: $DIR/loops.rs:37:9: 37:15 + // + literal: Const { ty: fn((usize, &impl Sized)) {opaque::<(usize, &impl Sized)>}, val: Value() } + } + + bb15: { + StorageDead(_63); // scope 4 at $DIR/loops.rs:+5:22: +5:23 + StorageDead(_59); // scope 3 at $DIR/loops.rs:+6:5: +6:6 + goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 + } + + bb16: { + _65 = (((_30 as Some).0: (usize, &mut impl Sized)).0: usize); // scope 1 at $DIR/loops.rs:+1:10: +1:11 + _66 = move (((_30 as Some).0: (usize, &mut impl Sized)).1: &mut impl Sized); // scope 1 at $DIR/loops.rs:+1:13: +1:14 + StorageLive(_67); // scope 2 at $DIR/loops.rs:+2:16: +2:22 + _67 = (_65, move _66); // scope 2 at $DIR/loops.rs:+2:16: +2:22 + _68 = opaque::<(usize, &mut impl Sized)>(move _67) -> [return: bb17, unwind: bb19]; // scope 2 at $DIR/loops.rs:+2:9: +2:23 + // mir::Constant + // + span: $DIR/loops.rs:34:9: 34:15 + // + literal: Const { ty: fn((usize, &mut impl Sized)) {opaque::<(usize, &mut impl Sized)>}, val: Value() } + } + + bb17: { + StorageDead(_67); // scope 2 at $DIR/loops.rs:+2:22: +2:23 + StorageDead(_30); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb18: { + unreachable; // scope 1 at $DIR/loops.rs:+1:19: +1:43 + } + + bb19 (cleanup): { + drop(_1) -> [return: bb20, unwind terminate]; // scope 0 at $DIR/loops.rs:+7:1: +7:2 + } + + bb20 (cleanup): { + resume; // scope 0 at $DIR/loops.rs:+0:1: +7:2 + } +} diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir new file mode 100644 index 0000000000000..a73736291e28d --- /dev/null +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -0,0 +1,83 @@ +// MIR for `vec_move` after PreCodegen + +fn vec_move(_1: Vec) -> () { + debug v => _1; // in scope 0 at $DIR/loops.rs:+0:17: +0:22 + let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:41: +0:41 + let mut _2: std::vec::IntoIter; // in scope 0 at $DIR/loops.rs:+1:14: +1:15 + let mut _3: std::vec::IntoIter; // in scope 0 at $DIR/loops.rs:+1:14: +1:15 + let mut _4: &mut std::vec::IntoIter; // in scope 0 at $DIR/loops.rs:+1:14: +1:15 + let mut _5: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:15 + let mut _6: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 + let _8: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:15 + scope 1 { + debug iter => _3; // in scope 1 at $DIR/loops.rs:+1:14: +1:15 + let _7: impl Sized; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 + scope 2 { + debug x => _7; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 + } + } + + bb0: { + StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:14: +1:15 + _2 = as IntoIterator>::into_iter(move _1) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:15 + // mir::Constant + // + span: $DIR/loops.rs:42:14: 42:15 + // + literal: Const { ty: fn(Vec) -> as IntoIterator>::IntoIter { as IntoIterator>::into_iter}, val: Value() } + } + + bb1: { + StorageLive(_3); // scope 0 at $DIR/loops.rs:+1:14: +1:15 + _3 = move _2; // scope 0 at $DIR/loops.rs:+1:14: +1:15 + goto -> bb2; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb2: { + StorageLive(_5); // scope 1 at $DIR/loops.rs:+1:14: +1:15 + _4 = &mut _3; // scope 1 at $DIR/loops.rs:+1:14: +1:15 + _5 = as Iterator>::next(_4) -> [return: bb3, unwind: bb9]; // scope 1 at $DIR/loops.rs:+1:14: +1:15 + // mir::Constant + // + span: $DIR/loops.rs:42:14: 42:15 + // + literal: Const { ty: for<'a> fn(&'a mut std::vec::IntoIter) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } + } + + bb3: { + _6 = discriminant(_5); // scope 1 at $DIR/loops.rs:+1:14: +1:15 + switchInt(move _6) -> [0: bb4, 1: bb6, otherwise: bb8]; // scope 1 at $DIR/loops.rs:+1:14: +1:15 + } + + bb4: { + StorageDead(_5); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + drop(_3) -> bb5; // scope 0 at $DIR/loops.rs:+3:5: +3:6 + } + + bb5: { + StorageDead(_3); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + StorageDead(_2); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + return; // scope 0 at $DIR/loops.rs:+4:2: +4:2 + } + + bb6: { + _7 = move ((_5 as Some).0: impl Sized); // scope 1 at $DIR/loops.rs:+1:9: +1:10 + _8 = opaque::(move _7) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 + // mir::Constant + // + span: $DIR/loops.rs:43:9: 43:15 + // + literal: Const { ty: fn(impl Sized) {opaque::}, val: Value() } + } + + bb7: { + StorageDead(_5); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + goto -> bb2; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb8: { + unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:15 + } + + bb9 (cleanup): { + drop(_3) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/loops.rs:+3:5: +3:6 + } + + bb10 (cleanup): { + resume; // scope 0 at $DIR/loops.rs:+0:1: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir new file mode 100644 index 0000000000000..020d69a2ef3b4 --- /dev/null +++ b/tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir @@ -0,0 +1,204 @@ +// MIR for `vec_range` after PreCodegen + +fn vec_range(_1: Vec) -> () { + debug v => _1; // in scope 0 at $DIR/loops.rs:+0:18: +0:23 + let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:42: +0:42 + let mut _2: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+1:17: +1:24 + let mut _3: usize; // in scope 0 at $DIR/loops.rs:+1:17: +1:24 + let mut _4: std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + let mut _5: std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + let mut _6: &mut std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + let mut _7: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + let mut _8: isize; // in scope 0 at $DIR/loops.rs:+1:5: +4:6 + let mut _9: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+5:17: +5:24 + let mut _10: usize; // in scope 0 at $DIR/loops.rs:+5:17: +5:24 + let mut _11: std::ops::Range; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 + let mut _12: std::ops::Range; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 + let mut _13: &mut std::ops::Range; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 + let mut _14: std::option::Option; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 + let mut _15: isize; // in scope 0 at $DIR/loops.rs:+5:5: +8:6 + let mut _17: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+6:18: +6:19 + let _18: &impl Sized; // in scope 0 at $DIR/loops.rs:+6:18: +6:22 + let mut _20: (usize, &impl Sized); // in scope 0 at $DIR/loops.rs:+7:16: +7:22 + let _21: (); // in scope 0 at $DIR/loops.rs:+5:14: +5:24 + let mut _23: &mut std::vec::Vec; // in scope 0 at $DIR/loops.rs:+2:22: +2:23 + let mut _24: &mut impl Sized; // in scope 0 at $DIR/loops.rs:+2:22: +2:26 + let mut _26: (usize, &mut impl Sized); // in scope 0 at $DIR/loops.rs:+3:16: +3:22 + let _27: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/loops.rs:+1:14: +1:24 + let _22: usize; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 + scope 2 { + debug i => _22; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 + let _25: &mut impl Sized; // in scope 2 at $DIR/loops.rs:+2:13: +2:14 + scope 3 { + debug x => _25; // in scope 3 at $DIR/loops.rs:+2:13: +2:14 + } + } + scope 9 (inlined iter::range::>::next) { // at $DIR/loops.rs:13:14: 13:24 + debug self => _6; // in scope 9 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + } + scope 4 { + debug iter => _12; // in scope 4 at $DIR/loops.rs:+5:14: +5:24 + let _16: usize; // in scope 4 at $DIR/loops.rs:+5:9: +5:10 + scope 5 { + debug i => _16; // in scope 5 at $DIR/loops.rs:+5:9: +5:10 + let _19: &impl Sized; // in scope 5 at $DIR/loops.rs:+6:13: +6:14 + scope 6 { + debug x => _19; // in scope 6 at $DIR/loops.rs:+6:13: +6:14 + } + } + scope 12 (inlined iter::range::>::next) { // at $DIR/loops.rs:17:14: 17:24 + debug self => _13; // in scope 12 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + } + scope 7 (inlined Vec::::len) { // at $DIR/loops.rs:13:19: 13:24 + debug self => _2; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + } + scope 8 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:13:14: 13:24 + debug self => _4; // in scope 8 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + scope 10 (inlined Vec::::len) { // at $DIR/loops.rs:17:19: 17:24 + debug self => _9; // in scope 10 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + } + scope 11 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:17:14: 17:24 + debug self => _11; // in scope 11 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/loops.rs:+1:17: +1:24 + StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:17: +1:24 + _2 = &_1; // scope 0 at $DIR/loops.rs:+1:17: +1:24 + _3 = ((*_2).1: usize); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_2); // scope 0 at $DIR/loops.rs:+1:23: +1:24 + _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; // scope 0 at $DIR/loops.rs:+1:14: +1:24 + StorageDead(_3); // scope 0 at $DIR/loops.rs:+1:23: +1:24 + StorageLive(_5); // scope 0 at $DIR/loops.rs:+1:14: +1:24 + _5 = move _4; // scope 0 at $DIR/loops.rs:+1:14: +1:24 + goto -> bb1; // scope 1 at $DIR/loops.rs:+1:5: +4:6 + } + + bb1: { + StorageLive(_7); // scope 1 at $DIR/loops.rs:+1:14: +1:24 + _6 = &mut _5; // scope 1 at $DIR/loops.rs:+1:14: +1:24 + _7 = as iter::range::RangeIteratorImpl>::spec_next(_6) -> [return: bb2, unwind: bb15]; // scope 9 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } + } + + bb2: { + _8 = discriminant(_7); // scope 1 at $DIR/loops.rs:+1:14: +1:24 + switchInt(move _8) -> [0: bb3, 1: bb11, otherwise: bb14]; // scope 1 at $DIR/loops.rs:+1:14: +1:24 + } + + bb3: { + StorageDead(_7); // scope 1 at $DIR/loops.rs:+4:5: +4:6 + StorageDead(_5); // scope 0 at $DIR/loops.rs:+4:5: +4:6 + StorageLive(_10); // scope 0 at $DIR/loops.rs:+5:17: +5:24 + StorageLive(_9); // scope 0 at $DIR/loops.rs:+5:17: +5:24 + _9 = &_1; // scope 0 at $DIR/loops.rs:+5:17: +5:24 + _10 = ((*_9).1: usize); // scope 10 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + StorageDead(_9); // scope 0 at $DIR/loops.rs:+5:23: +5:24 + _11 = std::ops::Range:: { start: const 0_usize, end: move _10 }; // scope 0 at $DIR/loops.rs:+5:14: +5:24 + StorageDead(_10); // scope 0 at $DIR/loops.rs:+5:23: +5:24 + StorageLive(_12); // scope 0 at $DIR/loops.rs:+5:14: +5:24 + _12 = move _11; // scope 0 at $DIR/loops.rs:+5:14: +5:24 + goto -> bb4; // scope 4 at $DIR/loops.rs:+5:5: +8:6 + } + + bb4: { + StorageLive(_14); // scope 4 at $DIR/loops.rs:+5:14: +5:24 + _13 = &mut _12; // scope 4 at $DIR/loops.rs:+5:14: +5:24 + _14 = as iter::range::RangeIteratorImpl>::spec_next(_13) -> [return: bb5, unwind: bb15]; // scope 12 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } + } + + bb5: { + _15 = discriminant(_14); // scope 4 at $DIR/loops.rs:+5:14: +5:24 + switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb14]; // scope 4 at $DIR/loops.rs:+5:14: +5:24 + } + + bb6: { + StorageDead(_14); // scope 4 at $DIR/loops.rs:+8:5: +8:6 + StorageDead(_12); // scope 0 at $DIR/loops.rs:+8:5: +8:6 + drop(_1) -> bb7; // scope 0 at $DIR/loops.rs:+9:1: +9:2 + } + + bb7: { + return; // scope 0 at $DIR/loops.rs:+9:2: +9:2 + } + + bb8: { + _16 = ((_14 as Some).0: usize); // scope 4 at $DIR/loops.rs:+5:9: +5:10 + StorageLive(_18); // scope 5 at $DIR/loops.rs:+6:18: +6:22 + StorageLive(_17); // scope 5 at $DIR/loops.rs:+6:18: +6:19 + _17 = &_1; // scope 5 at $DIR/loops.rs:+6:18: +6:19 + _18 = as Index>::index(move _17, _16) -> [return: bb9, unwind: bb15]; // scope 5 at $DIR/loops.rs:+6:18: +6:22 + // mir::Constant + // + span: $DIR/loops.rs:18:18: 18:22 + // + literal: Const { ty: for<'a> fn(&'a Vec, usize) -> &'a as Index>::Output { as Index>::index}, val: Value() } + } + + bb9: { + StorageDead(_17); // scope 5 at $DIR/loops.rs:+6:21: +6:22 + _19 = _18; // scope 5 at $DIR/loops.rs:+6:17: +6:22 + StorageLive(_20); // scope 6 at $DIR/loops.rs:+7:16: +7:22 + _20 = (_16, _19); // scope 6 at $DIR/loops.rs:+7:16: +7:22 + _21 = opaque::<(usize, &impl Sized)>(move _20) -> [return: bb10, unwind: bb15]; // scope 6 at $DIR/loops.rs:+7:9: +7:23 + // mir::Constant + // + span: $DIR/loops.rs:19:9: 19:15 + // + literal: Const { ty: fn((usize, &impl Sized)) {opaque::<(usize, &impl Sized)>}, val: Value() } + } + + bb10: { + StorageDead(_20); // scope 6 at $DIR/loops.rs:+7:22: +7:23 + StorageDead(_18); // scope 5 at $DIR/loops.rs:+8:5: +8:6 + StorageDead(_14); // scope 4 at $DIR/loops.rs:+8:5: +8:6 + goto -> bb4; // scope 4 at $DIR/loops.rs:+5:5: +8:6 + } + + bb11: { + _22 = ((_7 as Some).0: usize); // scope 1 at $DIR/loops.rs:+1:9: +1:10 + StorageLive(_24); // scope 2 at $DIR/loops.rs:+2:22: +2:26 + StorageLive(_23); // scope 2 at $DIR/loops.rs:+2:22: +2:23 + _23 = &mut _1; // scope 2 at $DIR/loops.rs:+2:22: +2:23 + _24 = as IndexMut>::index_mut(move _23, _22) -> [return: bb12, unwind: bb15]; // scope 2 at $DIR/loops.rs:+2:22: +2:26 + // mir::Constant + // + span: $DIR/loops.rs:14:22: 14:26 + // + literal: Const { ty: for<'a> fn(&'a mut Vec, usize) -> &'a mut as Index>::Output { as IndexMut>::index_mut}, val: Value() } + } + + bb12: { + StorageDead(_23); // scope 2 at $DIR/loops.rs:+2:25: +2:26 + _25 = _24; // scope 2 at $DIR/loops.rs:+2:17: +2:26 + StorageLive(_26); // scope 3 at $DIR/loops.rs:+3:16: +3:22 + _26 = (_22, move _25); // scope 3 at $DIR/loops.rs:+3:16: +3:22 + _27 = opaque::<(usize, &mut impl Sized)>(move _26) -> [return: bb13, unwind: bb15]; // scope 3 at $DIR/loops.rs:+3:9: +3:23 + // mir::Constant + // + span: $DIR/loops.rs:15:9: 15:15 + // + literal: Const { ty: fn((usize, &mut impl Sized)) {opaque::<(usize, &mut impl Sized)>}, val: Value() } + } + + bb13: { + StorageDead(_26); // scope 3 at $DIR/loops.rs:+3:22: +3:23 + StorageDead(_24); // scope 2 at $DIR/loops.rs:+4:5: +4:6 + StorageDead(_7); // scope 1 at $DIR/loops.rs:+4:5: +4:6 + goto -> bb1; // scope 1 at $DIR/loops.rs:+1:5: +4:6 + } + + bb14: { + unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:24 + } + + bb15 (cleanup): { + drop(_1) -> [return: bb16, unwind terminate]; // scope 0 at $DIR/loops.rs:+9:1: +9:2 + } + + bb16 (cleanup): { + resume; // scope 0 at $DIR/loops.rs:+0:1: +9:2 + } +} From 434fa8c26dc3337a688c5d1c8fd077e799ff052e Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 30 Apr 2023 14:53:24 +0000 Subject: [PATCH 03/10] Add e2e mir test for checked arithmetic. --- ...ecked_ops.checked_shl.PreCodegen.after.mir | 160 ++++++++++++++++++ .../checked_ops.ilog2.PreCodegen.after.mir | 41 +++++ tests/mir-opt/pre-codegen/checked_ops.rs | 20 +++ ...cked_ops.step_forward.PreCodegen.after.mir | 64 +++++++ 4 files changed, 285 insertions(+) create mode 100644 tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/checked_ops.rs create mode 100644 tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir new file mode 100644 index 0000000000000..75c4c56dd67c7 --- /dev/null +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir @@ -0,0 +1,160 @@ +// MIR for `checked_shl` after PreCodegen + +fn checked_shl(_1: u32, _2: u32) -> Option { + debug x => _1; // in scope 0 at $DIR/checked_ops.rs:+0:20: +0:21 + debug rhs => _2; // in scope 0 at $DIR/checked_ops.rs:+0:28: +0:31 + let mut _0: std::option::Option; // return place in scope 0 at $DIR/checked_ops.rs:+0:41: +0:52 + scope 1 (inlined core::num::::checked_shl) { // at $DIR/checked_ops.rs:14:7: 14:23 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _13: (u32, bool); // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let _14: u32; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let _15: bool; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _16: bool; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 2 { + debug a => _14; // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug b => _15; // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + } + scope 3 (inlined core::num::::overflowing_shl) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug self => _1; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug rhs => _2; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _11: u32; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _12: bool; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + scope 4 (inlined core::num::::wrapping_shl) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug self => _1; // in scope 4 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug rhs => _2; // in scope 4 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _3: u32; // in scope 4 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _4: u32; // in scope 4 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + scope 5 { + scope 6 (inlined core::num::::unchecked_shl) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug self => _1; // in scope 6 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug rhs => _4; // in scope 6 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _5: (u32,); // in scope 6 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _6: u32; // in scope 6 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _10: u32; // in scope 6 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 7 { + scope 8 (inlined core::num::::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug x => _6; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _7: std::result::Result; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _9: std::option::Option; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 9 { + scope 10 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _6; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + scope 11 (inlined >::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug value => _6; // in scope 11 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + scope 21 (inlined >::into) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug self => _6; // in scope 21 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + scope 22 (inlined >::from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug t => _6; // in scope 22 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + } + } + } + } + scope 12 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _7; // in scope 12 at $SRC_DIR/core/src/result.rs:LL:COL + let _8: u32; // in scope 12 at $SRC_DIR/core/src/result.rs:LL:COL + scope 13 { + debug x => _8; // in scope 13 at $SRC_DIR/core/src/result.rs:LL:COL + } + } + scope 14 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug self => _9; // in scope 14 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _17: &std::option::Option; // in scope 14 at $SRC_DIR/core/src/option.rs:LL:COL + scope 15 { + debug val => _10; // in scope 15 at $SRC_DIR/core/src/option.rs:LL:COL + } + scope 16 { + scope 18 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL + scope 19 { + scope 20 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + } + } + } + } + scope 17 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _17; // in scope 17 at $SRC_DIR/core/src/option.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + + bb0: { + StorageLive(_14); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 + StorageLive(_15); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 + StorageLive(_13); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageLive(_11); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageLive(_6); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageLive(_4); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageLive(_3); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _3 = const 31_u32; // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _4 = BitAnd(_2, move _3); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_3); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageLive(_10); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_5); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _5 = (_4,); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _6 = move (_5.0: u32); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_9); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_7); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _7 = Result::::Ok(_6); // scope 11 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + StorageLive(_8); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _8 = move ((_7 as Ok).0: u32); // scope 12 at $SRC_DIR/core/src/result.rs:LL:COL + _9 = Option::::Some(move _8); // scope 13 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_8); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_7); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_17); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _10 = move ((_9 as Some).0: u32); // scope 14 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_17); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_9); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_5); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _11 = unchecked_shl::(_1, move _10) -> [return: bb1, unwind unreachable]; // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u32, u32) -> u32 {unchecked_shl::}, val: Value() } + } + + bb1: { + StorageDead(_10); // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_4); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_6); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageLive(_12); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _12 = Ge(_2, const _); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _13 = (move _11, move _12); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_12); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_11); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _14 = (_13.0: u32); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _15 = (_13.1: bool); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_13); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageLive(_16); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _16 = unlikely(_15) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/mod.rs:LL:COL + // + literal: Const { ty: extern "rust-intrinsic" fn(bool) -> bool {unlikely}, val: Value() } + } + + bb2: { + switchInt(move _16) -> [0: bb3, otherwise: bb4]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + } + + bb3: { + _0 = Option::::Some(_14); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + goto -> bb5; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + } + + bb4: { + _0 = Option::::None; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + goto -> bb5; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + } + + bb5: { + StorageDead(_16); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_15); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 + StorageDead(_14); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 + return; // scope 0 at $DIR/checked_ops.rs:+2:2: +2:2 + } +} diff --git a/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir new file mode 100644 index 0000000000000..fc7626cce1785 --- /dev/null +++ b/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir @@ -0,0 +1,41 @@ +// MIR for `ilog2` after PreCodegen + +fn ilog2(_1: u32) -> u32 { + debug x => _1; // in scope 0 at $DIR/checked_ops.rs:+0:14: +0:15 + let mut _0: u32; // return place in scope 0 at $DIR/checked_ops.rs:+0:25: +0:28 + scope 1 (inlined #[track_caller] core::num::::ilog2) { // at $DIR/checked_ops.rs:19:7: 19:14 + debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _2: std::option::Option; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _3: isize; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _4: !; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + scope 2 { + debug log => _0; // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + } + } + + bb0: { + StorageLive(_2); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _2 = core::num::::checked_ilog2(_1) -> bb1; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // + literal: Const { ty: fn(u32) -> Option {core::num::::checked_ilog2}, val: Value() } + } + + bb1: { + _3 = discriminant(_2); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + switchInt(move _3) -> [1: bb2, otherwise: bb3]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + } + + bb2: { + _0 = ((_2 as Some).0: u32); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_2); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + return; // scope 0 at $DIR/checked_ops.rs:+2:2: +2:2 + } + + bb3: { + _4 = core::num::int_log10::panic_for_nonpositive_argument(); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + // + literal: Const { ty: fn() -> ! {core::num::int_log10::panic_for_nonpositive_argument}, val: Value() } + } +} diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs new file mode 100644 index 0000000000000..5a751362c09f3 --- /dev/null +++ b/tests/mir-opt/pre-codegen/checked_ops.rs @@ -0,0 +1,20 @@ +// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 +// ignore-debug + +#![crate_type = "lib"] +#![feature(step_trait)] + +// EMIT_MIR checked_ops.step_forward.PreCodegen.after.mir +pub fn step_forward(x: u32, n: usize) -> u32 { + std::iter::Step::forward(x, n) +} + +// EMIT_MIR checked_ops.checked_shl.PreCodegen.after.mir +pub fn checked_shl(x: u32, rhs: u32) -> Option { + x.checked_shl(rhs) +} + +// EMIT_MIR checked_ops.ilog2.PreCodegen.after.mir +pub fn ilog2(x: u32) -> u32 { + x.ilog2() +} 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 new file mode 100644 index 0000000000000..d61aac7d73bde --- /dev/null +++ b/tests/mir-opt/pre-codegen/checked_ops.step_forward.PreCodegen.after.mir @@ -0,0 +1,64 @@ +// MIR for `step_forward` after PreCodegen + +fn step_forward(_1: u32, _2: usize) -> u32 { + debug x => _1; // in scope 0 at $DIR/checked_ops.rs:+0:21: +0:22 + debug n => _2; // in scope 0 at $DIR/checked_ops.rs:+0:29: +0:30 + let mut _0: u32; // return place in scope 0 at $DIR/checked_ops.rs:+0:42: +0:45 + scope 1 (inlined ::forward) { // at $DIR/checked_ops.rs:9:5: 9:35 + debug start => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug n => _2; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let _3: std::option::Option; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _4: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _7: bool; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _8: u32; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 2 { + } + scope 3 (inlined Option::::is_none) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _4; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _6: bool; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + scope 4 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _4; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _5: isize; // in scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + } + } + scope 5 (inlined core::num::::wrapping_add) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _1; // in scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug rhs => _8; // in scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + } + } + + bb0: { + StorageLive(_7); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_4); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_3); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _3 = ::forward_checked(_1, _2) -> bb1; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: fn(u32, usize) -> Option {::forward_checked}, val: Value() } + } + + bb1: { + _4 = &_3; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_6); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + _5 = discriminant((*_4)); // scope 4 at $SRC_DIR/core/src/option.rs:LL:COL + _6 = Eq(_5, const 1_isize); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _7 = Not(move _6); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_6); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_3); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_4); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + switchInt(move _7) -> [0: bb3, otherwise: bb2]; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb2: { + assert(!const true, "attempt to compute `{} + {}`, which would overflow", const _, const 1_u32) -> bb3; // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb3: { + StorageDead(_7); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_8); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _8 = _2 as u32 (IntToInt); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _0 = Add(_1, _8); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_8); // scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL + return; // scope 0 at $DIR/checked_ops.rs:+2:2: +2:2 + } +} From b0121799b314c0069c7b293688a2edf4f1be6c27 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Fri, 14 Apr 2023 18:23:07 +0000 Subject: [PATCH 04/10] Add chained comparison e2e test. --- ...ned_comparison.bitand.PreCodegen.after.mir | 84 +++++++++++ ...ined_comparison.naive.PreCodegen.after.mir | 136 ++++++++++++++++++ ..._comparison.returning.PreCodegen.after.mir | 126 ++++++++++++++++ .../mir-opt/pre-codegen/chained_comparison.rs | 54 +++++++ 4 files changed, 400 insertions(+) create mode 100644 tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/chained_comparison.rs diff --git a/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir new file mode 100644 index 0000000000000..40ddf82f4cf95 --- /dev/null +++ b/tests/mir-opt/pre-codegen/chained_comparison.bitand.PreCodegen.after.mir @@ -0,0 +1,84 @@ +// MIR for `bitand` after PreCodegen + +fn bitand(_1: &Blueprint, _2: &Blueprint) -> bool { + debug a => _1; // in scope 0 at $DIR/chained_comparison.rs:+0:15: +0:16 + debug b => _2; // in scope 0 at $DIR/chained_comparison.rs:+0:30: +0:31 + let mut _0: bool; // return place in scope 0 at $DIR/chained_comparison.rs:+0:48: +0:52 + let mut _3: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22 + let mut _4: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42 + let mut _5: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43 + let mut _6: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:12: +2:21 + let mut _7: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:25: +2:34 + let mut _8: bool; // in scope 0 at $DIR/chained_comparison.rs:+2:11: +2:35 + let mut _9: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +2:35 + let mut _10: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:12: +3:28 + let mut _11: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:32: +3:48 + let mut _12: bool; // in scope 0 at $DIR/chained_comparison.rs:+3:11: +3:49 + let mut _13: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +3:49 + let mut _14: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:12: +4:25 + let mut _15: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:29: +4:42 + let mut _16: bool; // in scope 0 at $DIR/chained_comparison.rs:+4:11: +4:43 + let mut _17: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +4:43 + let mut _18: u32; // in scope 0 at $DIR/chained_comparison.rs:+5:12: +5:21 + let mut _19: u32; // in scope 0 at $DIR/chained_comparison.rs:+5:25: +5:34 + let mut _20: bool; // in scope 0 at $DIR/chained_comparison.rs:+5:11: +5:35 + + bb0: { + StorageLive(_17); // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:43 + StorageLive(_13); // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:49 + StorageLive(_9); // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:35 + StorageLive(_5); // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43 + StorageLive(_3); // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22 + _3 = ((*_1).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22 + StorageLive(_4); // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42 + _4 = ((*_2).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42 + _5 = Eq(move _3, move _4); // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43 + StorageDead(_4); // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43 + StorageDead(_3); // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43 + StorageLive(_8); // scope 0 at $DIR/chained_comparison.rs:+2:11: +2:35 + StorageLive(_6); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:21 + _6 = ((*_1).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:21 + StorageLive(_7); // scope 0 at $DIR/chained_comparison.rs:+2:25: +2:34 + _7 = ((*_2).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:25: +2:34 + _8 = Eq(move _6, move _7); // scope 0 at $DIR/chained_comparison.rs:+2:11: +2:35 + StorageDead(_7); // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35 + StorageDead(_6); // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35 + _9 = BitAnd(move _5, move _8); // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:35 + StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35 + StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35 + StorageLive(_12); // scope 0 at $DIR/chained_comparison.rs:+3:11: +3:49 + StorageLive(_10); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:28 + _10 = ((*_1).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:28 + StorageLive(_11); // scope 0 at $DIR/chained_comparison.rs:+3:32: +3:48 + _11 = ((*_2).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:32: +3:48 + _12 = Eq(move _10, move _11); // scope 0 at $DIR/chained_comparison.rs:+3:11: +3:49 + StorageDead(_11); // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49 + StorageDead(_10); // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49 + _13 = BitAnd(move _9, move _12); // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:49 + StorageDead(_12); // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49 + StorageDead(_9); // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49 + StorageLive(_16); // scope 0 at $DIR/chained_comparison.rs:+4:11: +4:43 + StorageLive(_14); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:25 + _14 = ((*_1).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:25 + StorageLive(_15); // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:42 + _15 = ((*_2).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:42 + _16 = Eq(move _14, move _15); // scope 0 at $DIR/chained_comparison.rs:+4:11: +4:43 + StorageDead(_15); // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43 + StorageDead(_14); // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43 + _17 = BitAnd(move _13, move _16); // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:43 + StorageDead(_16); // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43 + StorageDead(_13); // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43 + StorageLive(_20); // scope 0 at $DIR/chained_comparison.rs:+5:11: +5:35 + StorageLive(_18); // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:21 + _18 = ((*_1).4: u32); // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:21 + StorageLive(_19); // scope 0 at $DIR/chained_comparison.rs:+5:25: +5:34 + _19 = ((*_2).4: u32); // scope 0 at $DIR/chained_comparison.rs:+5:25: +5:34 + _20 = Eq(move _18, move _19); // scope 0 at $DIR/chained_comparison.rs:+5:11: +5:35 + StorageDead(_19); // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35 + StorageDead(_18); // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35 + _0 = BitAnd(move _17, move _20); // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:35 + StorageDead(_20); // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35 + StorageDead(_17); // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35 + return; // scope 0 at $DIR/chained_comparison.rs:+6:2: +6:2 + } +} diff --git a/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir new file mode 100644 index 0000000000000..837962a6aa31d --- /dev/null +++ b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir @@ -0,0 +1,136 @@ +// MIR for `naive` after PreCodegen + +fn naive(_1: &Blueprint, _2: &Blueprint) -> bool { + debug a => _1; // in scope 0 at $DIR/chained_comparison.rs:+0:14: +0:15 + debug b => _2; // in scope 0 at $DIR/chained_comparison.rs:+0:29: +0:30 + let mut _0: bool; // return place in scope 0 at $DIR/chained_comparison.rs:+0:47: +0:51 + let mut _3: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22 + let mut _4: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42 + let mut _5: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43 + let mut _6: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + let mut _7: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22 + let mut _8: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35 + let mut _9: bool; // in scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36 + let mut _10: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + let mut _11: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29 + let mut _12: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49 + let mut _13: bool; // in scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50 + let mut _14: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 + let mut _15: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26 + let mut _16: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43 + let mut _17: bool; // in scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44 + let mut _18: u32; // in scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22 + let mut _19: u32; // in scope 0 at $DIR/chained_comparison.rs:+5:26: +5:35 + let mut _20: bool; // in scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36 + + bb0: { + StorageLive(_14); // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 + StorageLive(_10); // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + StorageLive(_6); // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + StorageLive(_5); // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43 + StorageLive(_3); // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22 + _3 = ((*_1).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22 + StorageLive(_4); // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42 + _4 = ((*_2).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42 + _5 = Eq(move _3, move _4); // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43 + StorageDead(_4); // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43 + StorageDead(_3); // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43 + switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + } + + bb1: { + _6 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + goto -> bb3; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + } + + bb2: { + StorageLive(_9); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36 + StorageLive(_7); // scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22 + _7 = ((*_1).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22 + StorageLive(_8); // scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35 + _8 = ((*_2).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35 + _9 = Eq(move _7, move _8); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36 + StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 + StorageDead(_7); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 + _6 = move _9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + goto -> bb3; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + } + + bb3: { + StorageDead(_9); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 + StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 + switchInt(move _6) -> [0: bb4, otherwise: bb5]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + } + + bb4: { + _10 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + goto -> bb6; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + } + + bb5: { + StorageLive(_13); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50 + StorageLive(_11); // scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29 + _11 = ((*_1).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29 + StorageLive(_12); // scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49 + _12 = ((*_2).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49 + _13 = Eq(move _11, move _12); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50 + StorageDead(_12); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 + StorageDead(_11); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 + _10 = move _13; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + goto -> bb6; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + } + + bb6: { + StorageDead(_13); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 + StorageDead(_6); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 + switchInt(move _10) -> [0: bb7, otherwise: bb8]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 + } + + bb7: { + _14 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 + goto -> bb9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 + } + + bb8: { + StorageLive(_17); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44 + StorageLive(_15); // scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26 + _15 = ((*_1).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26 + StorageLive(_16); // scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43 + _16 = ((*_2).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43 + _17 = Eq(move _15, move _16); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44 + StorageDead(_16); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 + StorageDead(_15); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 + _14 = move _17; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 + goto -> bb9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 + } + + bb9: { + StorageDead(_17); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 + StorageDead(_10); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 + switchInt(move _14) -> [0: bb10, otherwise: bb11]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 + } + + bb10: { + _0 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 + goto -> bb12; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 + } + + bb11: { + StorageLive(_20); // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36 + StorageLive(_18); // scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22 + _18 = ((*_1).4: u32); // scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22 + StorageLive(_19); // scope 0 at $DIR/chained_comparison.rs:+5:26: +5:35 + _19 = ((*_2).4: u32); // scope 0 at $DIR/chained_comparison.rs:+5:26: +5:35 + _20 = Eq(move _18, move _19); // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36 + StorageDead(_19); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36 + StorageDead(_18); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36 + _0 = move _20; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 + goto -> bb12; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 + } + + bb12: { + StorageDead(_20); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36 + StorageDead(_14); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36 + return; // scope 0 at $DIR/chained_comparison.rs:+6:2: +6:2 + } +} diff --git a/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir new file mode 100644 index 0000000000000..7560e1e26cea9 --- /dev/null +++ b/tests/mir-opt/pre-codegen/chained_comparison.returning.PreCodegen.after.mir @@ -0,0 +1,126 @@ +// MIR for `returning` after PreCodegen + +fn returning(_1: &Blueprint, _2: &Blueprint) -> bool { + debug a => _1; // in scope 0 at $DIR/chained_comparison.rs:+0:18: +0:19 + debug b => _2; // in scope 0 at $DIR/chained_comparison.rs:+0:33: +0:34 + let mut _0: bool; // return place in scope 0 at $DIR/chained_comparison.rs:+0:51: +0:55 + let mut _3: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:8: +1:24 + let mut _4: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:28: +1:44 + let mut _5: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44 + let mut _6: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:8: +4:17 + let mut _7: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:21: +4:30 + let mut _8: bool; // in scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30 + let mut _9: u32; // in scope 0 at $DIR/chained_comparison.rs:+7:8: +7:24 + let mut _10: u32; // in scope 0 at $DIR/chained_comparison.rs:+7:28: +7:44 + let mut _11: bool; // in scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44 + let mut _12: u32; // in scope 0 at $DIR/chained_comparison.rs:+10:8: +10:21 + let mut _13: u32; // in scope 0 at $DIR/chained_comparison.rs:+10:25: +10:38 + let mut _14: bool; // in scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38 + let mut _15: u32; // in scope 0 at $DIR/chained_comparison.rs:+13:8: +13:17 + let mut _16: u32; // in scope 0 at $DIR/chained_comparison.rs:+13:21: +13:30 + let mut _17: bool; // in scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30 + + bb0: { + StorageLive(_5); // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44 + StorageLive(_3); // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:24 + _3 = ((*_1).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:24 + StorageLive(_4); // scope 0 at $DIR/chained_comparison.rs:+1:28: +1:44 + _4 = ((*_2).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:28: +1:44 + _5 = Ne(move _3, move _4); // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44 + StorageDead(_4); // scope 0 at $DIR/chained_comparison.rs:+1:43: +1:44 + StorageDead(_3); // scope 0 at $DIR/chained_comparison.rs:+1:43: +1:44 + switchInt(move _5) -> [0: bb1, otherwise: bb10]; // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44 + } + + bb1: { + StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+3:5: +3:6 + StorageLive(_8); // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30 + StorageLive(_6); // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:17 + _6 = ((*_1).1: u32); // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:17 + StorageLive(_7); // scope 0 at $DIR/chained_comparison.rs:+4:21: +4:30 + _7 = ((*_2).1: u32); // scope 0 at $DIR/chained_comparison.rs:+4:21: +4:30 + _8 = Ne(move _6, move _7); // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30 + StorageDead(_7); // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:30 + StorageDead(_6); // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:30 + switchInt(move _8) -> [0: bb2, otherwise: bb9]; // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30 + } + + bb2: { + StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+6:5: +6:6 + StorageLive(_11); // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44 + StorageLive(_9); // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:24 + _9 = ((*_1).2: u32); // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:24 + StorageLive(_10); // scope 0 at $DIR/chained_comparison.rs:+7:28: +7:44 + _10 = ((*_2).2: u32); // scope 0 at $DIR/chained_comparison.rs:+7:28: +7:44 + _11 = Ne(move _9, move _10); // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44 + StorageDead(_10); // scope 0 at $DIR/chained_comparison.rs:+7:43: +7:44 + StorageDead(_9); // scope 0 at $DIR/chained_comparison.rs:+7:43: +7:44 + switchInt(move _11) -> [0: bb3, otherwise: bb8]; // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44 + } + + bb3: { + StorageDead(_11); // scope 0 at $DIR/chained_comparison.rs:+9:5: +9:6 + StorageLive(_14); // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38 + StorageLive(_12); // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:21 + _12 = ((*_1).3: u32); // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:21 + StorageLive(_13); // scope 0 at $DIR/chained_comparison.rs:+10:25: +10:38 + _13 = ((*_2).3: u32); // scope 0 at $DIR/chained_comparison.rs:+10:25: +10:38 + _14 = Ne(move _12, move _13); // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38 + StorageDead(_13); // scope 0 at $DIR/chained_comparison.rs:+10:37: +10:38 + StorageDead(_12); // scope 0 at $DIR/chained_comparison.rs:+10:37: +10:38 + switchInt(move _14) -> [0: bb4, otherwise: bb7]; // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38 + } + + bb4: { + StorageDead(_14); // scope 0 at $DIR/chained_comparison.rs:+12:5: +12:6 + StorageLive(_17); // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30 + StorageLive(_15); // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:17 + _15 = ((*_1).4: u32); // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:17 + StorageLive(_16); // scope 0 at $DIR/chained_comparison.rs:+13:21: +13:30 + _16 = ((*_2).4: u32); // scope 0 at $DIR/chained_comparison.rs:+13:21: +13:30 + _17 = Ne(move _15, move _16); // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30 + StorageDead(_16); // scope 0 at $DIR/chained_comparison.rs:+13:29: +13:30 + StorageDead(_15); // scope 0 at $DIR/chained_comparison.rs:+13:29: +13:30 + switchInt(move _17) -> [0: bb5, otherwise: bb6]; // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30 + } + + bb5: { + StorageDead(_17); // scope 0 at $DIR/chained_comparison.rs:+15:5: +15:6 + _0 = const true; // scope 0 at $DIR/chained_comparison.rs:+16:5: +16:9 + goto -> bb11; // scope 0 at $DIR/chained_comparison.rs:+17:2: +17:2 + } + + bb6: { + _0 = const false; // scope 0 at $DIR/chained_comparison.rs:+14:16: +14:21 + StorageDead(_17); // scope 0 at $DIR/chained_comparison.rs:+15:5: +15:6 + goto -> bb11; // scope 0 at no-location + } + + bb7: { + _0 = const false; // scope 0 at $DIR/chained_comparison.rs:+11:16: +11:21 + StorageDead(_14); // scope 0 at $DIR/chained_comparison.rs:+12:5: +12:6 + goto -> bb11; // scope 0 at no-location + } + + bb8: { + _0 = const false; // scope 0 at $DIR/chained_comparison.rs:+8:16: +8:21 + StorageDead(_11); // scope 0 at $DIR/chained_comparison.rs:+9:5: +9:6 + goto -> bb11; // scope 0 at no-location + } + + bb9: { + _0 = const false; // scope 0 at $DIR/chained_comparison.rs:+5:16: +5:21 + StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+6:5: +6:6 + goto -> bb11; // scope 0 at no-location + } + + bb10: { + _0 = const false; // scope 0 at $DIR/chained_comparison.rs:+2:16: +2:21 + StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+3:5: +3:6 + goto -> bb11; // scope 0 at no-location + } + + bb11: { + return; // scope 0 at $DIR/chained_comparison.rs:+17:2: +17:2 + } +} diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs new file mode 100644 index 0000000000000..5293249c4e0d9 --- /dev/null +++ b/tests/mir-opt/pre-codegen/chained_comparison.rs @@ -0,0 +1,54 @@ +// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 +// ignore-debug + +#![crate_type = "lib"] + +pub struct Blueprint { + pub fuel_tank_size: u32, + pub payload: u32, + pub wheel_diameter: u32, + pub wheel_width: u32, + pub storage: u32, +} + +// Equivalent of #[derive(PartialEq)] +pub fn naive(a: &Blueprint, b: &Blueprint) -> bool { + (a.fuel_tank_size == b.fuel_tank_size) + && (a.payload == b.payload) + && (a.wheel_diameter == b.wheel_diameter) + && (a.wheel_width == b.wheel_width) + && (a.storage == b.storage) +} + +// Optimizes good but changes semantics +pub fn bitand(a: &Blueprint, b: &Blueprint) -> bool { + (a.fuel_tank_size == b.fuel_tank_size) + & (a.payload == b.payload) + & (a.wheel_diameter == b.wheel_diameter) + & (a.wheel_width == b.wheel_width) + & (a.storage == b.storage) +} + +// Optimizes good and have same semantics as PartialEq +pub fn returning(a: &Blueprint, b: &Blueprint) -> bool { + if a.fuel_tank_size != b.fuel_tank_size { + return false; + } + if a.payload != b.payload { + return false; + } + if a.wheel_diameter != b.wheel_diameter { + return false; + } + if a.wheel_width != b.wheel_width { + return false; + } + if a.storage != b.storage { + return false; + } + true +} + +// EMIT_MIR chained_comparison.naive.PreCodegen.after.mir +// EMIT_MIR chained_comparison.bitand.PreCodegen.after.mir +// EMIT_MIR chained_comparison.returning.PreCodegen.after.mir From 3483e77263551544bb3ba0a20a06854345824cc6 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Tue, 16 May 2023 12:21:29 +0000 Subject: [PATCH 05/10] Remove spurious comments. --- tests/mir-opt/pre-codegen/chained_comparison.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/mir-opt/pre-codegen/chained_comparison.rs b/tests/mir-opt/pre-codegen/chained_comparison.rs index 5293249c4e0d9..f7879140f812f 100644 --- a/tests/mir-opt/pre-codegen/chained_comparison.rs +++ b/tests/mir-opt/pre-codegen/chained_comparison.rs @@ -11,7 +11,6 @@ pub struct Blueprint { pub storage: u32, } -// Equivalent of #[derive(PartialEq)] pub fn naive(a: &Blueprint, b: &Blueprint) -> bool { (a.fuel_tank_size == b.fuel_tank_size) && (a.payload == b.payload) @@ -20,7 +19,6 @@ pub fn naive(a: &Blueprint, b: &Blueprint) -> bool { && (a.storage == b.storage) } -// Optimizes good but changes semantics pub fn bitand(a: &Blueprint, b: &Blueprint) -> bool { (a.fuel_tank_size == b.fuel_tank_size) & (a.payload == b.payload) @@ -29,7 +27,6 @@ pub fn bitand(a: &Blueprint, b: &Blueprint) -> bool { & (a.storage == b.storage) } -// Optimizes good and have same semantics as PartialEq pub fn returning(a: &Blueprint, b: &Blueprint) -> bool { if a.fuel_tank_size != b.fuel_tank_size { return false; From 051dd6714cde780c4642bf51d27b0023487002a1 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Tue, 16 May 2023 12:24:38 +0000 Subject: [PATCH 06/10] Remove duplication. --- .../loops.filter_mapped.PreCodegen.after.mir | 102 +++ .../loops.mapped.PreCodegen.after.mir | 91 +++ tests/mir-opt/pre-codegen/loops.rs | 32 +- .../loops.vec_iter.PreCodegen.after.mir | 570 ----------------- ...ps.vec_iter_enumerate.PreCodegen.after.mir | 604 ------------------ .../loops.vec_move.PreCodegen.after.mir | 6 +- .../loops.vec_range.PreCodegen.after.mir | 204 ------ ..._iter.enumerated_loop.PreCodegen.after.mir | 216 +++++++ ...slice_iter.range_loop.PreCodegen.after.mir | 107 ++++ tests/mir-opt/pre-codegen/slice_iter.rs | 15 + 10 files changed, 541 insertions(+), 1406 deletions(-) create mode 100644 tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir delete mode 100644 tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir delete mode 100644 tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir delete mode 100644 tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir create mode 100644 tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir 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 new file mode 100644 index 0000000000000..ab07b05353602 --- /dev/null +++ b/tests/mir-opt/pre-codegen/loops.filter_mapped.PreCodegen.after.mir @@ -0,0 +1,102 @@ +// MIR for `filter_mapped` after PreCodegen + +fn filter_mapped(_1: impl Iterator, _2: impl Fn(T) -> Option) -> () { + debug iter => _1; // in scope 0 at $DIR/loops.rs:+0:28: +0:32 + debug f => _2; // in scope 0 at $DIR/loops.rs:+0:59: +0:60 + let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:87: +0:87 + let mut _3: std::iter::FilterMap, impl Fn(T) -> Option>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + let mut _4: std::iter::FilterMap, impl Fn(T) -> Option>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + let mut _5: std::iter::FilterMap, impl Fn(T) -> Option>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + let mut _6: &mut std::iter::FilterMap, impl Fn(T) -> Option>; // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + let mut _9: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + let mut _10: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 + let _12: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:32 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/loops.rs:+1:14: +1:32 + let _11: U; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 + scope 2 { + debug x => _11; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 + } + scope 4 (inlined , impl Fn(T) -> Option> as Iterator>::next) { // at $DIR/loops.rs:19:14: 19:32 + debug self => _6; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + let mut _7: &mut impl Iterator; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + let mut _8: &mut impl Fn(T) -> Option; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + } + } + scope 3 (inlined , impl Fn(T) -> Option> as IntoIterator>::into_iter) { // at $DIR/loops.rs:19:14: 19:32 + debug self => _3; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/loops.rs:+1:14: +1:32 + StorageLive(_3); // scope 0 at $DIR/loops.rs:+1:14: +1:32 + _3 = as Iterator>::filter_map:: Option>(move _1, move _2) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:32 + // mir::Constant + // + span: $DIR/loops.rs:19:19: 19:29 + // + literal: Const { ty: fn(impl Iterator, impl Fn(T) -> Option) -> FilterMap, impl Fn(T) -> Option> { as Iterator>::filter_map:: Option>}, val: Value() } + } + + bb1: { + _4 = move _3; // scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + StorageDead(_3); // scope 0 at $DIR/loops.rs:+1:31: +1:32 + StorageLive(_5); // scope 0 at $DIR/loops.rs:+1:14: +1:32 + _5 = move _4; // scope 0 at $DIR/loops.rs:+1:14: +1:32 + goto -> bb2; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb2: { + StorageLive(_9); // scope 1 at $DIR/loops.rs:+1:14: +1:32 + _6 = &mut _5; // scope 1 at $DIR/loops.rs:+1:14: +1:32 + StorageLive(_7); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + _7 = &mut ((*_6).0: impl Iterator); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + StorageLive(_8); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + _8 = &mut ((*_6).1: impl Fn(T) -> Option); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + _9 = as Iterator>::find_map:: Option>(move _7, move _8) -> [return: bb3, unwind: bb9]; // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut impl Iterator, &mut impl Fn(T) -> Option) -> Option { as Iterator>::find_map:: Option>}, val: Value() } + } + + bb3: { + StorageDead(_8); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + StorageDead(_7); // scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL + _10 = discriminant(_9); // scope 1 at $DIR/loops.rs:+1:14: +1:32 + switchInt(move _10) -> [0: bb4, 1: bb6, otherwise: bb8]; // scope 1 at $DIR/loops.rs:+1:14: +1:32 + } + + bb4: { + StorageDead(_9); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + drop(_5) -> bb5; // scope 0 at $DIR/loops.rs:+3:5: +3:6 + } + + bb5: { + StorageDead(_5); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + StorageDead(_4); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + return; // scope 0 at $DIR/loops.rs:+4:2: +4:2 + } + + bb6: { + _11 = move ((_9 as Some).0: U); // scope 1 at $DIR/loops.rs:+1:9: +1:10 + _12 = opaque::(move _11) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 + // mir::Constant + // + span: $DIR/loops.rs:20:9: 20:15 + // + literal: Const { ty: fn(U) {opaque::}, val: Value() } + } + + bb7: { + StorageDead(_9); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + goto -> bb2; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb8: { + unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:32 + } + + bb9 (cleanup): { + drop(_5) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/loops.rs:+3:5: +3:6 + } + + bb10 (cleanup): { + resume; // scope 0 at $DIR/loops.rs:+0:1: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir new file mode 100644 index 0000000000000..93a34e1ebdefb --- /dev/null +++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir @@ -0,0 +1,91 @@ +// MIR for `mapped` after PreCodegen + +fn mapped(_1: impl Iterator, _2: impl Fn(T) -> U) -> () { + debug iter => _1; // in scope 0 at $DIR/loops.rs:+0:21: +0:25 + debug f => _2; // in scope 0 at $DIR/loops.rs:+0:52: +0:53 + let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:72: +0:72 + let mut _3: std::iter::Map, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + let mut _4: std::iter::Map, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + let mut _5: std::iter::Map, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + let mut _6: &mut std::iter::Map, impl Fn(T) -> U>; // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + let mut _7: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + let mut _8: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 + let _10: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:25 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/loops.rs:+1:14: +1:25 + let _9: U; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 + scope 2 { + debug x => _9; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 + } + } + scope 3 (inlined , impl Fn(T) -> U> as IntoIterator>::into_iter) { // at $DIR/loops.rs:13:14: 13:25 + debug self => _3; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_4); // scope 0 at $DIR/loops.rs:+1:14: +1:25 + StorageLive(_3); // scope 0 at $DIR/loops.rs:+1:14: +1:25 + _3 = as Iterator>::map:: U>(move _1, move _2) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:25 + // mir::Constant + // + span: $DIR/loops.rs:13:19: 13:22 + // + literal: Const { ty: fn(impl Iterator, impl Fn(T) -> U) -> Map, impl Fn(T) -> U> { as Iterator>::map:: U>}, val: Value() } + } + + bb1: { + _4 = move _3; // scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + StorageDead(_3); // scope 0 at $DIR/loops.rs:+1:24: +1:25 + StorageLive(_5); // scope 0 at $DIR/loops.rs:+1:14: +1:25 + _5 = move _4; // scope 0 at $DIR/loops.rs:+1:14: +1:25 + goto -> bb2; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb2: { + StorageLive(_7); // scope 1 at $DIR/loops.rs:+1:14: +1:25 + _6 = &mut _5; // scope 1 at $DIR/loops.rs:+1:14: +1:25 + _7 = , impl Fn(T) -> U> as Iterator>::next(_6) -> [return: bb3, unwind: bb9]; // scope 1 at $DIR/loops.rs:+1:14: +1:25 + // mir::Constant + // + span: $DIR/loops.rs:13:14: 13:25 + // + literal: Const { ty: for<'a> fn(&'a mut Map, impl Fn(T) -> U>) -> Option<, impl Fn(T) -> U> as Iterator>::Item> {, impl Fn(T) -> U> as Iterator>::next}, val: Value() } + } + + bb3: { + _8 = discriminant(_7); // scope 1 at $DIR/loops.rs:+1:14: +1:25 + switchInt(move _8) -> [0: bb4, 1: bb6, otherwise: bb8]; // scope 1 at $DIR/loops.rs:+1:14: +1:25 + } + + bb4: { + StorageDead(_7); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + drop(_5) -> bb5; // scope 0 at $DIR/loops.rs:+3:5: +3:6 + } + + bb5: { + StorageDead(_5); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + StorageDead(_4); // scope 0 at $DIR/loops.rs:+3:5: +3:6 + return; // scope 0 at $DIR/loops.rs:+4:2: +4:2 + } + + bb6: { + _9 = move ((_7 as Some).0: U); // scope 1 at $DIR/loops.rs:+1:9: +1:10 + _10 = opaque::(move _9) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 + // mir::Constant + // + span: $DIR/loops.rs:14:9: 14:15 + // + literal: Const { ty: fn(U) {opaque::}, val: Value() } + } + + bb7: { + StorageDead(_7); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + goto -> bb2; // scope 1 at $DIR/loops.rs:+1:5: +3:6 + } + + bb8: { + unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:25 + } + + bb9 (cleanup): { + drop(_5) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/loops.rs:+3:5: +3:6 + } + + bb10 (cleanup): { + resume; // scope 0 at $DIR/loops.rs:+0:1: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs index a09fcd9c990ed..605cf9a324d17 100644 --- a/tests/mir-opt/pre-codegen/loops.rs +++ b/tests/mir-opt/pre-codegen/loops.rs @@ -9,32 +9,15 @@ pub fn int_range(start: usize, end: usize) { } } -pub fn vec_range(mut v: Vec) { - for i in 0..v.len() { - let x = &mut v[i]; - opaque((i, x)) - } - for i in 0..v.len() { - let x = &v[i]; - opaque((i, x)) - } -} - -pub fn vec_iter(mut v: Vec) { - for x in v.iter_mut() { - opaque(x) - } - for x in v.iter() { +pub fn mapped(iter: impl Iterator, f: impl Fn(T) -> U) { + for x in iter.map(f) { opaque(x) } } -pub fn vec_iter_enumerate(mut v: Vec) { - for (i, x) in v.iter_mut().enumerate() { - opaque((i, x)) - } - for (i, x) in v.iter().enumerate() { - opaque((i, x)) +pub fn filter_mapped(iter: impl Iterator, f: impl Fn(T) -> Option) { + for x in iter.filter_map(f) { + opaque(x) } } @@ -48,7 +31,6 @@ pub fn vec_move(mut v: Vec) { fn opaque(_: impl Sized) {} // EMIT_MIR loops.int_range.PreCodegen.after.mir -// EMIT_MIR loops.vec_range.PreCodegen.after.mir -// EMIT_MIR loops.vec_iter.PreCodegen.after.mir -// EMIT_MIR loops.vec_iter_enumerate.PreCodegen.after.mir +// EMIT_MIR loops.mapped.PreCodegen.after.mir +// EMIT_MIR loops.filter_mapped.PreCodegen.after.mir // EMIT_MIR loops.vec_move.PreCodegen.after.mir diff --git a/tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir deleted file mode 100644 index 5fdd0363f3c9b..0000000000000 --- a/tests/mir-opt/pre-codegen/loops.vec_iter.PreCodegen.after.mir +++ /dev/null @@ -1,570 +0,0 @@ -// MIR for `vec_iter` after PreCodegen - -fn vec_iter(_1: Vec) -> () { - debug v => _1; // in scope 0 at $DIR/loops.rs:+0:17: +0:22 - let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:41: +0:41 - let mut _2: &mut std::vec::Vec; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _14: &mut [impl Sized]; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _26: std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _27: std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _28: &mut std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _29: std::option::Option<&mut impl Sized>; // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - let mut _30: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 - let mut _31: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let _43: &[impl Sized]; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let mut _54: std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let mut _55: std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let mut _56: &mut std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let mut _57: std::option::Option<&impl Sized>; // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let mut _58: isize; // in scope 0 at $DIR/loops.rs:+4:5: +6:6 - let _60: (); // in scope 0 at $DIR/loops.rs:+4:14: +4:22 - let _62: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:26 - scope 1 { - debug iter => _27; // in scope 1 at $DIR/loops.rs:+1:14: +1:26 - let _61: &mut impl Sized; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 - scope 2 { - debug x => _61; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 - } - } - scope 3 { - debug iter => _55; // in scope 3 at $DIR/loops.rs:+4:14: +4:22 - let _59: &impl Sized; // in scope 3 at $DIR/loops.rs:+4:9: +4:10 - scope 4 { - debug x => _59; // in scope 4 at $DIR/loops.rs:+4:9: +4:10 - } - } - scope 5 (inlined as DerefMut>::deref_mut) { // at $DIR/loops.rs:24:14: 24:26 - debug self => _2; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _7: *mut impl Sized; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _8: usize; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 6 { - scope 7 (inlined Vec::::as_mut_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _2; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _3: &alloc::raw_vec::RawVec; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 8 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _3; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - let mut _4: std::ptr::Unique; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - scope 9 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - debug self => _4; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - let mut _5: std::ptr::NonNull; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - scope 10 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - debug self => _5; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _6: *const impl Sized; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - } - } - } - } - scope 11 (inlined std::slice::from_raw_parts_mut::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug data => _7; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _8; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _13: *mut [impl Sized]; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _63: *mut impl Sized; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - let mut _64: usize; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 12 { - scope 13 (inlined std::slice::from_raw_parts_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug data => _63; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug len => _64; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 14 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _64; // in scope 14 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 15 { - debug max_len => const _; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - } - } - scope 16 (inlined slice_from_raw_parts_mut::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug data => _7; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug len => _8; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _9: *mut (); // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 17 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug self => _7; // in scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - scope 18 (inlined std::ptr::from_raw_parts_mut::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug data_address => _9; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - debug metadata => _8; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _10: *const (); // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _11: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _12: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - scope 19 { - } - } - } - } - } - } - } - scope 20 (inlined core::slice::::iter_mut) { // at $DIR/loops.rs:24:16: 24:26 - debug self => _14; // in scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - scope 21 (inlined std::slice::IterMut::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL - debug slice => _14; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let _16: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _17: bool; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _18: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _19: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _21: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _22: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _24: std::ptr::NonNull; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _25: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 22 { - debug ptr => _16; // in scope 22 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 23 { - let _20: *mut impl Sized; // in scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 24 { - debug end => _20; // in scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 30 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug ptr => _16; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _23: *const impl Sized; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _65: *mut impl Sized; // in scope 30 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 31 { - scope 32 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug ptr => _65; // in scope 32 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 33 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - debug self => _65; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _66: *mut u8; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 34 { - scope 35 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _66; // in scope 35 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 36 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _66; // in scope 36 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 37 { - scope 38 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _66; // in scope 38 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - } - } - } - } - } - } - } - } - } - scope 26 (inlined invalid_mut::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug addr => _22; // in scope 26 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 27 { - } - } - scope 28 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _16; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug count => _19; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 29 { - } - } - } - } - scope 25 (inlined core::slice::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _14; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _15: *mut [impl Sized]; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - } - } - } - scope 39 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:24:14: 24:26 - debug self => _26; // in scope 39 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - scope 40 (inlined as Deref>::deref) { // at $DIR/loops.rs:27:14: 27:22 - debug self => _31; // in scope 40 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _37: *const impl Sized; // in scope 40 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _38: usize; // in scope 40 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 41 { - scope 42 (inlined Vec::::as_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _31; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _32: &alloc::raw_vec::RawVec; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _36: *mut impl Sized; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 43 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _32; // in scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - let mut _33: std::ptr::Unique; // in scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - scope 44 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - debug self => _33; // in scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - let mut _34: std::ptr::NonNull; // in scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - scope 45 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - debug self => _34; // in scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _35: *const impl Sized; // in scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - } - } - } - } - scope 46 (inlined std::slice::from_raw_parts::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug data => _37; // in scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _38; // in scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let _42: *const [impl Sized]; // in scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _67: *const impl Sized; // in scope 46 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - let mut _68: usize; // in scope 46 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 47 { - scope 48 (inlined std::slice::from_raw_parts::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug data => _67; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug len => _68; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 49 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _68; // in scope 49 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 50 { - debug max_len => const _; // in scope 50 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - } - } - scope 51 (inlined slice_from_raw_parts::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug data => _37; // in scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug len => _38; // in scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _39: *const (); // in scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 52 (inlined ptr::const_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug self => _37; // in scope 52 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - } - scope 53 (inlined std::ptr::from_raw_parts::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug data_address => _39; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - debug metadata => _38; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _40: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _41: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - scope 54 { - } - } - } - } - } - } - } - scope 55 (inlined core::slice::::iter) { // at $DIR/loops.rs:27:16: 27:22 - debug self => _43; // in scope 55 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - scope 56 (inlined std::slice::Iter::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL - debug slice => _43; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let _45: *const impl Sized; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _46: bool; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _47: usize; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _49: usize; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _50: *mut impl Sized; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _52: std::ptr::NonNull; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _53: *const impl Sized; // in scope 56 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 57 { - debug ptr => _45; // in scope 57 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 58 { - let _48: *const impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 59 { - debug end => _48; // in scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 65 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug ptr => _50; // in scope 65 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _51: *const impl Sized; // in scope 65 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _69: *mut impl Sized; // in scope 65 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 66 { - scope 67 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug ptr => _69; // in scope 67 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 68 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - debug self => _69; // in scope 68 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _70: *mut u8; // in scope 68 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 69 { - scope 70 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _70; // in scope 70 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 71 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _70; // in scope 71 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 72 { - scope 73 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _70; // in scope 73 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - } - } - } - } - } - } - } - } - } - scope 61 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug addr => _49; // in scope 61 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 62 { - } - } - scope 63 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _45; // in scope 63 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - debug count => _47; // in scope 63 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - scope 64 { - } - } - } - } - scope 60 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _43; // in scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _44: *const [impl Sized]; // in scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - } - } - } - scope 74 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:27:14: 27:22 - debug self => _54; // in scope 74 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - - bb0: { - StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:14: +1:26 - _2 = &mut _1; // scope 0 at $DIR/loops.rs:+1:14: +1:26 - StorageLive(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _3 = &((*_2).0: alloc::raw_vec::RawVec); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _4 = ((*_3).0: std::ptr::Unique); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageLive(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - _5 = (_4.0: std::ptr::NonNull); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageLive(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _6 = (_5.0: *const impl Sized); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _7 = move _6 as *mut impl Sized (PtrToPtr); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageDead(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageDead(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _8 = ((*_2).1: usize); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_63); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_64); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageLive(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _9 = _7 as *mut () (PtrToPtr); // scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageLive(_12); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _10 = _9 as *const () (Pointer(MutToConstPointer)); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _11 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: move _10, metadata: _8 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _12 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _11 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _13 = (_12.1: *mut [impl Sized]); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_12); // scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _14 = &mut (*_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_13); // scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_64); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_63); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_2); // scope 0 at $DIR/loops.rs:+1:14: +1:15 - StorageLive(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _15 = &raw mut (*_14); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _16 = move _15 as *mut impl Sized (PtrToPtr); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _17 = const _; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - switchInt(move _17) -> [0: bb1, otherwise: bb2]; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb1: { - StorageLive(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _18 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _19 = Len((*_18)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _20 = Offset(_16, _19); // scope 29 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageDead(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb2: { - StorageLive(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _21 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _22 = Len((*_21)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _20 = _22 as *mut impl Sized (Transmute); // scope 27 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb3: { - StorageDead(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_65); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_66); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _23 = _16 as *const impl Sized (Pointer(MutToConstPointer)); // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _24 = NonNull:: { pointer: _23 }; // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_66); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_65); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _25 = _20; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _26 = std::slice::IterMut::<'_, impl Sized> { ptr: move _24, end: move _25, _marker: const ZeroSized: PhantomData<&mut impl Sized> }; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: PhantomData<&mut impl Sized>, val: Value() } - // adt - // + user_ty: UserType(1) - StorageDead(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_27); // scope 0 at $DIR/loops.rs:+1:14: +1:26 - _27 = move _26; // scope 0 at $DIR/loops.rs:+1:14: +1:26 - goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 - } - - bb4: { - StorageLive(_29); // scope 1 at $DIR/loops.rs:+1:14: +1:26 - _28 = &mut _27; // scope 1 at $DIR/loops.rs:+1:14: +1:26 - _29 = as Iterator>::next(_28) -> [return: bb5, unwind: bb19]; // scope 1 at $DIR/loops.rs:+1:14: +1:26 - // mir::Constant - // + span: $DIR/loops.rs:24:14: 24:26 - // + literal: Const { ty: for<'a> fn(&'a mut std::slice::IterMut<'_, impl Sized>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } - } - - bb5: { - _30 = discriminant(_29); // scope 1 at $DIR/loops.rs:+1:14: +1:26 - switchInt(move _30) -> [0: bb6, 1: bb16, otherwise: bb18]; // scope 1 at $DIR/loops.rs:+1:14: +1:26 - } - - bb6: { - StorageDead(_29); // scope 1 at $DIR/loops.rs:+3:5: +3:6 - StorageDead(_27); // scope 0 at $DIR/loops.rs:+3:5: +3:6 - StorageLive(_31); // scope 0 at $DIR/loops.rs:+4:14: +4:22 - _31 = &_1; // scope 0 at $DIR/loops.rs:+4:14: +4:22 - StorageLive(_37); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_36); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_32); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _32 = &((*_31).0: alloc::raw_vec::RawVec); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_33); // scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _33 = ((*_32).0: std::ptr::Unique); // scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageLive(_34); // scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - _34 = (_33.0: std::ptr::NonNull); // scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageLive(_35); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _35 = (_34.0: *const impl Sized); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _36 = move _35 as *mut impl Sized (PtrToPtr); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_35); // scope 45 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_34); // scope 44 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageDead(_33); // scope 43 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _37 = move _36 as *const impl Sized (Pointer(MutToConstPointer)); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_32); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_36); // scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_38); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _38 = ((*_31).1: usize); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_67); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_68); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_42); // scope 47 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageLive(_39); // scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _39 = _37 as *const () (PtrToPtr); // scope 52 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - StorageLive(_41); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_40); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _40 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: _39, metadata: _38 }; // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _41 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _40 }; // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_40); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _42 = (_41.0: *const [impl Sized]); // scope 54 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_41); // scope 53 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_39); // scope 51 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _43 = &(*_42); // scope 47 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_42); // scope 46 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_68); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_67); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_38); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_37); // scope 41 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_31); // scope 0 at $DIR/loops.rs:+4:14: +4:15 - StorageLive(_45); // scope 55 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_44); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _44 = &raw const (*_43); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _45 = move _44 as *const impl Sized (PtrToPtr); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_44); // scope 60 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_48); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_46); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _46 = const _; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - switchInt(move _46) -> [0: bb7, otherwise: bb8]; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb7: { - StorageLive(_47); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _47 = Len((*_43)); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _48 = Offset(_45, _47); // scope 64 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - StorageDead(_47); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb9; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb8: { - StorageLive(_49); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _49 = Len((*_43)); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _48 = _49 as *const impl Sized (Transmute); // scope 62 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_49); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb9; // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb9: { - StorageDead(_46); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_52); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_50); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _50 = _45 as *mut impl Sized (PtrToPtr); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_51); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_69); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_70); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _51 = _50 as *const impl Sized (Pointer(MutToConstPointer)); // scope 66 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _52 = NonNull:: { pointer: _51 }; // scope 66 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_70); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_69); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_51); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_50); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_53); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _53 = _48; // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _54 = std::slice::Iter::<'_, impl Sized> { ptr: move _52, end: move _53, _marker: const ZeroSized: PhantomData<&impl Sized> }; // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: PhantomData<&impl Sized>, val: Value() } - // adt - // + user_ty: UserType(1) - StorageDead(_53); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_52); // scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_48); // scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_45); // scope 55 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_55); // scope 0 at $DIR/loops.rs:+4:14: +4:22 - _55 = move _54; // scope 0 at $DIR/loops.rs:+4:14: +4:22 - goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 - } - - bb10: { - StorageLive(_57); // scope 3 at $DIR/loops.rs:+4:14: +4:22 - _56 = &mut _55; // scope 3 at $DIR/loops.rs:+4:14: +4:22 - _57 = as Iterator>::next(_56) -> [return: bb11, unwind: bb19]; // scope 3 at $DIR/loops.rs:+4:14: +4:22 - // mir::Constant - // + span: $DIR/loops.rs:27:14: 27:22 - // + literal: Const { ty: for<'a> fn(&'a mut std::slice::Iter<'_, impl Sized>) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } - } - - bb11: { - _58 = discriminant(_57); // scope 3 at $DIR/loops.rs:+4:14: +4:22 - switchInt(move _58) -> [0: bb12, 1: bb14, otherwise: bb18]; // scope 3 at $DIR/loops.rs:+4:14: +4:22 - } - - bb12: { - StorageDead(_57); // scope 3 at $DIR/loops.rs:+6:5: +6:6 - StorageDead(_55); // scope 0 at $DIR/loops.rs:+6:5: +6:6 - drop(_1) -> bb13; // scope 0 at $DIR/loops.rs:+7:1: +7:2 - } - - bb13: { - return; // scope 0 at $DIR/loops.rs:+7:2: +7:2 - } - - bb14: { - _59 = ((_57 as Some).0: &impl Sized); // scope 3 at $DIR/loops.rs:+4:9: +4:10 - _60 = opaque::<&impl Sized>(_59) -> [return: bb15, unwind: bb19]; // scope 4 at $DIR/loops.rs:+5:9: +5:18 - // mir::Constant - // + span: $DIR/loops.rs:28:9: 28:15 - // + literal: Const { ty: fn(&impl Sized) {opaque::<&impl Sized>}, val: Value() } - } - - bb15: { - StorageDead(_57); // scope 3 at $DIR/loops.rs:+6:5: +6:6 - goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 - } - - bb16: { - _61 = move ((_29 as Some).0: &mut impl Sized); // scope 1 at $DIR/loops.rs:+1:9: +1:10 - _62 = opaque::<&mut impl Sized>(move _61) -> [return: bb17, unwind: bb19]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 - // mir::Constant - // + span: $DIR/loops.rs:25:9: 25:15 - // + literal: Const { ty: fn(&mut impl Sized) {opaque::<&mut impl Sized>}, val: Value() } - } - - bb17: { - StorageDead(_29); // scope 1 at $DIR/loops.rs:+3:5: +3:6 - goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 - } - - bb18: { - unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:26 - } - - bb19 (cleanup): { - drop(_1) -> [return: bb20, unwind terminate]; // scope 0 at $DIR/loops.rs:+7:1: +7:2 - } - - bb20 (cleanup): { - resume; // scope 0 at $DIR/loops.rs:+0:1: +7:2 - } -} diff --git a/tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir deleted file mode 100644 index 7cc982bfea00a..0000000000000 --- a/tests/mir-opt/pre-codegen/loops.vec_iter_enumerate.PreCodegen.after.mir +++ /dev/null @@ -1,604 +0,0 @@ -// MIR for `vec_iter_enumerate` after PreCodegen - -fn vec_iter_enumerate(_1: Vec) -> () { - debug v => _1; // in scope 0 at $DIR/loops.rs:+0:27: +0:32 - let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:51: +0:51 - let mut _2: &mut std::vec::Vec; // in scope 0 at $DIR/loops.rs:+1:19: +1:31 - let mut _14: &mut [impl Sized]; // in scope 0 at $DIR/loops.rs:+1:19: +1:31 - let mut _26: std::slice::IterMut<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+1:19: +1:31 - let mut _27: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 - let mut _28: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 - let mut _29: &mut std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 - let mut _30: std::option::Option<(usize, &mut impl Sized)>; // in scope 0 at $DIR/loops.rs:+1:19: +1:43 - let mut _31: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 - let mut _32: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+4:19: +4:27 - let _44: &[impl Sized]; // in scope 0 at $DIR/loops.rs:+4:19: +4:27 - let mut _55: std::slice::Iter<'_, impl Sized>; // in scope 0 at $DIR/loops.rs:+4:19: +4:27 - let mut _56: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 - let mut _57: std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 - let mut _58: &mut std::iter::Enumerate>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 - let mut _59: std::option::Option<(usize, &impl Sized)>; // in scope 0 at $DIR/loops.rs:+4:19: +4:39 - let mut _60: isize; // in scope 0 at $DIR/loops.rs:+4:5: +6:6 - let mut _63: (usize, &impl Sized); // in scope 0 at $DIR/loops.rs:+5:16: +5:22 - let _64: (); // in scope 0 at $DIR/loops.rs:+4:19: +4:39 - let mut _67: (usize, &mut impl Sized); // in scope 0 at $DIR/loops.rs:+2:16: +2:22 - let _68: (); // in scope 0 at $DIR/loops.rs:+1:19: +1:43 - scope 1 { - debug iter => _28; // in scope 1 at $DIR/loops.rs:+1:19: +1:43 - let _65: usize; // in scope 1 at $DIR/loops.rs:+1:10: +1:11 - let _66: &mut impl Sized; // in scope 1 at $DIR/loops.rs:+1:13: +1:14 - scope 2 { - debug i => _65; // in scope 2 at $DIR/loops.rs:+1:10: +1:11 - debug x => _66; // in scope 2 at $DIR/loops.rs:+1:13: +1:14 - } - } - scope 3 { - debug iter => _57; // in scope 3 at $DIR/loops.rs:+4:19: +4:39 - let _61: usize; // in scope 3 at $DIR/loops.rs:+4:10: +4:11 - let _62: &impl Sized; // in scope 3 at $DIR/loops.rs:+4:13: +4:14 - scope 4 { - debug i => _61; // in scope 4 at $DIR/loops.rs:+4:10: +4:11 - debug x => _62; // in scope 4 at $DIR/loops.rs:+4:13: +4:14 - } - } - scope 5 (inlined as DerefMut>::deref_mut) { // at $DIR/loops.rs:33:19: 33:31 - debug self => _2; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _7: *mut impl Sized; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _8: usize; // in scope 5 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 6 { - scope 7 (inlined Vec::::as_mut_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _2; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _3: &alloc::raw_vec::RawVec; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 8 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _3; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - let mut _4: std::ptr::Unique; // in scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - scope 9 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - debug self => _4; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - let mut _5: std::ptr::NonNull; // in scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - scope 10 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - debug self => _5; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _6: *const impl Sized; // in scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - } - } - } - } - scope 11 (inlined std::slice::from_raw_parts_mut::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug data => _7; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _8; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _13: *mut [impl Sized]; // in scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _69: *mut impl Sized; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - let mut _70: usize; // in scope 11 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 12 { - scope 13 (inlined std::slice::from_raw_parts_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug data => _69; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug len => _70; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 14 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _70; // in scope 14 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 15 { - debug max_len => const _; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - } - } - scope 16 (inlined slice_from_raw_parts_mut::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug data => _7; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug len => _8; // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _9: *mut (); // in scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 17 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug self => _7; // in scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - scope 18 (inlined std::ptr::from_raw_parts_mut::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug data_address => _9; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - debug metadata => _8; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _10: *const (); // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _11: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _12: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - scope 19 { - } - } - } - } - } - } - } - scope 20 (inlined core::slice::::iter_mut) { // at $DIR/loops.rs:33:21: 33:31 - debug self => _14; // in scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - scope 21 (inlined std::slice::IterMut::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL - debug slice => _14; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let _16: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _17: bool; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _18: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _19: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _21: &[impl Sized]; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _22: usize; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _24: std::ptr::NonNull; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _25: *mut impl Sized; // in scope 21 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 22 { - debug ptr => _16; // in scope 22 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 23 { - let _20: *mut impl Sized; // in scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 24 { - debug end => _20; // in scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 30 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug ptr => _16; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _23: *const impl Sized; // in scope 30 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _71: *mut impl Sized; // in scope 30 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 31 { - scope 32 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug ptr => _71; // in scope 32 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 33 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - debug self => _71; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _72: *mut u8; // in scope 33 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 34 { - scope 35 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _72; // in scope 35 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 36 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _72; // in scope 36 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 37 { - scope 38 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _72; // in scope 38 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - } - } - } - } - } - } - } - } - } - scope 26 (inlined invalid_mut::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug addr => _22; // in scope 26 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 27 { - } - } - scope 28 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _16; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug count => _19; // in scope 28 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 29 { - } - } - } - } - scope 25 (inlined core::slice::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _14; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _15: *mut [impl Sized]; // in scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - } - } - } - scope 39 (inlined as Iterator>::enumerate) { // at $DIR/loops.rs:33:32: 33:43 - debug self => _26; // in scope 39 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - scope 40 (inlined Enumerate::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - debug iter => _26; // in scope 40 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL - } - } - scope 41 (inlined > as IntoIterator>::into_iter) { // at $DIR/loops.rs:33:19: 33:43 - debug self => _27; // in scope 41 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - scope 42 (inlined as Deref>::deref) { // at $DIR/loops.rs:36:19: 36:27 - debug self => _32; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _38: *const impl Sized; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _39: usize; // in scope 42 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 43 { - scope 44 (inlined Vec::::as_ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _32; // in scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _33: &alloc::raw_vec::RawVec; // in scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - let mut _37: *mut impl Sized; // in scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - scope 45 (inlined alloc::raw_vec::RawVec::::ptr) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug self => _33; // in scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - let mut _34: std::ptr::Unique; // in scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - scope 46 (inlined Unique::::as_ptr) { // at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - debug self => _34; // in scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - let mut _35: std::ptr::NonNull; // in scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - scope 47 (inlined NonNull::::as_ptr) { // at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - debug self => _35; // in scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _36: *const impl Sized; // in scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - } - } - } - } - scope 48 (inlined std::slice::from_raw_parts::<'_, impl Sized>) { // at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - debug data => _38; // in scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _39; // in scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let _43: *const [impl Sized]; // in scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - let mut _73: *const impl Sized; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - let mut _74: usize; // in scope 48 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 49 { - scope 50 (inlined std::slice::from_raw_parts::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug data => _73; // in scope 50 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug len => _74; // in scope 50 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 51 (inlined intrinsics::is_valid_allocation_size::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug len => _74; // in scope 51 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 52 { - debug max_len => const _; // in scope 52 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - } - } - scope 53 (inlined slice_from_raw_parts::) { // at $SRC_DIR/core/src/slice/raw.rs:LL:COL - debug data => _38; // in scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug len => _39; // in scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _40: *const (); // in scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 54 (inlined ptr::const_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug self => _38; // in scope 54 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - } - scope 55 (inlined std::ptr::from_raw_parts::<[impl Sized]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug data_address => _40; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - debug metadata => _39; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _41: std::ptr::metadata::PtrComponents<[impl Sized]>; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _42: std::ptr::metadata::PtrRepr<[impl Sized]>; // in scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - scope 56 { - } - } - } - } - } - } - } - scope 57 (inlined core::slice::::iter) { // at $DIR/loops.rs:36:21: 36:27 - debug self => _44; // in scope 57 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - scope 58 (inlined std::slice::Iter::<'_, impl Sized>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL - debug slice => _44; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let _46: *const impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _47: bool; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _48: usize; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _50: usize; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _51: *mut impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _53: std::ptr::NonNull; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - let mut _54: *const impl Sized; // in scope 58 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 59 { - debug ptr => _46; // in scope 59 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 60 { - let _49: *const impl Sized; // in scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 61 { - debug end => _49; // in scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - scope 67 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug ptr => _51; // in scope 67 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _52: *const impl Sized; // in scope 67 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _75: *mut impl Sized; // in scope 67 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 68 { - scope 69 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug ptr => _75; // in scope 69 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - scope 70 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - debug self => _75; // in scope 70 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _76: *mut u8; // in scope 70 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 71 { - scope 72 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _76; // in scope 72 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 73 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _76; // in scope 73 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - scope 74 { - scope 75 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _76; // in scope 75 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - } - } - } - } - } - } - } - } - } - } - scope 63 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug addr => _50; // in scope 63 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - scope 64 { - } - } - scope 65 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _46; // in scope 65 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - debug count => _48; // in scope 65 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - scope 66 { - } - } - } - } - scope 62 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL - debug self => _44; // in scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _45: *const [impl Sized]; // in scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - } - } - } - scope 76 (inlined as Iterator>::enumerate) { // at $DIR/loops.rs:36:28: 36:39 - debug self => _55; // in scope 76 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - scope 77 (inlined Enumerate::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL - debug iter => _55; // in scope 77 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL - } - } - scope 78 (inlined > as IntoIterator>::into_iter) { // at $DIR/loops.rs:36:19: 36:39 - debug self => _56; // in scope 78 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - - bb0: { - StorageLive(_26); // scope 0 at $DIR/loops.rs:+1:19: +1:31 - StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:19: +1:31 - _2 = &mut _1; // scope 0 at $DIR/loops.rs:+1:19: +1:31 - StorageLive(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _3 = &((*_2).0: alloc::raw_vec::RawVec); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _4 = ((*_3).0: std::ptr::Unique); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageLive(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - _5 = (_4.0: std::ptr::NonNull); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageLive(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _6 = (_5.0: *const impl Sized); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _7 = move _6 as *mut impl Sized (PtrToPtr); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_6); // scope 10 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_5); // scope 9 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageDead(_4); // scope 8 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageDead(_3); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _8 = ((*_2).1: usize); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_69); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_70); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageLive(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _9 = _7 as *mut () (PtrToPtr); // scope 17 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageLive(_12); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _10 = _9 as *const () (Pointer(MutToConstPointer)); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _11 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: move _10, metadata: _8 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_10); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _12 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _11 }; // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_11); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _13 = (_12.1: *mut [impl Sized]); // scope 19 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_12); // scope 18 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_9); // scope 16 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _14 = &mut (*_13); // scope 12 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_13); // scope 11 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_70); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_69); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_8); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_7); // scope 6 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_2); // scope 0 at $DIR/loops.rs:+1:19: +1:20 - StorageLive(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _15 = &raw mut (*_14); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _16 = move _15 as *mut impl Sized (PtrToPtr); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_15); // scope 25 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _17 = const _; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - switchInt(move _17) -> [0: bb1, otherwise: bb2]; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb1: { - StorageLive(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _18 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _19 = Len((*_18)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_18); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _20 = Offset(_16, _19); // scope 29 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageDead(_19); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb2: { - StorageLive(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _21 = &(*_14); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _22 = Len((*_21)); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_21); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _20 = _22 as *mut impl Sized (Transmute); // scope 27 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_22); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb3; // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb3: { - StorageDead(_17); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_71); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_72); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _23 = _16 as *const impl Sized (Pointer(MutToConstPointer)); // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _24 = NonNull:: { pointer: _23 }; // scope 31 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_72); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_71); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_23); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _25 = _20; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _26 = std::slice::IterMut::<'_, impl Sized> { ptr: move _24, end: move _25, _marker: const ZeroSized: PhantomData<&mut impl Sized> }; // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: PhantomData<&mut impl Sized>, val: Value() } - // adt - // + user_ty: UserType(1) - StorageDead(_25); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_24); // scope 24 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_20); // scope 23 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_16); // scope 20 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _27 = Enumerate::> { iter: move _26, count: const 0_usize }; // scope 40 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL - StorageDead(_26); // scope 0 at $DIR/loops.rs:+1:42: +1:43 - StorageLive(_28); // scope 0 at $DIR/loops.rs:+1:19: +1:43 - _28 = move _27; // scope 0 at $DIR/loops.rs:+1:19: +1:43 - goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 - } - - bb4: { - StorageLive(_30); // scope 1 at $DIR/loops.rs:+1:19: +1:43 - _29 = &mut _28; // scope 1 at $DIR/loops.rs:+1:19: +1:43 - _30 = > as Iterator>::next(_29) -> [return: bb5, unwind: bb19]; // scope 1 at $DIR/loops.rs:+1:19: +1:43 - // mir::Constant - // + span: $DIR/loops.rs:33:19: 33:43 - // + literal: Const { ty: for<'a> fn(&'a mut Enumerate>) -> Option<> as Iterator>::Item> {> as Iterator>::next}, val: Value() } - } - - bb5: { - _31 = discriminant(_30); // scope 1 at $DIR/loops.rs:+1:19: +1:43 - switchInt(move _31) -> [0: bb6, 1: bb16, otherwise: bb18]; // scope 1 at $DIR/loops.rs:+1:19: +1:43 - } - - bb6: { - StorageDead(_30); // scope 1 at $DIR/loops.rs:+3:5: +3:6 - StorageDead(_28); // scope 0 at $DIR/loops.rs:+3:5: +3:6 - StorageLive(_55); // scope 0 at $DIR/loops.rs:+4:19: +4:27 - StorageLive(_32); // scope 0 at $DIR/loops.rs:+4:19: +4:27 - _32 = &_1; // scope 0 at $DIR/loops.rs:+4:19: +4:27 - StorageLive(_38); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_37); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_33); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _33 = &((*_32).0: alloc::raw_vec::RawVec); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_34); // scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _34 = ((*_33).0: std::ptr::Unique); // scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - StorageLive(_35); // scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - _35 = (_34.0: std::ptr::NonNull); // scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageLive(_36); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _36 = (_35.0: *const impl Sized); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _37 = move _36 as *mut impl Sized (PtrToPtr); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_36); // scope 47 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_35); // scope 46 at $SRC_DIR/core/src/ptr/unique.rs:LL:COL - StorageDead(_34); // scope 45 at $SRC_DIR/alloc/src/raw_vec.rs:LL:COL - _38 = move _37 as *const impl Sized (Pointer(MutToConstPointer)); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_33); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_37); // scope 44 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_39); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - _39 = ((*_32).1: usize); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_73); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_74); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageLive(_43); // scope 49 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageLive(_40); // scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _40 = _38 as *const () (PtrToPtr); // scope 54 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - StorageLive(_42); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageLive(_41); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _41 = ptr::metadata::PtrComponents::<[impl Sized]> { data_address: _40, metadata: _39 }; // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _42 = ptr::metadata::PtrRepr::<[impl Sized]> { const_ptr: move _41 }; // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_41); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _43 = (_42.0: *const [impl Sized]); // scope 56 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_42); // scope 55 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_40); // scope 53 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _44 = &(*_43); // scope 49 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_43); // scope 48 at $SRC_DIR/core/src/slice/raw.rs:LL:COL - StorageDead(_74); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_73); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_39); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_38); // scope 43 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_32); // scope 0 at $DIR/loops.rs:+4:19: +4:20 - StorageLive(_46); // scope 57 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_45); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _45 = &raw const (*_44); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _46 = move _45 as *const impl Sized (PtrToPtr); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_45); // scope 62 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_49); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_47); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _47 = const _; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - switchInt(move _47) -> [0: bb7, otherwise: bb8]; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb7: { - StorageLive(_48); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _48 = Len((*_44)); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _49 = Offset(_46, _48); // scope 66 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL - StorageDead(_48); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb9; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb8: { - StorageLive(_50); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _50 = Len((*_44)); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _49 = _50 as *const impl Sized (Transmute); // scope 64 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_50); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - goto -> bb9; // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - } - - bb9: { - StorageDead(_47); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_53); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_51); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _51 = _46 as *mut impl Sized (PtrToPtr); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_52); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_75); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_76); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _52 = _51 as *const impl Sized (Pointer(MutToConstPointer)); // scope 68 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - _53 = NonNull:: { pointer: _52 }; // scope 68 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_76); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_75); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_52); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_51); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_54); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _54 = _49; // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - _55 = std::slice::Iter::<'_, impl Sized> { ptr: move _53, end: move _54, _marker: const ZeroSized: PhantomData<&impl Sized> }; // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: PhantomData<&impl Sized>, val: Value() } - // adt - // + user_ty: UserType(1) - StorageDead(_54); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_53); // scope 61 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_49); // scope 60 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageDead(_46); // scope 57 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _56 = Enumerate::> { iter: move _55, count: const 0_usize }; // scope 77 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL - StorageDead(_55); // scope 0 at $DIR/loops.rs:+4:38: +4:39 - StorageLive(_57); // scope 0 at $DIR/loops.rs:+4:19: +4:39 - _57 = move _56; // scope 0 at $DIR/loops.rs:+4:19: +4:39 - goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 - } - - bb10: { - StorageLive(_59); // scope 3 at $DIR/loops.rs:+4:19: +4:39 - _58 = &mut _57; // scope 3 at $DIR/loops.rs:+4:19: +4:39 - _59 = > as Iterator>::next(_58) -> [return: bb11, unwind: bb19]; // scope 3 at $DIR/loops.rs:+4:19: +4:39 - // mir::Constant - // + span: $DIR/loops.rs:36:19: 36:39 - // + literal: Const { ty: for<'a> fn(&'a mut Enumerate>) -> Option<> as Iterator>::Item> {> as Iterator>::next}, val: Value() } - } - - bb11: { - _60 = discriminant(_59); // scope 3 at $DIR/loops.rs:+4:19: +4:39 - switchInt(move _60) -> [0: bb12, 1: bb14, otherwise: bb18]; // scope 3 at $DIR/loops.rs:+4:19: +4:39 - } - - bb12: { - StorageDead(_59); // scope 3 at $DIR/loops.rs:+6:5: +6:6 - StorageDead(_57); // scope 0 at $DIR/loops.rs:+6:5: +6:6 - drop(_1) -> bb13; // scope 0 at $DIR/loops.rs:+7:1: +7:2 - } - - bb13: { - return; // scope 0 at $DIR/loops.rs:+7:2: +7:2 - } - - bb14: { - _61 = (((_59 as Some).0: (usize, &impl Sized)).0: usize); // scope 3 at $DIR/loops.rs:+4:10: +4:11 - _62 = (((_59 as Some).0: (usize, &impl Sized)).1: &impl Sized); // scope 3 at $DIR/loops.rs:+4:13: +4:14 - StorageLive(_63); // scope 4 at $DIR/loops.rs:+5:16: +5:22 - _63 = (_61, _62); // scope 4 at $DIR/loops.rs:+5:16: +5:22 - _64 = opaque::<(usize, &impl Sized)>(move _63) -> [return: bb15, unwind: bb19]; // scope 4 at $DIR/loops.rs:+5:9: +5:23 - // mir::Constant - // + span: $DIR/loops.rs:37:9: 37:15 - // + literal: Const { ty: fn((usize, &impl Sized)) {opaque::<(usize, &impl Sized)>}, val: Value() } - } - - bb15: { - StorageDead(_63); // scope 4 at $DIR/loops.rs:+5:22: +5:23 - StorageDead(_59); // scope 3 at $DIR/loops.rs:+6:5: +6:6 - goto -> bb10; // scope 3 at $DIR/loops.rs:+4:5: +6:6 - } - - bb16: { - _65 = (((_30 as Some).0: (usize, &mut impl Sized)).0: usize); // scope 1 at $DIR/loops.rs:+1:10: +1:11 - _66 = move (((_30 as Some).0: (usize, &mut impl Sized)).1: &mut impl Sized); // scope 1 at $DIR/loops.rs:+1:13: +1:14 - StorageLive(_67); // scope 2 at $DIR/loops.rs:+2:16: +2:22 - _67 = (_65, move _66); // scope 2 at $DIR/loops.rs:+2:16: +2:22 - _68 = opaque::<(usize, &mut impl Sized)>(move _67) -> [return: bb17, unwind: bb19]; // scope 2 at $DIR/loops.rs:+2:9: +2:23 - // mir::Constant - // + span: $DIR/loops.rs:34:9: 34:15 - // + literal: Const { ty: fn((usize, &mut impl Sized)) {opaque::<(usize, &mut impl Sized)>}, val: Value() } - } - - bb17: { - StorageDead(_67); // scope 2 at $DIR/loops.rs:+2:22: +2:23 - StorageDead(_30); // scope 1 at $DIR/loops.rs:+3:5: +3:6 - goto -> bb4; // scope 1 at $DIR/loops.rs:+1:5: +3:6 - } - - bb18: { - unreachable; // scope 1 at $DIR/loops.rs:+1:19: +1:43 - } - - bb19 (cleanup): { - drop(_1) -> [return: bb20, unwind terminate]; // scope 0 at $DIR/loops.rs:+7:1: +7:2 - } - - bb20 (cleanup): { - resume; // scope 0 at $DIR/loops.rs:+0:1: +7:2 - } -} diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir index a73736291e28d..db2bf3be7d0b3 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -21,7 +21,7 @@ fn vec_move(_1: Vec) -> () { StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:14: +1:15 _2 = as IntoIterator>::into_iter(move _1) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:15 // mir::Constant - // + span: $DIR/loops.rs:42:14: 42:15 + // + span: $DIR/loops.rs:25:14: 25:15 // + literal: Const { ty: fn(Vec) -> as IntoIterator>::IntoIter { as IntoIterator>::into_iter}, val: Value() } } @@ -36,7 +36,7 @@ fn vec_move(_1: Vec) -> () { _4 = &mut _3; // scope 1 at $DIR/loops.rs:+1:14: +1:15 _5 = as Iterator>::next(_4) -> [return: bb3, unwind: bb9]; // scope 1 at $DIR/loops.rs:+1:14: +1:15 // mir::Constant - // + span: $DIR/loops.rs:42:14: 42:15 + // + span: $DIR/loops.rs:25:14: 25:15 // + literal: Const { ty: for<'a> fn(&'a mut std::vec::IntoIter) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } } @@ -60,7 +60,7 @@ fn vec_move(_1: Vec) -> () { _7 = move ((_5 as Some).0: impl Sized); // scope 1 at $DIR/loops.rs:+1:9: +1:10 _8 = opaque::(move _7) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 // mir::Constant - // + span: $DIR/loops.rs:43:9: 43:15 + // + span: $DIR/loops.rs:26:9: 26:15 // + literal: Const { ty: fn(impl Sized) {opaque::}, val: Value() } } diff --git a/tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir deleted file mode 100644 index 020d69a2ef3b4..0000000000000 --- a/tests/mir-opt/pre-codegen/loops.vec_range.PreCodegen.after.mir +++ /dev/null @@ -1,204 +0,0 @@ -// MIR for `vec_range` after PreCodegen - -fn vec_range(_1: Vec) -> () { - debug v => _1; // in scope 0 at $DIR/loops.rs:+0:18: +0:23 - let mut _0: (); // return place in scope 0 at $DIR/loops.rs:+0:42: +0:42 - let mut _2: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+1:17: +1:24 - let mut _3: usize; // in scope 0 at $DIR/loops.rs:+1:17: +1:24 - let mut _4: std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - let mut _5: std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - let mut _6: &mut std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - let mut _7: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - let mut _8: isize; // in scope 0 at $DIR/loops.rs:+1:5: +4:6 - let mut _9: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+5:17: +5:24 - let mut _10: usize; // in scope 0 at $DIR/loops.rs:+5:17: +5:24 - let mut _11: std::ops::Range; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 - let mut _12: std::ops::Range; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 - let mut _13: &mut std::ops::Range; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 - let mut _14: std::option::Option; // in scope 0 at $DIR/loops.rs:+5:14: +5:24 - let mut _15: isize; // in scope 0 at $DIR/loops.rs:+5:5: +8:6 - let mut _17: &std::vec::Vec; // in scope 0 at $DIR/loops.rs:+6:18: +6:19 - let _18: &impl Sized; // in scope 0 at $DIR/loops.rs:+6:18: +6:22 - let mut _20: (usize, &impl Sized); // in scope 0 at $DIR/loops.rs:+7:16: +7:22 - let _21: (); // in scope 0 at $DIR/loops.rs:+5:14: +5:24 - let mut _23: &mut std::vec::Vec; // in scope 0 at $DIR/loops.rs:+2:22: +2:23 - let mut _24: &mut impl Sized; // in scope 0 at $DIR/loops.rs:+2:22: +2:26 - let mut _26: (usize, &mut impl Sized); // in scope 0 at $DIR/loops.rs:+3:16: +3:22 - let _27: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - scope 1 { - debug iter => _5; // in scope 1 at $DIR/loops.rs:+1:14: +1:24 - let _22: usize; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 - scope 2 { - debug i => _22; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 - let _25: &mut impl Sized; // in scope 2 at $DIR/loops.rs:+2:13: +2:14 - scope 3 { - debug x => _25; // in scope 3 at $DIR/loops.rs:+2:13: +2:14 - } - } - scope 9 (inlined iter::range::>::next) { // at $DIR/loops.rs:13:14: 13:24 - debug self => _6; // in scope 9 at $SRC_DIR/core/src/iter/range.rs:LL:COL - } - } - scope 4 { - debug iter => _12; // in scope 4 at $DIR/loops.rs:+5:14: +5:24 - let _16: usize; // in scope 4 at $DIR/loops.rs:+5:9: +5:10 - scope 5 { - debug i => _16; // in scope 5 at $DIR/loops.rs:+5:9: +5:10 - let _19: &impl Sized; // in scope 5 at $DIR/loops.rs:+6:13: +6:14 - scope 6 { - debug x => _19; // in scope 6 at $DIR/loops.rs:+6:13: +6:14 - } - } - scope 12 (inlined iter::range::>::next) { // at $DIR/loops.rs:17:14: 17:24 - debug self => _13; // in scope 12 at $SRC_DIR/core/src/iter/range.rs:LL:COL - } - } - scope 7 (inlined Vec::::len) { // at $DIR/loops.rs:13:19: 13:24 - debug self => _2; // in scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - } - scope 8 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:13:14: 13:24 - debug self => _4; // in scope 8 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - scope 10 (inlined Vec::::len) { // at $DIR/loops.rs:17:19: 17:24 - debug self => _9; // in scope 10 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - } - scope 11 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:17:14: 17:24 - debug self => _11; // in scope 11 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL - } - - bb0: { - StorageLive(_3); // scope 0 at $DIR/loops.rs:+1:17: +1:24 - StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:17: +1:24 - _2 = &_1; // scope 0 at $DIR/loops.rs:+1:17: +1:24 - _3 = ((*_2).1: usize); // scope 7 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_2); // scope 0 at $DIR/loops.rs:+1:23: +1:24 - _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; // scope 0 at $DIR/loops.rs:+1:14: +1:24 - StorageDead(_3); // scope 0 at $DIR/loops.rs:+1:23: +1:24 - StorageLive(_5); // scope 0 at $DIR/loops.rs:+1:14: +1:24 - _5 = move _4; // scope 0 at $DIR/loops.rs:+1:14: +1:24 - goto -> bb1; // scope 1 at $DIR/loops.rs:+1:5: +4:6 - } - - bb1: { - StorageLive(_7); // scope 1 at $DIR/loops.rs:+1:14: +1:24 - _6 = &mut _5; // scope 1 at $DIR/loops.rs:+1:14: +1:24 - _7 = as iter::range::RangeIteratorImpl>::spec_next(_6) -> [return: bb2, unwind: bb15]; // scope 9 at $SRC_DIR/core/src/iter/range.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL - // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } - } - - bb2: { - _8 = discriminant(_7); // scope 1 at $DIR/loops.rs:+1:14: +1:24 - switchInt(move _8) -> [0: bb3, 1: bb11, otherwise: bb14]; // scope 1 at $DIR/loops.rs:+1:14: +1:24 - } - - bb3: { - StorageDead(_7); // scope 1 at $DIR/loops.rs:+4:5: +4:6 - StorageDead(_5); // scope 0 at $DIR/loops.rs:+4:5: +4:6 - StorageLive(_10); // scope 0 at $DIR/loops.rs:+5:17: +5:24 - StorageLive(_9); // scope 0 at $DIR/loops.rs:+5:17: +5:24 - _9 = &_1; // scope 0 at $DIR/loops.rs:+5:17: +5:24 - _10 = ((*_9).1: usize); // scope 10 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL - StorageDead(_9); // scope 0 at $DIR/loops.rs:+5:23: +5:24 - _11 = std::ops::Range:: { start: const 0_usize, end: move _10 }; // scope 0 at $DIR/loops.rs:+5:14: +5:24 - StorageDead(_10); // scope 0 at $DIR/loops.rs:+5:23: +5:24 - StorageLive(_12); // scope 0 at $DIR/loops.rs:+5:14: +5:24 - _12 = move _11; // scope 0 at $DIR/loops.rs:+5:14: +5:24 - goto -> bb4; // scope 4 at $DIR/loops.rs:+5:5: +8:6 - } - - bb4: { - StorageLive(_14); // scope 4 at $DIR/loops.rs:+5:14: +5:24 - _13 = &mut _12; // scope 4 at $DIR/loops.rs:+5:14: +5:24 - _14 = as iter::range::RangeIteratorImpl>::spec_next(_13) -> [return: bb5, unwind: bb15]; // scope 12 at $SRC_DIR/core/src/iter/range.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL - // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } - } - - bb5: { - _15 = discriminant(_14); // scope 4 at $DIR/loops.rs:+5:14: +5:24 - switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb14]; // scope 4 at $DIR/loops.rs:+5:14: +5:24 - } - - bb6: { - StorageDead(_14); // scope 4 at $DIR/loops.rs:+8:5: +8:6 - StorageDead(_12); // scope 0 at $DIR/loops.rs:+8:5: +8:6 - drop(_1) -> bb7; // scope 0 at $DIR/loops.rs:+9:1: +9:2 - } - - bb7: { - return; // scope 0 at $DIR/loops.rs:+9:2: +9:2 - } - - bb8: { - _16 = ((_14 as Some).0: usize); // scope 4 at $DIR/loops.rs:+5:9: +5:10 - StorageLive(_18); // scope 5 at $DIR/loops.rs:+6:18: +6:22 - StorageLive(_17); // scope 5 at $DIR/loops.rs:+6:18: +6:19 - _17 = &_1; // scope 5 at $DIR/loops.rs:+6:18: +6:19 - _18 = as Index>::index(move _17, _16) -> [return: bb9, unwind: bb15]; // scope 5 at $DIR/loops.rs:+6:18: +6:22 - // mir::Constant - // + span: $DIR/loops.rs:18:18: 18:22 - // + literal: Const { ty: for<'a> fn(&'a Vec, usize) -> &'a as Index>::Output { as Index>::index}, val: Value() } - } - - bb9: { - StorageDead(_17); // scope 5 at $DIR/loops.rs:+6:21: +6:22 - _19 = _18; // scope 5 at $DIR/loops.rs:+6:17: +6:22 - StorageLive(_20); // scope 6 at $DIR/loops.rs:+7:16: +7:22 - _20 = (_16, _19); // scope 6 at $DIR/loops.rs:+7:16: +7:22 - _21 = opaque::<(usize, &impl Sized)>(move _20) -> [return: bb10, unwind: bb15]; // scope 6 at $DIR/loops.rs:+7:9: +7:23 - // mir::Constant - // + span: $DIR/loops.rs:19:9: 19:15 - // + literal: Const { ty: fn((usize, &impl Sized)) {opaque::<(usize, &impl Sized)>}, val: Value() } - } - - bb10: { - StorageDead(_20); // scope 6 at $DIR/loops.rs:+7:22: +7:23 - StorageDead(_18); // scope 5 at $DIR/loops.rs:+8:5: +8:6 - StorageDead(_14); // scope 4 at $DIR/loops.rs:+8:5: +8:6 - goto -> bb4; // scope 4 at $DIR/loops.rs:+5:5: +8:6 - } - - bb11: { - _22 = ((_7 as Some).0: usize); // scope 1 at $DIR/loops.rs:+1:9: +1:10 - StorageLive(_24); // scope 2 at $DIR/loops.rs:+2:22: +2:26 - StorageLive(_23); // scope 2 at $DIR/loops.rs:+2:22: +2:23 - _23 = &mut _1; // scope 2 at $DIR/loops.rs:+2:22: +2:23 - _24 = as IndexMut>::index_mut(move _23, _22) -> [return: bb12, unwind: bb15]; // scope 2 at $DIR/loops.rs:+2:22: +2:26 - // mir::Constant - // + span: $DIR/loops.rs:14:22: 14:26 - // + literal: Const { ty: for<'a> fn(&'a mut Vec, usize) -> &'a mut as Index>::Output { as IndexMut>::index_mut}, val: Value() } - } - - bb12: { - StorageDead(_23); // scope 2 at $DIR/loops.rs:+2:25: +2:26 - _25 = _24; // scope 2 at $DIR/loops.rs:+2:17: +2:26 - StorageLive(_26); // scope 3 at $DIR/loops.rs:+3:16: +3:22 - _26 = (_22, move _25); // scope 3 at $DIR/loops.rs:+3:16: +3:22 - _27 = opaque::<(usize, &mut impl Sized)>(move _26) -> [return: bb13, unwind: bb15]; // scope 3 at $DIR/loops.rs:+3:9: +3:23 - // mir::Constant - // + span: $DIR/loops.rs:15:9: 15:15 - // + literal: Const { ty: fn((usize, &mut impl Sized)) {opaque::<(usize, &mut impl Sized)>}, val: Value() } - } - - bb13: { - StorageDead(_26); // scope 3 at $DIR/loops.rs:+3:22: +3:23 - StorageDead(_24); // scope 2 at $DIR/loops.rs:+4:5: +4:6 - StorageDead(_7); // scope 1 at $DIR/loops.rs:+4:5: +4:6 - goto -> bb1; // scope 1 at $DIR/loops.rs:+1:5: +4:6 - } - - bb14: { - unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:24 - } - - bb15 (cleanup): { - drop(_1) -> [return: bb16, unwind terminate]; // scope 0 at $DIR/loops.rs:+9:1: +9:2 - } - - bb16 (cleanup): { - resume; // scope 0 at $DIR/loops.rs:+0:1: +9:2 - } -} diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir new file mode 100644 index 0000000000000..25a3421793dab --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir @@ -0,0 +1,216 @@ +// MIR for `enumerated_loop` after PreCodegen + +fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { + debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:31: +0:36 + debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:47: +0:48 + let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:70: +0:70 + let mut _13: std::slice::Iter<'_, T>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:31 + let mut _14: std::iter::Enumerate>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _15: std::iter::Enumerate>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _16: &mut std::iter::Enumerate>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _17: std::option::Option<(usize, &T)>; // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + let mut _18: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +3:6 + let mut _21: &impl Fn(usize, &T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:10 + let mut _22: (usize, &T); // in scope 0 at $DIR/slice_iter.rs:+2:9: +2:16 + let _23: (); // in scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + scope 1 { + debug iter => _15; // in scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + let _19: usize; // in scope 1 at $DIR/slice_iter.rs:+1:10: +1:11 + let _20: &T; // in scope 1 at $DIR/slice_iter.rs:+1:13: +1:14 + scope 2 { + debug i => _19; // in scope 2 at $DIR/slice_iter.rs:+1:10: +1:11 + debug x => _20; // in scope 2 at $DIR/slice_iter.rs:+1:13: +1:14 + } + } + scope 3 (inlined core::slice::::iter) { // at $DIR/slice_iter.rs:42:25: 42:31 + debug self => _1; // in scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + scope 4 (inlined std::slice::Iter::<'_, T>::new) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL + debug slice => _1; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let _4: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _5: bool; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _6: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _8: usize; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _9: *mut T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _11: std::ptr::NonNull; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + let mut _12: *const T; // in scope 4 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 5 { + debug ptr => _4; // in scope 5 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 6 { + let _7: *const T; // in scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 7 { + debug end => _7; // in scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + scope 13 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug ptr => _9; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _10: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + let mut _24: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 14 { + scope 15 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _24; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + scope 16 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + debug self => _24; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _25: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 17 { + scope 18 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _25; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 19 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _25; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + scope 20 { + scope 21 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _25; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + } + } + } + } + } + } + } + } + } + } + scope 9 (inlined invalid::) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug addr => _8; // in scope 9 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + scope 10 { + } + } + scope 11 (inlined ptr::const_ptr::::add) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + debug count => _6; // in scope 11 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + scope 12 { + } + } + } + } + scope 8 (inlined core::slice::::as_ptr) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL + debug self => _1; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _3: *const [T]; // in scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + } + } + } + scope 22 (inlined as Iterator>::enumerate) { // at $DIR/slice_iter.rs:42:32: 42:43 + debug self => _13; // in scope 22 at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + scope 23 (inlined Enumerate::>::new) { // at $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL + debug iter => _13; // in scope 23 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL + } + } + scope 24 (inlined > as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:42:19: 42:43 + debug self => _14; // in scope 24 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_13); // scope 0 at $DIR/slice_iter.rs:+1:19: +1:31 + StorageLive(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _3 = &raw const (*_1); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _4 = move _3 as *const T (PtrToPtr); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_3); // scope 8 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _5 = const _; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb1: { + StorageLive(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _6 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = Offset(_4, _6); // scope 12 at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL + StorageDead(_6); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb2: { + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _8 = Len((*_1)); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _7 = _8 as *const T (Transmute); // scope 10 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + goto -> bb3; // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + } + + bb3: { + StorageDead(_5); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _9 = _4 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_25); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _10 = _9 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + _11 = NonNull:: { pointer: _10 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL + StorageDead(_25); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageLive(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _12 = _7; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + _13 = std::slice::Iter::<'_, T> { ptr: move _11, end: move _12, _marker: const ZeroSized: PhantomData<&T> }; // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + // mir::Constant + // + span: no-location + // + literal: Const { ty: PhantomData<&T>, val: Value() } + // adt + // + user_ty: UserType(1) + StorageDead(_12); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_11); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/slice/iter.rs:LL:COL + StorageDead(_4); // scope 3 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _14 = Enumerate::> { iter: move _13, count: const 0_usize }; // scope 23 at $SRC_DIR/core/src/iter/adapters/enumerate.rs:LL:COL + StorageDead(_13); // scope 0 at $DIR/slice_iter.rs:+1:42: +1:43 + StorageLive(_15); // scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + _15 = move _14; // scope 0 at $DIR/slice_iter.rs:+1:19: +1:43 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb4: { + StorageLive(_17); // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + _16 = &mut _15; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + _17 = > as Iterator>::next(_16) -> [return: bb5, unwind: bb11]; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + // mir::Constant + // + span: $DIR/slice_iter.rs:42:19: 42:43 + // + literal: Const { ty: for<'a> fn(&'a mut Enumerate>) -> Option<> as Iterator>::Item> {> as Iterator>::next}, val: Value() } + } + + bb5: { + _18 = discriminant(_17); // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + switchInt(move _18) -> [0: bb6, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + } + + bb6: { + StorageDead(_17); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + StorageDead(_15); // scope 0 at $DIR/slice_iter.rs:+3:5: +3:6 + drop(_2) -> bb7; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb7: { + return; // scope 0 at $DIR/slice_iter.rs:+4:2: +4:2 + } + + bb8: { + _19 = (((_17 as Some).0: (usize, &T)).0: usize); // scope 1 at $DIR/slice_iter.rs:+1:10: +1:11 + _20 = (((_17 as Some).0: (usize, &T)).1: &T); // scope 1 at $DIR/slice_iter.rs:+1:13: +1:14 + StorageLive(_21); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + _21 = &_2; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:10 + StorageLive(_22); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 + _22 = (_19, _20); // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 + _23 = >::call(move _21, move _22) -> [return: bb9, unwind: bb11]; // scope 2 at $DIR/slice_iter.rs:+2:9: +2:16 + // mir::Constant + // + span: $DIR/slice_iter.rs:43:9: 43:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> >::Output {>::call}, val: Value() } + } + + bb9: { + StorageDead(_22); // scope 2 at $DIR/slice_iter.rs:+2:15: +2:16 + StorageDead(_21); // scope 2 at $DIR/slice_iter.rs:+2:15: +2:16 + StorageDead(_17); // scope 1 at $DIR/slice_iter.rs:+3:5: +3:6 + goto -> bb4; // scope 1 at $DIR/slice_iter.rs:+1:5: +3:6 + } + + bb10: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:19: +1:43 + } + + bb11 (cleanup): { + drop(_2) -> [return: bb12, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+4:1: +4:2 + } + + bb12 (cleanup): { + resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +4:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir new file mode 100644 index 0000000000000..a81bd998d89d0 --- /dev/null +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir @@ -0,0 +1,107 @@ +// MIR for `range_loop` after PreCodegen + +fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { + debug slice => _1; // in scope 0 at $DIR/slice_iter.rs:+0:26: +0:31 + debug f => _2; // in scope 0 at $DIR/slice_iter.rs:+0:42: +0:43 + let mut _0: (); // return place in scope 0 at $DIR/slice_iter.rs:+0:65: +0:65 + let mut _3: usize; // in scope 0 at $DIR/slice_iter.rs:+1:17: +1:28 + let mut _4: std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _5: std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _6: &mut std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _7: std::option::Option; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _8: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +4:6 + let mut _10: usize; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 + let mut _11: bool; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 + let mut _13: &impl Fn(usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:10 + let mut _14: (usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:16 + let _15: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + scope 1 { + debug iter => _5; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + let _9: usize; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + scope 2 { + debug i => _9; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 + let _12: &T; // in scope 2 at $DIR/slice_iter.rs:+2:13: +2:14 + scope 3 { + debug x => _12; // in scope 3 at $DIR/slice_iter.rs:+2:13: +2:14 + } + } + scope 5 (inlined iter::range::>::next) { // at $DIR/slice_iter.rs:49:14: 49:28 + debug self => _6; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + } + scope 4 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:49:14: 49:28 + debug self => _4; // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL + } + + bb0: { + StorageLive(_3); // scope 0 at $DIR/slice_iter.rs:+1:17: +1:28 + _3 = Len((*_1)); // scope 0 at $DIR/slice_iter.rs:+1:17: +1:28 + _4 = std::ops::Range:: { start: const 0_usize, end: move _3 }; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + StorageDead(_3); // scope 0 at $DIR/slice_iter.rs:+1:27: +1:28 + StorageLive(_5); // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + _5 = move _4; // scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +4:6 + } + + bb1: { + StorageLive(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + _6 = &mut _5; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + _7 = as iter::range::RangeIteratorImpl>::spec_next(_6) -> [return: bb2, unwind: bb9]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } + } + + bb2: { + _8 = discriminant(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb8]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + } + + bb3: { + StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 + StorageDead(_5); // scope 0 at $DIR/slice_iter.rs:+4:5: +4:6 + drop(_2) -> bb4; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 + } + + bb4: { + return; // scope 0 at $DIR/slice_iter.rs:+5:2: +5:2 + } + + bb5: { + _9 = ((_7 as Some).0: usize); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + _10 = Len((*_1)); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + _11 = Lt(_9, _10); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + assert(move _11, "index out of bounds: the length is {} but the index is {}", move _10, _9) -> [success: bb6, unwind: bb9]; // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + } + + bb6: { + _12 = &(*_1)[_9]; // scope 2 at $DIR/slice_iter.rs:+2:17: +2:26 + StorageLive(_13); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 + _13 = &_2; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 + StorageLive(_14); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + _14 = (_9, _12); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + _15 = >::call(move _13, move _14) -> [return: bb7, unwind: bb9]; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + // mir::Constant + // + span: $DIR/slice_iter.rs:51:9: 51:10 + // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> >::Output {>::call}, val: Value() } + } + + bb7: { + StorageDead(_14); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 + StorageDead(_13); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 + StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 + goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +4:6 + } + + bb8: { + unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + } + + bb9 (cleanup): { + drop(_2) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 + } + + bb10 (cleanup): { + resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +5:2 + } +} diff --git a/tests/mir-opt/pre-codegen/slice_iter.rs b/tests/mir-opt/pre-codegen/slice_iter.rs index ca423ca55e61f..a1cd85e753f63 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.rs +++ b/tests/mir-opt/pre-codegen/slice_iter.rs @@ -36,3 +36,18 @@ pub fn reverse_loop<'a, T>(slice: &'a [T], f: impl Fn(&T)) { f(x) } } + +// EMIT_MIR slice_iter.enumerated_loop.PreCodegen.after.mir +pub fn enumerated_loop<'a, T>(slice: &'a [T], f: impl Fn(usize, &T)) { + for (i, x) in slice.iter().enumerate() { + f(i, x) + } +} + +// EMIT_MIR slice_iter.range_loop.PreCodegen.after.mir +pub fn range_loop<'a, T>(slice: &'a [T], f: impl Fn(usize, &T)) { + for i in 0..slice.len() { + let x = &slice[i]; + f(i, x) + } +} From 36cae3a3a2291ececa4600727e2e170d113fe1b6 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 17 May 2023 20:26:11 +0000 Subject: [PATCH 07/10] Annotate needs-unwind. --- .../checked_ops.checked_shl.PreCodegen.after.mir | 2 +- .../pre-codegen/checked_ops.ilog2.PreCodegen.after.mir | 2 +- tests/mir-opt/pre-codegen/checked_ops.rs | 1 + .../checked_ops.step_forward.PreCodegen.after.mir | 2 +- .../pre-codegen/loops.filter_mapped.PreCodegen.after.mir | 8 ++++---- .../pre-codegen/loops.int_range.PreCodegen.after.mir | 6 +++--- .../mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir | 8 ++++---- tests/mir-opt/pre-codegen/loops.rs | 1 + .../pre-codegen/loops.vec_move.PreCodegen.after.mir | 6 +++--- 9 files changed, 19 insertions(+), 17 deletions(-) diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir index 75c4c56dd67c7..4dea3b3da52c9 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir @@ -4,7 +4,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option { debug x => _1; // in scope 0 at $DIR/checked_ops.rs:+0:20: +0:21 debug rhs => _2; // in scope 0 at $DIR/checked_ops.rs:+0:28: +0:31 let mut _0: std::option::Option; // return place in scope 0 at $DIR/checked_ops.rs:+0:41: +0:52 - scope 1 (inlined core::num::::checked_shl) { // at $DIR/checked_ops.rs:14:7: 14:23 + scope 1 (inlined core::num::::checked_shl) { // at $DIR/checked_ops.rs:15:7: 15:23 debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL let mut _13: (u32, bool); // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL diff --git a/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir index fc7626cce1785..b0a16e923b8b3 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir @@ -3,7 +3,7 @@ fn ilog2(_1: u32) -> u32 { debug x => _1; // in scope 0 at $DIR/checked_ops.rs:+0:14: +0:15 let mut _0: u32; // return place in scope 0 at $DIR/checked_ops.rs:+0:25: +0:28 - scope 1 (inlined #[track_caller] core::num::::ilog2) { // at $DIR/checked_ops.rs:19:7: 19:14 + scope 1 (inlined #[track_caller] core::num::::ilog2) { // at $DIR/checked_ops.rs:20:7: 20:14 debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL let mut _2: std::option::Option; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL let mut _3: isize; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs index 5a751362c09f3..0e6c9596efaa6 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.rs +++ b/tests/mir-opt/pre-codegen/checked_ops.rs @@ -1,4 +1,5 @@ // compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 +// needs-unwind // ignore-debug #![crate_type = "lib"] 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 d61aac7d73bde..dead767d20e00 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 @@ -4,7 +4,7 @@ fn step_forward(_1: u32, _2: usize) -> u32 { debug x => _1; // in scope 0 at $DIR/checked_ops.rs:+0:21: +0:22 debug n => _2; // in scope 0 at $DIR/checked_ops.rs:+0:29: +0:30 let mut _0: u32; // return place in scope 0 at $DIR/checked_ops.rs:+0:42: +0:45 - scope 1 (inlined ::forward) { // at $DIR/checked_ops.rs:9:5: 9:35 + scope 1 (inlined ::forward) { // at $DIR/checked_ops.rs:10:5: 10:35 debug start => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL debug n => _2; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL let _3: std::option::Option; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL 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 ab07b05353602..dce9feddfc570 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 @@ -17,13 +17,13 @@ fn filter_mapped(_1: impl Iterator, _2: impl Fn(T) -> Option) -> () scope 2 { debug x => _11; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 } - scope 4 (inlined , impl Fn(T) -> Option> as Iterator>::next) { // at $DIR/loops.rs:19:14: 19:32 + scope 4 (inlined , impl Fn(T) -> Option> as Iterator>::next) { // at $DIR/loops.rs:20:14: 20:32 debug self => _6; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL let mut _7: &mut impl Iterator; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL let mut _8: &mut impl Fn(T) -> Option; // in scope 4 at $SRC_DIR/core/src/iter/adapters/filter_map.rs:LL:COL } } - scope 3 (inlined , impl Fn(T) -> Option> as IntoIterator>::into_iter) { // at $DIR/loops.rs:19:14: 19:32 + scope 3 (inlined , impl Fn(T) -> Option> as IntoIterator>::into_iter) { // at $DIR/loops.rs:20:14: 20:32 debug self => _3; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } @@ -32,7 +32,7 @@ fn filter_mapped(_1: impl Iterator, _2: impl Fn(T) -> Option) -> () StorageLive(_3); // scope 0 at $DIR/loops.rs:+1:14: +1:32 _3 = as Iterator>::filter_map:: Option>(move _1, move _2) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:32 // mir::Constant - // + span: $DIR/loops.rs:19:19: 19:29 + // + span: $DIR/loops.rs:20:19: 20:29 // + literal: Const { ty: fn(impl Iterator, impl Fn(T) -> Option) -> FilterMap, impl Fn(T) -> Option> { as Iterator>::filter_map:: Option>}, val: Value() } } @@ -79,7 +79,7 @@ fn filter_mapped(_1: impl Iterator, _2: impl Fn(T) -> Option) -> () _11 = move ((_9 as Some).0: U); // scope 1 at $DIR/loops.rs:+1:9: +1:10 _12 = opaque::(move _11) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 // mir::Constant - // + span: $DIR/loops.rs:20:9: 20:15 + // + span: $DIR/loops.rs:21:9: 21:15 // + literal: Const { ty: fn(U) {opaque::}, val: Value() } } 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 78e5502f39d64..12245ccf00059 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 @@ -16,11 +16,11 @@ fn int_range(_1: usize, _2: usize) -> () { scope 2 { debug i => _8; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 } - scope 4 (inlined iter::range::>::next) { // at $DIR/loops.rs:7:14: 7:24 + scope 4 (inlined iter::range::>::next) { // at $DIR/loops.rs:8:14: 8:24 debug self => _5; // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL } } - scope 3 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:7:14: 7:24 + scope 3 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:8:14: 8:24 debug self => _3; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } @@ -55,7 +55,7 @@ fn int_range(_1: usize, _2: usize) -> () { _8 = ((_6 as Some).0: usize); // scope 1 at $DIR/loops.rs:+1:9: +1:10 _9 = opaque::(_8) -> bb5; // scope 2 at $DIR/loops.rs:+2:9: +2:18 // mir::Constant - // + span: $DIR/loops.rs:8:9: 8:15 + // + span: $DIR/loops.rs:9:9: 9:15 // + literal: Const { ty: fn(usize) {opaque::}, val: Value() } } 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 93a34e1ebdefb..bf1380b30ff2a 100644 --- a/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.mapped.PreCodegen.after.mir @@ -18,7 +18,7 @@ fn mapped(_1: impl Iterator, _2: impl Fn(T) -> U) -> () { debug x => _9; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 } } - scope 3 (inlined , impl Fn(T) -> U> as IntoIterator>::into_iter) { // at $DIR/loops.rs:13:14: 13:25 + scope 3 (inlined , impl Fn(T) -> U> as IntoIterator>::into_iter) { // at $DIR/loops.rs:14:14: 14:25 debug self => _3; // in scope 3 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL } @@ -27,7 +27,7 @@ fn mapped(_1: impl Iterator, _2: impl Fn(T) -> U) -> () { StorageLive(_3); // scope 0 at $DIR/loops.rs:+1:14: +1:25 _3 = as Iterator>::map:: U>(move _1, move _2) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:25 // mir::Constant - // + span: $DIR/loops.rs:13:19: 13:22 + // + span: $DIR/loops.rs:14:19: 14:22 // + literal: Const { ty: fn(impl Iterator, impl Fn(T) -> U) -> Map, impl Fn(T) -> U> { as Iterator>::map:: U>}, val: Value() } } @@ -44,7 +44,7 @@ fn mapped(_1: impl Iterator, _2: impl Fn(T) -> U) -> () { _6 = &mut _5; // scope 1 at $DIR/loops.rs:+1:14: +1:25 _7 = , impl Fn(T) -> U> as Iterator>::next(_6) -> [return: bb3, unwind: bb9]; // scope 1 at $DIR/loops.rs:+1:14: +1:25 // mir::Constant - // + span: $DIR/loops.rs:13:14: 13:25 + // + span: $DIR/loops.rs:14:14: 14:25 // + literal: Const { ty: for<'a> fn(&'a mut Map, impl Fn(T) -> U>) -> Option<, impl Fn(T) -> U> as Iterator>::Item> {, impl Fn(T) -> U> as Iterator>::next}, val: Value() } } @@ -68,7 +68,7 @@ fn mapped(_1: impl Iterator, _2: impl Fn(T) -> U) -> () { _9 = move ((_7 as Some).0: U); // scope 1 at $DIR/loops.rs:+1:9: +1:10 _10 = opaque::(move _9) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 // mir::Constant - // + span: $DIR/loops.rs:14:9: 14:15 + // + span: $DIR/loops.rs:15:9: 15:15 // + literal: Const { ty: fn(U) {opaque::}, val: Value() } } diff --git a/tests/mir-opt/pre-codegen/loops.rs b/tests/mir-opt/pre-codegen/loops.rs index 605cf9a324d17..67f549a511c8a 100644 --- a/tests/mir-opt/pre-codegen/loops.rs +++ b/tests/mir-opt/pre-codegen/loops.rs @@ -1,4 +1,5 @@ // compile-flags: -O -Zmir-opt-level=2 -g +// needs-unwind // ignore-debug #![crate_type = "lib"] diff --git a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir index db2bf3be7d0b3..6cd5a66de00fc 100644 --- a/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/loops.vec_move.PreCodegen.after.mir @@ -21,7 +21,7 @@ fn vec_move(_1: Vec) -> () { StorageLive(_2); // scope 0 at $DIR/loops.rs:+1:14: +1:15 _2 = as IntoIterator>::into_iter(move _1) -> bb1; // scope 0 at $DIR/loops.rs:+1:14: +1:15 // mir::Constant - // + span: $DIR/loops.rs:25:14: 25:15 + // + span: $DIR/loops.rs:26:14: 26:15 // + literal: Const { ty: fn(Vec) -> as IntoIterator>::IntoIter { as IntoIterator>::into_iter}, val: Value() } } @@ -36,7 +36,7 @@ fn vec_move(_1: Vec) -> () { _4 = &mut _3; // scope 1 at $DIR/loops.rs:+1:14: +1:15 _5 = as Iterator>::next(_4) -> [return: bb3, unwind: bb9]; // scope 1 at $DIR/loops.rs:+1:14: +1:15 // mir::Constant - // + span: $DIR/loops.rs:25:14: 25:15 + // + span: $DIR/loops.rs:26:14: 26:15 // + literal: Const { ty: for<'a> fn(&'a mut std::vec::IntoIter) -> Option< as Iterator>::Item> { as Iterator>::next}, val: Value() } } @@ -60,7 +60,7 @@ fn vec_move(_1: Vec) -> () { _7 = move ((_5 as Some).0: impl Sized); // scope 1 at $DIR/loops.rs:+1:9: +1:10 _8 = opaque::(move _7) -> [return: bb7, unwind: bb9]; // scope 2 at $DIR/loops.rs:+2:9: +2:18 // mir::Constant - // + span: $DIR/loops.rs:26:9: 26:15 + // + span: $DIR/loops.rs:27:9: 27:15 // + literal: Const { ty: fn(impl Sized) {opaque::}, val: Value() } } From b90e1657449ca0a0c0907709f67276c7c583f3de Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 21 May 2023 07:57:26 +0000 Subject: [PATCH 08/10] Restrict test to x64. --- .../pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir | 2 +- .../mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir | 2 +- tests/mir-opt/pre-codegen/checked_ops.rs | 1 + .../pre-codegen/checked_ops.step_forward.PreCodegen.after.mir | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir index 4dea3b3da52c9..369a299b7bc18 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir @@ -4,7 +4,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option { debug x => _1; // in scope 0 at $DIR/checked_ops.rs:+0:20: +0:21 debug rhs => _2; // in scope 0 at $DIR/checked_ops.rs:+0:28: +0:31 let mut _0: std::option::Option; // return place in scope 0 at $DIR/checked_ops.rs:+0:41: +0:52 - scope 1 (inlined core::num::::checked_shl) { // at $DIR/checked_ops.rs:15:7: 15:23 + scope 1 (inlined core::num::::checked_shl) { // at $DIR/checked_ops.rs:16:7: 16:23 debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL let mut _13: (u32, bool); // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL diff --git a/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir index b0a16e923b8b3..12be98640a718 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir @@ -3,7 +3,7 @@ fn ilog2(_1: u32) -> u32 { debug x => _1; // in scope 0 at $DIR/checked_ops.rs:+0:14: +0:15 let mut _0: u32; // return place in scope 0 at $DIR/checked_ops.rs:+0:25: +0:28 - scope 1 (inlined #[track_caller] core::num::::ilog2) { // at $DIR/checked_ops.rs:20:7: 20:14 + scope 1 (inlined #[track_caller] core::num::::ilog2) { // at $DIR/checked_ops.rs:21:7: 21:14 debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL let mut _2: std::option::Option; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL let mut _3: isize; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs index 0e6c9596efaa6..47681c5fa202a 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.rs +++ b/tests/mir-opt/pre-codegen/checked_ops.rs @@ -1,6 +1,7 @@ // compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 // needs-unwind // ignore-debug +// only-x86_64 #![crate_type = "lib"] #![feature(step_trait)] 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 dead767d20e00..78f68e8ffe674 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 @@ -4,7 +4,7 @@ fn step_forward(_1: u32, _2: usize) -> u32 { debug x => _1; // in scope 0 at $DIR/checked_ops.rs:+0:21: +0:22 debug n => _2; // in scope 0 at $DIR/checked_ops.rs:+0:29: +0:30 let mut _0: u32; // return place in scope 0 at $DIR/checked_ops.rs:+0:42: +0:45 - scope 1 (inlined ::forward) { // at $DIR/checked_ops.rs:10:5: 10:35 + scope 1 (inlined ::forward) { // at $DIR/checked_ops.rs:11:5: 11:35 debug start => _1; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL debug n => _2; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL let _3: std::option::Option; // in scope 1 at $SRC_DIR/core/src/iter/range.rs:LL:COL From 1ad37804a62ef2a1a8f613cca349bacc8fb510f0 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 24 May 2023 18:24:25 +0000 Subject: [PATCH 09/10] Remove brittle test. --- .../checked_ops.ilog2.PreCodegen.after.mir | 41 ------------------- tests/mir-opt/pre-codegen/checked_ops.rs | 5 --- 2 files changed, 46 deletions(-) delete mode 100644 tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir diff --git a/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir deleted file mode 100644 index 12be98640a718..0000000000000 --- a/tests/mir-opt/pre-codegen/checked_ops.ilog2.PreCodegen.after.mir +++ /dev/null @@ -1,41 +0,0 @@ -// MIR for `ilog2` after PreCodegen - -fn ilog2(_1: u32) -> u32 { - debug x => _1; // in scope 0 at $DIR/checked_ops.rs:+0:14: +0:15 - let mut _0: u32; // return place in scope 0 at $DIR/checked_ops.rs:+0:25: +0:28 - scope 1 (inlined #[track_caller] core::num::::ilog2) { // at $DIR/checked_ops.rs:21:7: 21:14 - debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _2: std::option::Option; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _3: isize; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _4: !; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - scope 2 { - debug log => _0; // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - } - } - - bb0: { - StorageLive(_2); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - _2 = core::num::::checked_ilog2(_1) -> bb1; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - // + literal: Const { ty: fn(u32) -> Option {core::num::::checked_ilog2}, val: Value() } - } - - bb1: { - _3 = discriminant(_2); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - switchInt(move _3) -> [1: bb2, otherwise: bb3]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - } - - bb2: { - _0 = ((_2 as Some).0: u32); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageDead(_2); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - return; // scope 0 at $DIR/checked_ops.rs:+2:2: +2:2 - } - - bb3: { - _4 = core::num::int_log10::panic_for_nonpositive_argument(); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - // + literal: Const { ty: fn() -> ! {core::num::int_log10::panic_for_nonpositive_argument}, val: Value() } - } -} diff --git a/tests/mir-opt/pre-codegen/checked_ops.rs b/tests/mir-opt/pre-codegen/checked_ops.rs index 47681c5fa202a..dee43b0c6f885 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.rs +++ b/tests/mir-opt/pre-codegen/checked_ops.rs @@ -15,8 +15,3 @@ pub fn step_forward(x: u32, n: usize) -> u32 { pub fn checked_shl(x: u32, rhs: u32) -> Option { x.checked_shl(rhs) } - -// EMIT_MIR checked_ops.ilog2.PreCodegen.after.mir -pub fn ilog2(x: u32) -> u32 { - x.ilog2() -} From d796c600ad53392c47dd5db3257612c0cb29d88a Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Thu, 1 Jun 2023 06:08:25 +0000 Subject: [PATCH 10/10] Rebase fallout. --- ...ined_comparison.naive.PreCodegen.after.mir | 135 ++++++++---------- ...ecked_ops.checked_shl.PreCodegen.after.mir | 114 +++++++-------- .../loops.int_range.PreCodegen.after.mir | 82 ++++++++--- ...variant_a-{closure#0}.PreCodegen.after.mir | 89 ++++++------ ...variant_b-{closure#0}.PreCodegen.after.mir | 47 +++--- ..._iter.enumerated_loop.PreCodegen.after.mir | 15 +- ...slice_iter.range_loop.PreCodegen.after.mir | 124 +++++++++++----- 7 files changed, 334 insertions(+), 272 deletions(-) diff --git a/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir index 837962a6aa31d..26ce7fda4ed01 100644 --- a/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/chained_comparison.naive.PreCodegen.after.mir @@ -7,26 +7,26 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool { let mut _3: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22 let mut _4: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42 let mut _5: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43 - let mut _6: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 - let mut _7: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22 - let mut _8: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35 - let mut _9: bool; // in scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36 - let mut _10: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 - let mut _11: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29 - let mut _12: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49 - let mut _13: bool; // in scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50 - let mut _14: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 - let mut _15: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26 - let mut _16: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43 - let mut _17: bool; // in scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44 + let mut _6: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22 + let mut _7: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35 + let mut _8: bool; // in scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36 + let mut _9: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + let mut _10: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29 + let mut _11: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49 + let mut _12: bool; // in scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50 + let mut _13: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + let mut _14: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26 + let mut _15: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43 + let mut _16: bool; // in scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44 + let mut _17: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 let mut _18: u32; // in scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22 let mut _19: u32; // in scope 0 at $DIR/chained_comparison.rs:+5:26: +5:35 let mut _20: bool; // in scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36 bb0: { - StorageLive(_14); // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 - StorageLive(_10); // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 - StorageLive(_6); // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + StorageLive(_17); // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 + StorageLive(_13); // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + StorageLive(_9); // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 StorageLive(_5); // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43 StorageLive(_3); // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22 _3 = ((*_1).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22 @@ -39,83 +39,74 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool { } bb1: { - _6 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 + StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 goto -> bb3; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 } bb2: { - StorageLive(_9); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36 - StorageLive(_7); // scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22 - _7 = ((*_1).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22 - StorageLive(_8); // scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35 - _8 = ((*_2).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35 - _9 = Eq(move _7, move _8); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36 - StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 + StorageLive(_8); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36 + StorageLive(_6); // scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22 + _6 = ((*_1).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22 + StorageLive(_7); // scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35 + _7 = ((*_2).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35 + _8 = Eq(move _6, move _7); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36 StorageDead(_7); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 - _6 = move _9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 - goto -> bb3; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + StorageDead(_6); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 + _9 = move _8; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36 + StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 + StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 + switchInt(move _9) -> [0: bb3, otherwise: bb4]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 } bb3: { - StorageDead(_9); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 - StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36 - switchInt(move _6) -> [0: bb4, otherwise: bb5]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + StorageDead(_12); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 + StorageDead(_9); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 + goto -> bb5; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 } bb4: { - _10 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 - goto -> bb6; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + StorageLive(_12); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50 + StorageLive(_10); // scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29 + _10 = ((*_1).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29 + StorageLive(_11); // scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49 + _11 = ((*_2).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49 + _12 = Eq(move _10, move _11); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50 + StorageDead(_11); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 + StorageDead(_10); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 + _13 = move _12; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + StorageDead(_12); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 + StorageDead(_9); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 + switchInt(move _13) -> [0: bb5, otherwise: bb6]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 } bb5: { - StorageLive(_13); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50 - StorageLive(_11); // scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29 - _11 = ((*_1).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29 - StorageLive(_12); // scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49 - _12 = ((*_2).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49 - _13 = Eq(move _11, move _12); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50 - StorageDead(_12); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 - StorageDead(_11); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 - _10 = move _13; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 - goto -> bb6; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50 + StorageDead(_16); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 + StorageDead(_13); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 + goto -> bb7; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 } bb6: { - StorageDead(_13); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 - StorageDead(_6); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50 - switchInt(move _10) -> [0: bb7, otherwise: bb8]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 - } - - bb7: { - _14 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 - goto -> bb9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 - } - - bb8: { - StorageLive(_17); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44 - StorageLive(_15); // scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26 - _15 = ((*_1).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26 - StorageLive(_16); // scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43 - _16 = ((*_2).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43 - _17 = Eq(move _15, move _16); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44 - StorageDead(_16); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 + StorageLive(_16); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44 + StorageLive(_14); // scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26 + _14 = ((*_1).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26 + StorageLive(_15); // scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43 + _15 = ((*_2).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43 + _16 = Eq(move _14, move _15); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44 StorageDead(_15); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 - _14 = move _17; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 - goto -> bb9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 - } - - bb9: { - StorageDead(_17); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 - StorageDead(_10); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 - switchInt(move _14) -> [0: bb10, otherwise: bb11]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 + StorageDead(_14); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 + _17 = move _16; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44 + StorageDead(_16); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 + StorageDead(_13); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44 + switchInt(move _17) -> [0: bb7, otherwise: bb8]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 } - bb10: { + bb7: { _0 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 - goto -> bb12; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 + goto -> bb9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 } - bb11: { + bb8: { StorageLive(_20); // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36 StorageLive(_18); // scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22 _18 = ((*_1).4: u32); // scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22 @@ -125,12 +116,12 @@ fn naive(_1: &Blueprint, _2: &Blueprint) -> bool { StorageDead(_19); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36 StorageDead(_18); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36 _0 = move _20; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 - goto -> bb12; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 + goto -> bb9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36 } - bb12: { + bb9: { StorageDead(_20); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36 - StorageDead(_14); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36 + StorageDead(_17); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36 return; // scope 0 at $DIR/chained_comparison.rs:+6:2: +6:2 } } diff --git a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir index 369a299b7bc18..55945bbc8fcc0 100644 --- a/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/checked_ops.checked_shl.PreCodegen.after.mir @@ -7,19 +7,17 @@ fn checked_shl(_1: u32, _2: u32) -> Option { scope 1 (inlined core::num::::checked_shl) { // at $DIR/checked_ops.rs:16:7: 16:23 debug self => _1; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _13: (u32, bool); // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let _14: u32; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let _15: bool; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _16: bool; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _11: u32; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _12: bool; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 2 { - debug a => _14; // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - debug b => _15; // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug a => _11; // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + debug b => _10; // in scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL } scope 3 (inlined core::num::::overflowing_shl) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug self => _1; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug rhs => _2; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _11: u32; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _12: bool; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _9: u32; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _10: bool; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL scope 4 (inlined core::num::::wrapping_shl) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug self => _1; // in scope 4 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug rhs => _2; // in scope 4 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL @@ -29,39 +27,37 @@ fn checked_shl(_1: u32, _2: u32) -> Option { scope 6 (inlined core::num::::unchecked_shl) { // at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug self => _1; // in scope 6 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL debug rhs => _4; // in scope 6 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - let mut _5: (u32,); // in scope 6 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _6: u32; // in scope 6 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _10: u32; // in scope 6 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _8: u32; // in scope 6 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 7 { scope 8 (inlined core::num::::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug x => _6; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _7: std::result::Result; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _9: std::option::Option; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL + debug x => _4; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _5: std::result::Result; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _7: std::option::Option; // in scope 8 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 9 { scope 10 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _6; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug self => _4; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL scope 11 (inlined >::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL - debug value => _6; // in scope 11 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug value => _4; // in scope 11 at $SRC_DIR/core/src/convert/mod.rs:LL:COL scope 21 (inlined >::into) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL - debug self => _6; // in scope 21 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug self => _4; // in scope 21 at $SRC_DIR/core/src/convert/mod.rs:LL:COL scope 22 (inlined >::from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL - debug t => _6; // in scope 22 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + debug t => _4; // in scope 22 at $SRC_DIR/core/src/convert/mod.rs:LL:COL } } } } scope 12 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _7; // in scope 12 at $SRC_DIR/core/src/result.rs:LL:COL - let _8: u32; // in scope 12 at $SRC_DIR/core/src/result.rs:LL:COL + debug self => _5; // in scope 12 at $SRC_DIR/core/src/result.rs:LL:COL + let _6: u32; // in scope 12 at $SRC_DIR/core/src/result.rs:LL:COL scope 13 { - debug x => _8; // in scope 13 at $SRC_DIR/core/src/result.rs:LL:COL + debug x => _6; // in scope 13 at $SRC_DIR/core/src/result.rs:LL:COL } } scope 14 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _9; // in scope 14 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _17: &std::option::Option; // in scope 14 at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _7; // in scope 14 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _13: &std::option::Option; // in scope 14 at $SRC_DIR/core/src/option.rs:LL:COL scope 15 { - debug val => _10; // in scope 15 at $SRC_DIR/core/src/option.rs:LL:COL + debug val => _8; // in scope 15 at $SRC_DIR/core/src/option.rs:LL:COL } scope 16 { scope 18 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL @@ -72,7 +68,7 @@ fn checked_shl(_1: u32, _2: u32) -> Option { } } scope 17 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL - debug self => _17; // in scope 17 at $SRC_DIR/core/src/option.rs:LL:COL + debug self => _13; // in scope 17 at $SRC_DIR/core/src/option.rs:LL:COL } } } @@ -85,64 +81,52 @@ fn checked_shl(_1: u32, _2: u32) -> Option { } bb0: { - StorageLive(_14); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 - StorageLive(_15); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 - StorageLive(_13); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageLive(_11); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageLive(_6); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageLive(_4); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageLive(_10); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 + StorageLive(_11); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 + StorageLive(_9); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageLive(_4); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL StorageLive(_3); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL _3 = const 31_u32; // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL _4 = BitAnd(_2, move _3); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL StorageDead(_3); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageLive(_10); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_5); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _5 = (_4,); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _6 = move (_5.0: u32); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_9); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_8); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageLive(_7); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _7 = Result::::Ok(_6); // scope 11 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - StorageLive(_8); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _8 = move ((_7 as Ok).0: u32); // scope 12 at $SRC_DIR/core/src/result.rs:LL:COL - _9 = Option::::Some(move _8); // scope 13 at $SRC_DIR/core/src/result.rs:LL:COL - StorageDead(_8); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_5); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _5 = Result::::Ok(_4); // scope 11 at $SRC_DIR/core/src/convert/mod.rs:LL:COL + StorageLive(_6); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _6 = move ((_5 as Ok).0: u32); // scope 12 at $SRC_DIR/core/src/result.rs:LL:COL + _7 = Option::::Some(move _6); // scope 13 at $SRC_DIR/core/src/result.rs:LL:COL + StorageDead(_6); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_5); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_13); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _8 = move ((_7 as Some).0: u32); // scope 14 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_13); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageDead(_7); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_17); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _10 = move ((_9 as Some).0: u32); // scope 14 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_17); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_9); // scope 9 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_5); // scope 7 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _11 = unchecked_shl::(_1, move _10) -> [return: bb1, unwind unreachable]; // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _9 = unchecked_shl::(_1, move _8) -> [return: bb1, unwind unreachable]; // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u32, u32) -> u32 {unchecked_shl::}, val: Value() } } bb1: { - StorageDead(_10); // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageDead(_4); // scope 5 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageDead(_6); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageLive(_12); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - _12 = Ge(_2, const _); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - _13 = (move _11, move _12); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageDead(_12); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageDead(_11); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - _14 = (_13.0: u32); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - _15 = (_13.1: bool); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageDead(_13); // scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageLive(_16); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _16 = unlikely(_15) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageDead(_8); // scope 7 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_4); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _10 = Ge(_2, const _); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _11 = move _9; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_9); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageLive(_12); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _12 = unlikely(_10) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/num/mod.rs:LL:COL // + literal: Const { ty: extern "rust-intrinsic" fn(bool) -> bool {unlikely}, val: Value() } } bb2: { - switchInt(move _16) -> [0: bb3, otherwise: bb4]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + switchInt(move _12) -> [0: bb3, otherwise: bb4]; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL } bb3: { - _0 = Option::::Some(_14); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _0 = Option::::Some(_11); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL goto -> bb5; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL } @@ -152,9 +136,9 @@ fn checked_shl(_1: u32, _2: u32) -> Option { } bb5: { - StorageDead(_16); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - StorageDead(_15); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 - StorageDead(_14); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 + StorageDead(_12); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + StorageDead(_11); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 + StorageDead(_10); // scope 0 at $DIR/checked_ops.rs:+1:7: +1:23 return; // scope 0 at $DIR/checked_ops.rs:+2:2: +2:2 } } 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 12245ccf00059..a5002cd6afa13 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 @@ -7,17 +7,30 @@ fn int_range(_1: usize, _2: usize) -> () { let mut _3: std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 let mut _4: std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 let mut _5: &mut std::ops::Range; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - let mut _6: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 - let mut _7: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 - let _9: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + let mut _9: std::option::Option; // in scope 0 at $DIR/loops.rs:+1:14: +1:24 + let mut _12: isize; // in scope 0 at $DIR/loops.rs:+1:5: +3:6 + let _14: (); // in scope 0 at $DIR/loops.rs:+1:14: +1:24 scope 1 { debug iter => _4; // in scope 1 at $DIR/loops.rs:+1:14: +1:24 - let _8: usize; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 + let _13: usize; // in scope 1 at $DIR/loops.rs:+1:9: +1:10 scope 2 { - debug i => _8; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 + debug i => _13; // in scope 2 at $DIR/loops.rs:+1:9: +1:10 } scope 4 (inlined iter::range::>::next) { // at $DIR/loops.rs:8:14: 8:24 debug self => _5; // in scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 5 (inlined as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _5; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _6: &usize; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _7: &usize; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _8: bool; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let _10: usize; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _11: usize; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 6 { + debug old => _10; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 7 { + } + } + } } } scope 3 (inlined as IntoIterator>::into_iter) { // at $DIR/loops.rs:8:14: 8:24 @@ -32,39 +45,74 @@ fn int_range(_1: usize, _2: usize) -> () { } bb1: { - StorageLive(_6); // scope 1 at $DIR/loops.rs:+1:14: +1:24 + StorageLive(_9); // scope 1 at $DIR/loops.rs:+1:14: +1:24 _5 = &mut _4; // scope 1 at $DIR/loops.rs:+1:14: +1:24 - _6 = as iter::range::RangeIteratorImpl>::spec_next(_5) -> bb2; // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_10); // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_8); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_6); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _6 = &((*_5).0: usize); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_7); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _7 = &((*_5).1: usize); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _8 = ::lt(move _6, move _7) -> bb2; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL - // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } + // + literal: Const { ty: for<'a, 'b> fn(&'a usize, &'b usize) -> bool {::lt}, val: Value() } } bb2: { - _7 = discriminant(_6); // scope 1 at $DIR/loops.rs:+1:14: +1:24 - switchInt(move _7) -> [0: bb3, 1: bb4, otherwise: bb6]; // scope 1 at $DIR/loops.rs:+1:14: +1:24 + StorageDead(_7); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_6); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + switchInt(move _8) -> [0: bb3, otherwise: bb4]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL } bb3: { - StorageDead(_6); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + _9 = Option::::None; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + goto -> bb6; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb4: { + _10 = ((*_5).0: usize); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_11); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _11 = ::forward_unchecked(_10, const 1_usize) -> bb5; // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: unsafe fn(usize, usize) -> usize {::forward_unchecked}, val: Value() } + } + + bb5: { + ((*_5).0: usize) = move _11; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_11); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _9 = Option::::Some(_10); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + goto -> bb6; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + } + + bb6: { + StorageDead(_8); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_10); // scope 4 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _12 = discriminant(_9); // scope 1 at $DIR/loops.rs:+1:14: +1:24 + switchInt(move _12) -> [0: bb7, 1: bb8, otherwise: bb10]; // scope 1 at $DIR/loops.rs:+1:14: +1:24 + } + + bb7: { + StorageDead(_9); // scope 1 at $DIR/loops.rs:+3:5: +3:6 StorageDead(_4); // scope 0 at $DIR/loops.rs:+3:5: +3:6 return; // scope 0 at $DIR/loops.rs:+4:2: +4:2 } - bb4: { - _8 = ((_6 as Some).0: usize); // scope 1 at $DIR/loops.rs:+1:9: +1:10 - _9 = opaque::(_8) -> bb5; // scope 2 at $DIR/loops.rs:+2:9: +2:18 + bb8: { + _13 = ((_9 as Some).0: usize); // scope 1 at $DIR/loops.rs:+1:9: +1:10 + _14 = opaque::(_13) -> bb9; // scope 2 at $DIR/loops.rs:+2:9: +2:18 // mir::Constant // + span: $DIR/loops.rs:9:9: 9:15 // + literal: Const { ty: fn(usize) {opaque::}, val: Value() } } - bb5: { - StorageDead(_6); // scope 1 at $DIR/loops.rs:+3:5: +3:6 + bb9: { + StorageDead(_9); // scope 1 at $DIR/loops.rs:+3:5: +3:6 goto -> bb1; // scope 1 at $DIR/loops.rs:+1:5: +3:6 } - bb6: { + bb10: { unreachable; // scope 1 at $DIR/loops.rs:+1:14: +1:24 } } 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 492cb022bed49..91c8f299fdb20 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 @@ -14,11 +14,11 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2 let _12: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 let mut _18: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46 - let mut _19: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56 - let mut _20: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51 - let _21: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 - let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 - let mut _27: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56 + let mut _19: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51 + let _20: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 + let mut _21: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 + let mut _26: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56 + let mut _27: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56 let mut _28: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61 let _29: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 let mut _30: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 @@ -58,15 +58,15 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2 } } scope 6 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:7:50: 7:56 - debug self => _20; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _22; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => _19; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _21; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _22: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL let mut _23: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _24: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL scope 7 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL - debug self => _23; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - debug other => _24; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => _22; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _23; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _24: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL let mut _25: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - let mut _26: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL } } scope 8 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:7:70: 7:76 @@ -96,7 +96,7 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2 StorageLive(_10); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 _9 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 _10 = &((*_9).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageLive(_27); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46 StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 _11 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 @@ -120,41 +120,38 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2 } bb1: { - _19 = const false; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageDead(_26); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 } bb2: { - StorageLive(_27); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 - StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 - _20 = &_10; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 - StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageLive(_26); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 + StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 + _19 = &_10; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _21 = _6; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _22 = &_21; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _23 = deref_copy (*_20); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - _24 = deref_copy (*_22); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _20 = _6; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _21 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _22 = deref_copy (*_19); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + _23 = deref_copy (*_21); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_24); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _24 = (*_22); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageLive(_25); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL _25 = (*_23); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageLive(_26); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - _26 = (*_24); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - _27 = Le(move _25, move _26); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_26); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _26 = Le(move _24, move _25); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_25); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_24); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _19 = move _27; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 - } - - bb3: { - StorageDead(_27); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _27 = move _26; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageDead(_26); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - switchInt(move _19) -> [0: bb4, otherwise: bb8]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + switchInt(move _27) -> [0: bb3, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 } - bb4: { + bb3: { StorageLive(_36); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 StorageLive(_35); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66 StorageLive(_28); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 @@ -175,15 +172,15 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2 StorageDead(_29); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 StorageDead(_30); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 StorageDead(_28); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - switchInt(move _35) -> [0: bb5, otherwise: bb6]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + switchInt(move _35) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 } - bb5: { + bb4: { _36 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - goto -> bb7; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + goto -> bb6; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 } - bb6: { + bb5: { StorageLive(_44); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 StorageLive(_37); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 _37 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 @@ -204,24 +201,24 @@ fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:7:25: 7:39], _2 StorageDead(_39); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 StorageDead(_37); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 _36 = move _44; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 - goto -> bb7; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + goto -> bb6; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 } - bb7: { + bb6: { StorageDead(_44); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 StorageDead(_35); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 _0 = move _36; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - goto -> bb9; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 } - bb8: { + bb7: { _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 - goto -> bb9; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 } - bb9: { + bb8: { StorageDead(_36); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_27); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 StorageDead(_10); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 StorageDead(_8); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 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 8ab69bc7b2732..9f5fe95a8b4b0 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 @@ -11,8 +11,8 @@ fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41], let mut _9: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 let _10: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48 - let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58 - let mut _13: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58 + let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58 + let mut _13: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58 let mut _14: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68 let mut _15: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78 let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78 @@ -32,64 +32,61 @@ fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:11:25: 11:41], _8 = ((*_7).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 _9 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 _10 = ((*_9).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 - StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 _11 = Le(_4, _8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 switchInt(move _11) -> [0: bb1, otherwise: bb2]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 } bb1: { - _12 = const false; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 } bb2: { - StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 - _13 = Le(_10, _6); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 - _12 = move _13; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 - } - - bb3: { - StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 + _12 = Le(_10, _6); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 + _13 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 - switchInt(move _12) -> [0: bb4, otherwise: bb8]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + switchInt(move _13) -> [0: bb3, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 } - bb4: { + bb3: { StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 _14 = Le(_8, _4); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 - switchInt(move _14) -> [0: bb5, otherwise: bb6]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + switchInt(move _14) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 } - bb5: { + bb4: { _15 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - goto -> bb7; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + goto -> bb6; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 } - bb6: { + bb5: { StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 _16 = Le(_6, _10); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 _15 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 - goto -> bb7; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + goto -> bb6; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 } - bb7: { + bb6: { StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 _0 = move _15; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - goto -> bb9; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 } - bb8: { + bb7: { _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 - goto -> bb9; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 } - bb9: { + bb8: { StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 - StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78 } } diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir index 25a3421793dab..4dd11c1e52953 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.mir @@ -42,21 +42,20 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { scope 13 (inlined NonNull::::new_unchecked) { // at $SRC_DIR/core/src/slice/iter.rs:LL:COL debug ptr => _9; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL let mut _10: *const T; // in scope 13 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - let mut _24: *mut T; // in scope 13 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 14 { scope 15 (inlined NonNull::::new_unchecked::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug ptr => _24; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug ptr => _9; // in scope 15 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 16 (inlined ptr::mut_ptr::::is_null) { // at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - debug self => _24; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _25: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _9; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _24: *mut u8; // in scope 16 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 17 { scope 18 (inlined ptr::mut_ptr::::is_null::runtime_impl) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _25; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug ptr => _24; // in scope 18 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 19 (inlined ptr::mut_ptr::::addr) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _25; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _24; // in scope 19 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 20 { scope 21 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug self => _25; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _24; // in scope 21 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL } } } @@ -132,10 +131,8 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { _9 = _4 as *mut T (PtrToPtr); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL StorageLive(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL StorageLive(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL - StorageLive(_25); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL _10 = _9 as *const T (Pointer(MutToConstPointer)); // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL _11 = NonNull:: { pointer: _10 }; // scope 14 at $SRC_DIR/core/src/ptr/non_null.rs:LL:COL - StorageDead(_25); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL StorageDead(_24); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL StorageDead(_10); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL StorageDead(_9); // scope 7 at $SRC_DIR/core/src/slice/iter.rs:LL:COL diff --git a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir index a81bd998d89d0..ca7a4a64f4574 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.mir @@ -8,25 +8,38 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { let mut _4: std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 let mut _5: std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 let mut _6: &mut std::ops::Range; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 - let mut _7: std::option::Option; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 - let mut _8: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +4:6 - let mut _10: usize; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 - let mut _11: bool; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 - let mut _13: &impl Fn(usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:10 - let mut _14: (usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:16 - let _15: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _10: std::option::Option; // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 + let mut _13: isize; // in scope 0 at $DIR/slice_iter.rs:+1:5: +4:6 + let mut _15: usize; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 + let mut _16: bool; // in scope 0 at $DIR/slice_iter.rs:+2:18: +2:26 + let mut _18: &impl Fn(usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:10 + let mut _19: (usize, &T); // in scope 0 at $DIR/slice_iter.rs:+3:9: +3:16 + let _20: (); // in scope 0 at $DIR/slice_iter.rs:+1:14: +1:28 scope 1 { debug iter => _5; // in scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 - let _9: usize; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + let _14: usize; // in scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 scope 2 { - debug i => _9; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 - let _12: &T; // in scope 2 at $DIR/slice_iter.rs:+2:13: +2:14 + debug i => _14; // in scope 2 at $DIR/slice_iter.rs:+1:9: +1:10 + let _17: &T; // in scope 2 at $DIR/slice_iter.rs:+2:13: +2:14 scope 3 { - debug x => _12; // in scope 3 at $DIR/slice_iter.rs:+2:13: +2:14 + debug x => _17; // in scope 3 at $DIR/slice_iter.rs:+2:13: +2:14 } } scope 5 (inlined iter::range::>::next) { // at $DIR/slice_iter.rs:49:14: 49:28 debug self => _6; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 6 (inlined as iter::range::RangeIteratorImpl>::spec_next) { // at $SRC_DIR/core/src/iter/range.rs:LL:COL + debug self => _6; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _7: &usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _8: &usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _9: bool; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let _11: usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + let mut _12: usize; // in scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 7 { + debug old => _11; // in scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + scope 8 { + } + } + } } } scope 4 (inlined as IntoIterator>::into_iter) { // at $DIR/slice_iter.rs:49:14: 49:28 @@ -44,64 +57,99 @@ fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } bb1: { - StorageLive(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + StorageLive(_10); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 _6 = &mut _5; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 - _7 = as iter::range::RangeIteratorImpl>::spec_next(_6) -> [return: bb2, unwind: bb9]; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_11); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_9); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_7); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _7 = &((*_6).0: usize); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_8); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _8 = &((*_6).1: usize); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _9 = ::lt(move _7, move _8) -> [return: bb2, unwind: bb13]; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL - // + literal: Const { ty: for<'a> fn(&'a mut std::ops::Range) -> Option< as iter::range::RangeIteratorImpl>::Item> { as iter::range::RangeIteratorImpl>::spec_next}, val: Value() } + // + literal: Const { ty: for<'a, 'b> fn(&'a usize, &'b usize) -> bool {::lt}, val: Value() } } bb2: { - _8 = discriminant(_7); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 - switchInt(move _8) -> [0: bb3, 1: bb5, otherwise: bb8]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + StorageDead(_8); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_7); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + switchInt(move _9) -> [0: bb3, otherwise: bb4]; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL } bb3: { - StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 - StorageDead(_5); // scope 0 at $DIR/slice_iter.rs:+4:5: +4:6 - drop(_2) -> bb4; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 + _10 = Option::::None; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + goto -> bb6; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL } bb4: { - return; // scope 0 at $DIR/slice_iter.rs:+5:2: +5:2 + _11 = ((*_6).0: usize); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageLive(_12); // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _12 = ::forward_unchecked(_11, const 1_usize) -> [return: bb5, unwind: bb13]; // scope 8 at $SRC_DIR/core/src/iter/range.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL + // + literal: Const { ty: unsafe fn(usize, usize) -> usize {::forward_unchecked}, val: Value() } } bb5: { - _9 = ((_7 as Some).0: usize); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 - _10 = Len((*_1)); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 - _11 = Lt(_9, _10); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 - assert(move _11, "index out of bounds: the length is {} but the index is {}", move _10, _9) -> [success: bb6, unwind: bb9]; // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + ((*_6).0: usize) = move _12; // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_12); // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _10 = Option::::Some(_11); // scope 7 at $SRC_DIR/core/src/iter/range.rs:LL:COL + goto -> bb6; // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL } bb6: { - _12 = &(*_1)[_9]; // scope 2 at $DIR/slice_iter.rs:+2:17: +2:26 - StorageLive(_13); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 - _13 = &_2; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 - StorageLive(_14); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 - _14 = (_9, _12); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 - _15 = >::call(move _13, move _14) -> [return: bb7, unwind: bb9]; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + StorageDead(_9); // scope 6 at $SRC_DIR/core/src/iter/range.rs:LL:COL + StorageDead(_11); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL + _13 = discriminant(_10); // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + switchInt(move _13) -> [0: bb7, 1: bb9, otherwise: bb12]; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 + } + + bb7: { + StorageDead(_10); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 + StorageDead(_5); // scope 0 at $DIR/slice_iter.rs:+4:5: +4:6 + drop(_2) -> bb8; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 + } + + bb8: { + return; // scope 0 at $DIR/slice_iter.rs:+5:2: +5:2 + } + + bb9: { + _14 = ((_10 as Some).0: usize); // scope 1 at $DIR/slice_iter.rs:+1:9: +1:10 + _15 = Len((*_1)); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + _16 = Lt(_14, _15); // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + assert(move _16, "index out of bounds: the length is {} but the index is {}", move _15, _14) -> [success: bb10, unwind: bb13]; // scope 2 at $DIR/slice_iter.rs:+2:18: +2:26 + } + + bb10: { + _17 = &(*_1)[_14]; // scope 2 at $DIR/slice_iter.rs:+2:17: +2:26 + StorageLive(_18); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 + _18 = &_2; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:10 + StorageLive(_19); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + _19 = (_14, _17); // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 + _20 = >::call(move _18, move _19) -> [return: bb11, unwind: bb13]; // scope 3 at $DIR/slice_iter.rs:+3:9: +3:16 // mir::Constant // + span: $DIR/slice_iter.rs:51:9: 51:10 // + literal: Const { ty: for<'a> extern "rust-call" fn(&'a impl Fn(usize, &T), (usize, &T)) -> >::Output {>::call}, val: Value() } } - bb7: { - StorageDead(_14); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 - StorageDead(_13); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 - StorageDead(_7); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 + bb11: { + StorageDead(_19); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 + StorageDead(_18); // scope 3 at $DIR/slice_iter.rs:+3:15: +3:16 + StorageDead(_10); // scope 1 at $DIR/slice_iter.rs:+4:5: +4:6 goto -> bb1; // scope 1 at $DIR/slice_iter.rs:+1:5: +4:6 } - bb8: { + bb12: { unreachable; // scope 1 at $DIR/slice_iter.rs:+1:14: +1:28 } - bb9 (cleanup): { - drop(_2) -> [return: bb10, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 + bb13 (cleanup): { + drop(_2) -> [return: bb14, unwind terminate]; // scope 0 at $DIR/slice_iter.rs:+5:1: +5:2 } - bb10 (cleanup): { + bb14 (cleanup): { resume; // scope 0 at $DIR/slice_iter.rs:+0:1: +5:2 } }