diff options
Diffstat (limited to '')
10 files changed, 446 insertions, 477 deletions
diff --git a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff index 9bda5f575..bb14b909a 100644 --- a/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/lifetimes.foo.ScalarReplacementOfAggregates.diff @@ -2,213 +2,191 @@ + // MIR for `foo` after ScalarReplacementOfAggregates fn foo() -> () { - let mut _0: (); // return place in scope 0 at $DIR/lifetimes.rs:+0:18: +0:18 - let _1: Foo<T>; // in scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 - let mut _2: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>; // in scope 0 at $DIR/lifetimes.rs:+2:12: +2:31 - let mut _3: std::boxed::Box<dyn std::fmt::Display>; // in scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 - let mut _4: std::boxed::Box<u32>; // in scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 - let mut _7: isize; // in scope 0 at $DIR/lifetimes.rs:+9:12: +9:17 - let _9: (); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _10: (); // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _11: std::fmt::Arguments<'_>; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _12: &[&str]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28 - let mut _13: &[&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28 - let _14: &[&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28 - let _15: [&str; 3]; // in scope 0 at $DIR/lifetimes.rs:+10:19: +10:28 - let mut _16: &[core::fmt::rt::Argument<'_>]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _17: &[core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _18: &[core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let _19: [core::fmt::rt::Argument<'_>; 2]; // in scope 0 at $SRC_DIR/std/src/macros.rs:LL:COL - let mut _20: core::fmt::rt::Argument<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23 - let mut _21: &std::boxed::Box<dyn std::fmt::Display>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23 - let _22: &std::boxed::Box<dyn std::fmt::Display>; // in scope 0 at $DIR/lifetimes.rs:+10:20: +10:23 - let mut _23: core::fmt::rt::Argument<'_>; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27 - let mut _24: &u32; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27 - let _25: &u32; // in scope 0 at $DIR/lifetimes.rs:+10:24: +10:27 - let mut _27: bool; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 - let mut _28: isize; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 - let mut _29: isize; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 - let mut _30: isize; // in scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 -+ let _31: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>; // in scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 -+ let _32: u32; // in scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 + let mut _0: (); + let _1: Foo<T>; + let mut _2: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>; + let mut _3: std::boxed::Box<dyn std::fmt::Display>; + let mut _4: std::boxed::Box<u32>; + let mut _7: isize; + let _9: (); + let _10: (); + let mut _11: std::fmt::Arguments<'_>; + let mut _12: &[&str]; + let mut _13: &[&str; 3]; + let _14: &[&str; 3]; + let _15: [&str; 3]; + let mut _16: &[core::fmt::rt::Argument<'_>]; + let mut _17: &[core::fmt::rt::Argument<'_>; 2]; + let _18: &[core::fmt::rt::Argument<'_>; 2]; + let _19: [core::fmt::rt::Argument<'_>; 2]; + let mut _20: core::fmt::rt::Argument<'_>; + let mut _21: &std::boxed::Box<dyn std::fmt::Display>; + let _22: &std::boxed::Box<dyn std::fmt::Display>; + let mut _23: core::fmt::rt::Argument<'_>; + let mut _24: &u32; + let _25: &u32; + let mut _27: bool; + let mut _28: isize; + let mut _29: isize; + let mut _30: isize; ++ let _31: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>; ++ let _32: u32; scope 1 { -- debug foo => _1; // in scope 1 at $DIR/lifetimes.rs:+1:9: +1:12 -+ debug foo => Foo<T>{ .0 => _31, .1 => _32, }; // in scope 1 at $DIR/lifetimes.rs:+1:9: +1:12 - let _5: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>; // in scope 1 at $DIR/lifetimes.rs:+6:9: +6:10 +- debug foo => _1; ++ debug foo => Foo<T>{ .0 => _31, .1 => _32, }; + let _5: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>; scope 2 { - debug x => _5; // in scope 2 at $DIR/lifetimes.rs:+6:9: +6:10 - let _6: u32; // in scope 2 at $DIR/lifetimes.rs:+7:9: +7:10 + debug x => _5; + let _6: u32; scope 3 { - debug y => _6; // in scope 3 at $DIR/lifetimes.rs:+7:9: +7:10 + debug y => _6; scope 4 { - debug x => _8; // in scope 4 at $DIR/lifetimes.rs:+9:15: +9:16 - let _8: std::boxed::Box<dyn std::fmt::Display>; // in scope 4 at $DIR/lifetimes.rs:+9:15: +9:16 - let mut _26: &[&str; 3]; // in scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 + debug x => _8; + let _8: std::boxed::Box<dyn std::fmt::Display>; + let mut _26: &[&str; 3]; } } } } bb0: { - _27 = const false; // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 -- StorageLive(_1); // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 -+ StorageLive(_31); // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 -+ StorageLive(_32); // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 -+ nop; // scope 0 at $DIR/lifetimes.rs:+1:9: +1:12 - StorageLive(_2); // scope 0 at $DIR/lifetimes.rs:+2:12: +2:31 - StorageLive(_3); // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 - StorageLive(_4); // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 - _4 = Box::<u32>::new(const 5_u32) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 - // mir::Constant - // + span: $DIR/lifetimes.rs:19:15: 19:23 - // + user_ty: UserType(1) - // + literal: Const { ty: fn(u32) -> Box<u32> {Box::<u32>::new}, val: Value(<ZST>) } + _27 = const false; +- StorageLive(_1); ++ StorageLive(_31); ++ StorageLive(_32); ++ nop; + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); + _4 = Box::<u32>::new(const 5_u32) -> [return: bb1, unwind unreachable]; } bb1: { - _3 = move _4 as std::boxed::Box<dyn std::fmt::Display> (Pointer(Unsize)); // scope 0 at $DIR/lifetimes.rs:+2:15: +2:30 - StorageDead(_4); // scope 0 at $DIR/lifetimes.rs:+2:29: +2:30 - _2 = Result::<Box<dyn std::fmt::Display>, <T as Err>::Err>::Ok(move _3); // scope 0 at $DIR/lifetimes.rs:+2:12: +2:31 - StorageDead(_3); // scope 0 at $DIR/lifetimes.rs:+2:30: +2:31 -- _1 = Foo::<T> { x: move _2, y: const 7_u32 }; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6 -+ _31 = move _2; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6 -+ _32 = const 7_u32; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6 -+ nop; // scope 0 at $DIR/lifetimes.rs:+1:23: +4:6 - StorageDead(_2); // scope 0 at $DIR/lifetimes.rs:+4:5: +4:6 - StorageLive(_5); // scope 1 at $DIR/lifetimes.rs:+6:9: +6:10 - _27 = const true; // scope 1 at $DIR/lifetimes.rs:+6:13: +6:18 -- _5 = move (_1.0: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>); // scope 1 at $DIR/lifetimes.rs:+6:13: +6:18 -+ _5 = move _31; // scope 1 at $DIR/lifetimes.rs:+6:13: +6:18 - StorageLive(_6); // scope 2 at $DIR/lifetimes.rs:+7:9: +7:10 -- _6 = (_1.1: u32); // scope 2 at $DIR/lifetimes.rs:+7:13: +7:18 -+ _6 = _32; // scope 2 at $DIR/lifetimes.rs:+7:13: +7:18 - _7 = discriminant(_5); // scope 4 at $DIR/lifetimes.rs:+9:12: +9:17 - switchInt(move _7) -> [0: bb2, otherwise: bb7]; // scope 4 at $DIR/lifetimes.rs:+9:12: +9:17 + _3 = move _4 as std::boxed::Box<dyn std::fmt::Display> (PointerCoercion(Unsize)); + StorageDead(_4); + _2 = Result::<Box<dyn std::fmt::Display>, <T as Err>::Err>::Ok(move _3); + StorageDead(_3); +- _1 = Foo::<T> { x: move _2, y: const 7_u32 }; ++ _31 = move _2; ++ _32 = const 7_u32; ++ nop; + StorageDead(_2); + StorageLive(_5); + _27 = const true; +- _5 = move (_1.0: std::result::Result<std::boxed::Box<dyn std::fmt::Display>, <T as Err>::Err>); ++ _5 = move _31; + StorageLive(_6); +- _6 = (_1.1: u32); ++ _6 = _32; + _7 = discriminant(_5); + switchInt(move _7) -> [0: bb2, otherwise: bb7]; } bb2: { - StorageLive(_8); // scope 4 at $DIR/lifetimes.rs:+9:15: +9:16 - _27 = const false; // scope 4 at $DIR/lifetimes.rs:+9:15: +9:16 - _8 = move ((_5 as Ok).0: std::boxed::Box<dyn std::fmt::Display>); // scope 4 at $DIR/lifetimes.rs:+9:15: +9:16 - StorageLive(_9); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_10); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_11); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_12); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 - StorageLive(_13); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 - StorageLive(_14); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 - _26 = const _; // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 - // mir::Constant - // + span: $DIR/lifetimes.rs:27:19: 27:28 - // + literal: Const { ty: &[&str; 3], val: Unevaluated(foo, [T], Some(promoted[0])) } - _14 = &(*_26); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 - _13 = &(*_14); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 - _12 = move _13 as &[&str] (Pointer(Unsize)); // scope 4 at $DIR/lifetimes.rs:+10:19: +10:28 - StorageDead(_13); // scope 4 at $DIR/lifetimes.rs:+10:27: +10:28 - StorageLive(_16); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageLive(_20); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 - StorageLive(_21); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 - StorageLive(_22); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 - _22 = &_8; // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 - _21 = &(*_22); // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 - _20 = core::fmt::rt::Argument::<'_>::new_display::<Box<dyn std::fmt::Display>>(move _21) -> [return: bb3, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:20: +10:23 - // mir::Constant - // + span: $DIR/lifetimes.rs:27:20: 27:23 - // + user_ty: UserType(4) - // + literal: Const { ty: for<'b> fn(&'b Box<dyn std::fmt::Display>) -> core::fmt::rt::Argument<'b> {core::fmt::rt::Argument::<'_>::new_display::<Box<dyn std::fmt::Display>>}, val: Value(<ZST>) } + StorageLive(_8); + _27 = const false; + _8 = move ((_5 as Ok).0: std::boxed::Box<dyn std::fmt::Display>); + StorageLive(_9); + StorageLive(_10); + StorageLive(_11); + StorageLive(_12); + StorageLive(_13); + StorageLive(_14); + _26 = const _; + _14 = &(*_26); + _13 = &(*_14); + _12 = move _13 as &[&str] (PointerCoercion(Unsize)); + StorageDead(_13); + StorageLive(_16); + StorageLive(_17); + StorageLive(_18); + StorageLive(_19); + StorageLive(_20); + StorageLive(_21); + StorageLive(_22); + _22 = &_8; + _21 = &(*_22); + _20 = core::fmt::rt::Argument::<'_>::new_display::<Box<dyn std::fmt::Display>>(move _21) -> [return: bb3, unwind unreachable]; } bb3: { - StorageDead(_21); // scope 4 at $DIR/lifetimes.rs:+10:22: +10:23 - StorageLive(_23); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 - StorageLive(_24); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 - StorageLive(_25); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 - _25 = &_6; // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 - _24 = &(*_25); // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 - _23 = core::fmt::rt::Argument::<'_>::new_display::<u32>(move _24) -> [return: bb4, unwind unreachable]; // scope 4 at $DIR/lifetimes.rs:+10:24: +10:27 - // mir::Constant - // + span: $DIR/lifetimes.rs:27:24: 27:27 - // + user_ty: UserType(5) - // + literal: Const { ty: for<'b> fn(&'b u32) -> core::fmt::rt::Argument<'b> {core::fmt::rt::Argument::<'_>::new_display::<u32>}, val: Value(<ZST>) } + StorageDead(_21); + StorageLive(_23); + StorageLive(_24); + StorageLive(_25); + _25 = &_6; + _24 = &(*_25); + _23 = core::fmt::rt::Argument::<'_>::new_display::<u32>(move _24) -> [return: bb4, unwind unreachable]; } bb4: { - StorageDead(_24); // scope 4 at $DIR/lifetimes.rs:+10:26: +10:27 - _19 = [move _20, move _23]; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_23); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _18 = &_19; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _17 = &(*_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _16 = move _17 as &[core::fmt::rt::Argument<'_>] (Pointer(Unsize)); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_17); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _11 = Arguments::<'_>::new_v1(move _12, move _16) -> [return: bb5, unwind unreachable]; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL - // + user_ty: UserType(3) - // + literal: Const { ty: fn(&[&'static str], &[core::fmt::rt::Argument<'_>]) -> Arguments<'_> {Arguments::<'_>::new_v1}, val: Value(<ZST>) } + StorageDead(_24); + _19 = [move _20, move _23]; + StorageDead(_23); + StorageDead(_20); + _18 = &_19; + _17 = &(*_18); + _16 = move _17 as &[core::fmt::rt::Argument<'_>] (PointerCoercion(Unsize)); + StorageDead(_17); + _11 = Arguments::<'_>::new_v1(move _12, move _16) -> [return: bb5, unwind unreachable]; } bb5: { - StorageDead(_16); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_12); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _10 = _eprint(move _11) -> [return: bb6, unwind unreachable]; // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - // mir::Constant - // + span: $SRC_DIR/std/src/macros.rs:LL:COL - // + literal: Const { ty: for<'a> fn(Arguments<'a>) {_eprint}, val: Value(<ZST>) } + StorageDead(_16); + StorageDead(_12); + _10 = _eprint(move _11) -> [return: bb6, unwind unreachable]; } bb6: { - StorageDead(_11); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_25); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_22); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_18); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_14); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_10); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _9 = const (); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - StorageDead(_9); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL - _0 = const (); // scope 4 at $DIR/lifetimes.rs:+9:22: +11:6 - drop(_8) -> [return: bb8, unwind unreachable]; // scope 3 at $DIR/lifetimes.rs:+11:5: +11:6 + StorageDead(_11); + StorageDead(_25); + StorageDead(_22); + StorageDead(_19); + StorageDead(_18); + StorageDead(_14); + StorageDead(_10); + _9 = const (); + StorageDead(_9); + _0 = const (); + drop(_8) -> [return: bb8, unwind unreachable]; } bb7: { - _0 = const (); // scope 3 at $DIR/lifetimes.rs:+11:6: +11:6 - goto -> bb9; // scope 3 at $DIR/lifetimes.rs:+9:5: +11:6 + _0 = const (); + goto -> bb9; } bb8: { - StorageDead(_8); // scope 3 at $DIR/lifetimes.rs:+11:5: +11:6 - goto -> bb9; // scope 3 at $DIR/lifetimes.rs:+9:5: +11:6 + StorageDead(_8); + goto -> bb9; } bb9: { - StorageDead(_6); // scope 2 at $DIR/lifetimes.rs:+12:1: +12:2 - _28 = discriminant(_5); // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 - switchInt(move _28) -> [0: bb11, otherwise: bb13]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 + StorageDead(_6); + _28 = discriminant(_5); + switchInt(move _28) -> [0: bb11, otherwise: bb13]; } bb10: { - _27 = const false; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 - StorageDead(_5); // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 -- StorageDead(_1); // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 -+ StorageDead(_31); // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 -+ StorageDead(_32); // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 -+ nop; // scope 0 at $DIR/lifetimes.rs:+12:1: +12:2 - return; // scope 0 at $DIR/lifetimes.rs:+12:2: +12:2 + _27 = const false; + StorageDead(_5); +- StorageDead(_1); ++ StorageDead(_31); ++ StorageDead(_32); ++ nop; + return; } bb11: { - switchInt(_27) -> [0: bb10, otherwise: bb12]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 + switchInt(_27) -> [0: bb10, otherwise: bb12]; } bb12: { - drop(((_5 as Ok).0: std::boxed::Box<dyn std::fmt::Display>)) -> [return: bb10, unwind unreachable]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 + drop(((_5 as Ok).0: std::boxed::Box<dyn std::fmt::Display>)) -> [return: bb10, unwind unreachable]; } bb13: { - drop(_5) -> [return: bb10, unwind unreachable]; // scope 1 at $DIR/lifetimes.rs:+12:1: +12:2 + drop(_5) -> [return: bb10, unwind unreachable]; } } diff --git a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff index 647681f0e..7ee043169 100644 --- a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff @@ -2,45 +2,45 @@ + // MIR for `constant` after ScalarReplacementOfAggregates fn constant() -> () { - let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:15: +0:15 - let _1: (usize, u8); // in scope 0 at $DIR/structs.rs:+2:9: +2:10 -+ let _4: usize; // in scope 0 at $DIR/structs.rs:+2:9: +2:10 -+ let _5: u8; // in scope 0 at $DIR/structs.rs:+2:9: +2:10 + let mut _0: (); + let _1: (usize, u8); ++ let _4: usize; ++ let _5: u8; scope 1 { -- debug y => _1; // in scope 1 at $DIR/structs.rs:+2:9: +2:10 -+ debug y => (usize, u8){ .0 => _4, .1 => _5, }; // in scope 1 at $DIR/structs.rs:+2:9: +2:10 - let _2: usize; // in scope 1 at $DIR/structs.rs:+3:9: +3:10 +- debug y => _1; ++ debug y => (usize, u8){ .0 => _4, .1 => _5, }; + let _2: usize; scope 2 { - debug t => _2; // in scope 2 at $DIR/structs.rs:+3:9: +3:10 - let _3: u8; // in scope 2 at $DIR/structs.rs:+4:9: +4:10 + debug t => _2; + let _3: u8; scope 3 { - debug u => _3; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 + debug u => _3; } } } bb0: { -- StorageLive(_1); // scope 0 at $DIR/structs.rs:+2:9: +2:10 -+ StorageLive(_4); // scope 0 at $DIR/structs.rs:+2:9: +2:10 -+ StorageLive(_5); // scope 0 at $DIR/structs.rs:+2:9: +2:10 -+ nop; // scope 0 at $DIR/structs.rs:+2:9: +2:10 - _1 = const _; // scope 0 at $DIR/structs.rs:+2:13: +2:14 -+ _4 = move (_1.0: usize); // scope 1 at $DIR/structs.rs:+3:9: +3:10 -+ _5 = move (_1.1: u8); // scope 1 at $DIR/structs.rs:+3:9: +3:10 - StorageLive(_2); // scope 1 at $DIR/structs.rs:+3:9: +3:10 -- _2 = (_1.0: usize); // scope 1 at $DIR/structs.rs:+3:13: +3:16 -+ _2 = _4; // scope 1 at $DIR/structs.rs:+3:13: +3:16 - StorageLive(_3); // scope 2 at $DIR/structs.rs:+4:9: +4:10 -- _3 = (_1.1: u8); // scope 2 at $DIR/structs.rs:+4:13: +4:16 -+ _3 = _5; // scope 2 at $DIR/structs.rs:+4:13: +4:16 - _0 = const (); // scope 0 at $DIR/structs.rs:+0:15: +5:2 - StorageDead(_3); // scope 2 at $DIR/structs.rs:+5:1: +5:2 - StorageDead(_2); // scope 1 at $DIR/structs.rs:+5:1: +5:2 -- StorageDead(_1); // scope 0 at $DIR/structs.rs:+5:1: +5:2 -+ StorageDead(_4); // scope 0 at $DIR/structs.rs:+5:1: +5:2 -+ StorageDead(_5); // scope 0 at $DIR/structs.rs:+5:1: +5:2 -+ nop; // scope 0 at $DIR/structs.rs:+5:1: +5:2 - return; // scope 0 at $DIR/structs.rs:+5:2: +5:2 +- StorageLive(_1); ++ StorageLive(_4); ++ StorageLive(_5); ++ nop; + _1 = const _; ++ _4 = move (_1.0: usize); ++ _5 = move (_1.1: u8); + StorageLive(_2); +- _2 = (_1.0: usize); ++ _2 = _4; + StorageLive(_3); +- _3 = (_1.1: u8); ++ _3 = _5; + _0 = const (); + StorageDead(_3); + StorageDead(_2); +- StorageDead(_1); ++ StorageDead(_4); ++ StorageDead(_5); ++ nop; + return; } } diff --git a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff index b0b0da886..0a1de891a 100644 --- a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff @@ -2,33 +2,33 @@ + // MIR for `copies` after ScalarReplacementOfAggregates fn copies(_1: Foo) -> () { - debug x => _1; // in scope 0 at $DIR/structs.rs:+0:11: +0:12 - let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:19: +0:19 - let _2: Foo; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ let _11: u8; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ let _12: (); // in scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ let _13: &str; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ let _14: std::option::Option<isize>; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 + debug x => _1; + let mut _0: (); + let _2: Foo; ++ let _11: u8; ++ let _12: (); ++ let _13: &str; ++ let _14: std::option::Option<isize>; scope 1 { -- debug y => _2; // in scope 1 at $DIR/structs.rs:+1:9: +1:10 -+ debug y => Foo{ .0 => _11, .1 => _12, .2 => _13, .3 => _14, }; // in scope 1 at $DIR/structs.rs:+1:9: +1:10 - let _3: u8; // in scope 1 at $DIR/structs.rs:+2:9: +2:10 +- debug y => _2; ++ debug y => Foo{ .0 => _11, .1 => _12, .2 => _13, .3 => _14, }; + let _3: u8; scope 2 { - debug t => _3; // in scope 2 at $DIR/structs.rs:+2:9: +2:10 - let _4: &str; // in scope 2 at $DIR/structs.rs:+3:9: +3:10 + debug t => _3; + let _4: &str; scope 3 { - debug u => _4; // in scope 3 at $DIR/structs.rs:+3:9: +3:10 - let _5: Foo; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 -+ let _7: u8; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 -+ let _8: (); // in scope 3 at $DIR/structs.rs:+4:9: +4:10 -+ let _9: &str; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 -+ let _10: std::option::Option<isize>; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 + debug u => _4; + let _5: Foo; ++ let _7: u8; ++ let _8: (); ++ let _9: &str; ++ let _10: std::option::Option<isize>; scope 4 { -- debug z => _5; // in scope 4 at $DIR/structs.rs:+4:9: +4:10 -+ debug z => Foo{ .0 => _7, .1 => _8, .2 => _9, .3 => _10, }; // in scope 4 at $DIR/structs.rs:+4:9: +4:10 - let _6: (); // in scope 4 at $DIR/structs.rs:+5:9: +5:10 +- debug z => _5; ++ debug z => Foo{ .0 => _7, .1 => _8, .2 => _9, .3 => _10, }; + let _6: (); scope 5 { - debug a => _6; // in scope 5 at $DIR/structs.rs:+5:9: +5:10 + debug a => _6; } } } @@ -36,56 +36,56 @@ } bb0: { -- StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:9: +1:10 -- _2 = _1; // scope 0 at $DIR/structs.rs:+1:13: +1:14 -+ StorageLive(_11); // scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ StorageLive(_12); // scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ StorageLive(_13); // scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ StorageLive(_14); // scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ nop; // scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ _11 = (_1.0: u8); // scope 0 at $DIR/structs.rs:+1:13: +1:14 -+ _12 = (_1.1: ()); // scope 0 at $DIR/structs.rs:+1:13: +1:14 -+ _13 = (_1.2: &str); // scope 0 at $DIR/structs.rs:+1:13: +1:14 -+ _14 = (_1.3: std::option::Option<isize>); // scope 0 at $DIR/structs.rs:+1:13: +1:14 -+ nop; // scope 0 at $DIR/structs.rs:+1:13: +1:14 - StorageLive(_3); // scope 1 at $DIR/structs.rs:+2:9: +2:10 -- _3 = (_2.0: u8); // scope 1 at $DIR/structs.rs:+2:13: +2:16 -+ _3 = _11; // scope 1 at $DIR/structs.rs:+2:13: +2:16 - StorageLive(_4); // scope 2 at $DIR/structs.rs:+3:9: +3:10 -- _4 = (_2.2: &str); // scope 2 at $DIR/structs.rs:+3:13: +3:16 -- StorageLive(_5); // scope 3 at $DIR/structs.rs:+4:9: +4:10 -- _5 = _2; // scope 3 at $DIR/structs.rs:+4:13: +4:14 -+ _4 = _13; // scope 2 at $DIR/structs.rs:+3:13: +3:16 -+ StorageLive(_7); // scope 3 at $DIR/structs.rs:+4:9: +4:10 -+ StorageLive(_8); // scope 3 at $DIR/structs.rs:+4:9: +4:10 -+ StorageLive(_9); // scope 3 at $DIR/structs.rs:+4:9: +4:10 -+ StorageLive(_10); // scope 3 at $DIR/structs.rs:+4:9: +4:10 -+ nop; // scope 3 at $DIR/structs.rs:+4:9: +4:10 -+ _7 = _11; // scope 3 at $DIR/structs.rs:+4:13: +4:14 -+ _8 = _12; // scope 3 at $DIR/structs.rs:+4:13: +4:14 -+ _9 = _13; // scope 3 at $DIR/structs.rs:+4:13: +4:14 -+ _10 = _14; // scope 3 at $DIR/structs.rs:+4:13: +4:14 -+ nop; // scope 3 at $DIR/structs.rs:+4:13: +4:14 - StorageLive(_6); // scope 4 at $DIR/structs.rs:+5:9: +5:10 -- _6 = (_5.1: ()); // scope 4 at $DIR/structs.rs:+5:13: +5:16 -+ _6 = _8; // scope 4 at $DIR/structs.rs:+5:13: +5:16 - _0 = const (); // scope 0 at $DIR/structs.rs:+0:19: +6:2 - StorageDead(_6); // scope 4 at $DIR/structs.rs:+6:1: +6:2 -- StorageDead(_5); // scope 3 at $DIR/structs.rs:+6:1: +6:2 -+ StorageDead(_7); // scope 3 at $DIR/structs.rs:+6:1: +6:2 -+ StorageDead(_8); // scope 3 at $DIR/structs.rs:+6:1: +6:2 -+ StorageDead(_9); // scope 3 at $DIR/structs.rs:+6:1: +6:2 -+ StorageDead(_10); // scope 3 at $DIR/structs.rs:+6:1: +6:2 -+ nop; // scope 3 at $DIR/structs.rs:+6:1: +6:2 - StorageDead(_4); // scope 2 at $DIR/structs.rs:+6:1: +6:2 - StorageDead(_3); // scope 1 at $DIR/structs.rs:+6:1: +6:2 -- StorageDead(_2); // scope 0 at $DIR/structs.rs:+6:1: +6:2 -+ StorageDead(_11); // scope 0 at $DIR/structs.rs:+6:1: +6:2 -+ StorageDead(_12); // scope 0 at $DIR/structs.rs:+6:1: +6:2 -+ StorageDead(_13); // scope 0 at $DIR/structs.rs:+6:1: +6:2 -+ StorageDead(_14); // scope 0 at $DIR/structs.rs:+6:1: +6:2 -+ nop; // scope 0 at $DIR/structs.rs:+6:1: +6:2 - return; // scope 0 at $DIR/structs.rs:+6:2: +6:2 +- StorageLive(_2); +- _2 = _1; ++ StorageLive(_11); ++ StorageLive(_12); ++ StorageLive(_13); ++ StorageLive(_14); ++ nop; ++ _11 = (_1.0: u8); ++ _12 = (_1.1: ()); ++ _13 = (_1.2: &str); ++ _14 = (_1.3: std::option::Option<isize>); ++ nop; + StorageLive(_3); +- _3 = (_2.0: u8); ++ _3 = _11; + StorageLive(_4); +- _4 = (_2.2: &str); +- StorageLive(_5); +- _5 = _2; ++ _4 = _13; ++ StorageLive(_7); ++ StorageLive(_8); ++ StorageLive(_9); ++ StorageLive(_10); ++ nop; ++ _7 = _11; ++ _8 = _12; ++ _9 = _13; ++ _10 = _14; ++ nop; + StorageLive(_6); +- _6 = (_5.1: ()); ++ _6 = _8; + _0 = const (); + StorageDead(_6); +- StorageDead(_5); ++ StorageDead(_7); ++ StorageDead(_8); ++ StorageDead(_9); ++ StorageDead(_10); ++ nop; + StorageDead(_4); + StorageDead(_3); +- StorageDead(_2); ++ StorageDead(_11); ++ StorageDead(_12); ++ StorageDead(_13); ++ StorageDead(_14); ++ nop; + return; } } diff --git a/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff index d378c260a..bc38a219e 100644 --- a/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff @@ -2,43 +2,43 @@ + // MIR for `dropping` after ScalarReplacementOfAggregates fn dropping() -> () { - let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:19: +0:19 - let _1: Tag; // in scope 0 at $DIR/structs.rs:+1:5: +1:32 - let mut _2: S; // in scope 0 at $DIR/structs.rs:+1:5: +1:30 - let mut _3: Tag; // in scope 0 at $DIR/structs.rs:+1:7: +1:13 - let mut _4: Tag; // in scope 0 at $DIR/structs.rs:+1:15: +1:21 - let mut _5: Tag; // in scope 0 at $DIR/structs.rs:+1:23: +1:29 + let mut _0: (); + let _1: Tag; + let mut _2: S; + let mut _3: Tag; + let mut _4: Tag; + let mut _5: Tag; bb0: { - StorageLive(_1); // scope 0 at $DIR/structs.rs:+1:5: +1:32 - StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:5: +1:30 - StorageLive(_3); // scope 0 at $DIR/structs.rs:+1:7: +1:13 - _3 = Tag(const 0_usize); // scope 0 at $DIR/structs.rs:+1:7: +1:13 - StorageLive(_4); // scope 0 at $DIR/structs.rs:+1:15: +1:21 - _4 = Tag(const 1_usize); // scope 0 at $DIR/structs.rs:+1:15: +1:21 - StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:23: +1:29 - _5 = Tag(const 2_usize); // scope 0 at $DIR/structs.rs:+1:23: +1:29 - _2 = S(move _3, move _4, move _5); // scope 0 at $DIR/structs.rs:+1:5: +1:30 - StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:29: +1:30 - StorageDead(_4); // scope 0 at $DIR/structs.rs:+1:29: +1:30 - StorageDead(_3); // scope 0 at $DIR/structs.rs:+1:29: +1:30 - _1 = move (_2.1: Tag); // scope 0 at $DIR/structs.rs:+1:5: +1:32 - drop(_1) -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:32: +1:33 + StorageLive(_1); + StorageLive(_2); + StorageLive(_3); + _3 = Tag(const 0_usize); + StorageLive(_4); + _4 = Tag(const 1_usize); + StorageLive(_5); + _5 = Tag(const 2_usize); + _2 = S(move _3, move _4, move _5); + StorageDead(_5); + StorageDead(_4); + StorageDead(_3); + _1 = move (_2.1: Tag); + drop(_1) -> [return: bb1, unwind unreachable]; } bb1: { - drop((_2.0: Tag)) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:32: +1:33 + drop((_2.0: Tag)) -> [return: bb3, unwind unreachable]; } bb2: { - StorageDead(_2); // scope 0 at $DIR/structs.rs:+1:32: +1:33 - StorageDead(_1); // scope 0 at $DIR/structs.rs:+1:32: +1:33 - _0 = const (); // scope 0 at $DIR/structs.rs:+0:19: +2:2 - return; // scope 0 at $DIR/structs.rs:+2:2: +2:2 + StorageDead(_2); + StorageDead(_1); + _0 = const (); + return; } bb3: { - drop((_2.2: Tag)) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:32: +1:33 + drop((_2.2: Tag)) -> [return: bb2, unwind unreachable]; } } diff --git a/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff index ff1e30c2d..b5e39e632 100644 --- a/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff @@ -2,42 +2,42 @@ + // MIR for `enums` after ScalarReplacementOfAggregates fn enums(_1: usize) -> usize { - debug a => _1; // in scope 0 at $DIR/structs.rs:+0:14: +0:15 - let mut _0: usize; // return place in scope 0 at $DIR/structs.rs:+0:27: +0:32 - let mut _2: std::option::Option<usize>; // in scope 0 at $DIR/structs.rs:+1:22: +1:29 - let mut _3: usize; // in scope 0 at $DIR/structs.rs:+1:27: +1:28 - let mut _4: isize; // in scope 0 at $DIR/structs.rs:+1:12: +1:19 + debug a => _1; + let mut _0: usize; + let mut _2: std::option::Option<usize>; + let mut _3: usize; + let mut _4: isize; scope 1 { - debug a => _5; // in scope 1 at $DIR/structs.rs:+1:17: +1:18 - let _5: usize; // in scope 1 at $DIR/structs.rs:+1:17: +1:18 + debug a => _5; + let _5: usize; } bb0: { - StorageLive(_2); // scope 1 at $DIR/structs.rs:+1:22: +1:29 - StorageLive(_3); // scope 1 at $DIR/structs.rs:+1:27: +1:28 - _3 = _1; // scope 1 at $DIR/structs.rs:+1:27: +1:28 - _2 = Option::<usize>::Some(move _3); // scope 1 at $DIR/structs.rs:+1:22: +1:29 - StorageDead(_3); // scope 1 at $DIR/structs.rs:+1:28: +1:29 - _4 = discriminant(_2); // scope 1 at $DIR/structs.rs:+1:12: +1:19 - switchInt(move _4) -> [1: bb1, otherwise: bb2]; // scope 1 at $DIR/structs.rs:+1:12: +1:19 + StorageLive(_2); + StorageLive(_3); + _3 = _1; + _2 = Option::<usize>::Some(move _3); + StorageDead(_3); + _4 = discriminant(_2); + switchInt(move _4) -> [1: bb1, otherwise: bb2]; } bb1: { - StorageLive(_5); // scope 1 at $DIR/structs.rs:+1:17: +1:18 - _5 = ((_2 as Some).0: usize); // scope 1 at $DIR/structs.rs:+1:17: +1:18 - _0 = _5; // scope 1 at $DIR/structs.rs:+1:32: +1:33 - StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:34: +1:35 - goto -> bb3; // scope 0 at $DIR/structs.rs:+1:5: +1:46 + StorageLive(_5); + _5 = ((_2 as Some).0: usize); + _0 = _5; + StorageDead(_5); + goto -> bb3; } bb2: { - _0 = const 0_usize; // scope 0 at $DIR/structs.rs:+1:43: +1:44 - goto -> bb3; // scope 0 at $DIR/structs.rs:+1:5: +1:46 + _0 = const 0_usize; + goto -> bb3; } bb3: { - StorageDead(_2); // scope 0 at $DIR/structs.rs:+2:1: +2:2 - return; // scope 0 at $DIR/structs.rs:+2:2: +2:2 + StorageDead(_2); + return; } } diff --git a/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff index 3074fcbdf..6443c6486 100644 --- a/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff @@ -2,43 +2,37 @@ + // MIR for `escaping` after ScalarReplacementOfAggregates fn escaping() -> () { - let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:19: +0:19 - let _1: (); // in scope 0 at $DIR/structs.rs:+1:5: +1:42 - let mut _2: *const u32; // in scope 0 at $DIR/structs.rs:+1:7: +1:41 - let _3: &u32; // in scope 0 at $DIR/structs.rs:+1:7: +1:41 - let _4: Escaping; // in scope 0 at $DIR/structs.rs:+1:8: +1:39 - let mut _5: u32; // in scope 0 at $DIR/structs.rs:+1:34: +1:37 + let mut _0: (); + let _1: (); + let mut _2: *const u32; + let _3: &u32; + let _4: Escaping; + let mut _5: u32; bb0: { - StorageLive(_1); // scope 0 at $DIR/structs.rs:+1:5: +1:42 - StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:7: +1:41 - StorageLive(_3); // scope 0 at $DIR/structs.rs:+1:7: +1:41 - StorageLive(_4); // scope 0 at $DIR/structs.rs:+1:8: +1:39 - StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:34: +1:37 - _5 = g() -> [return: bb1, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:34: +1:37 - // mir::Constant - // + span: $DIR/structs.rs:78:34: 78:35 - // + literal: Const { ty: fn() -> u32 {g}, val: Value(<ZST>) } + StorageLive(_1); + StorageLive(_2); + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); + _5 = g() -> [return: bb1, unwind unreachable]; } bb1: { - _4 = Escaping { a: const 1_u32, b: const 2_u32, c: move _5 }; // scope 0 at $DIR/structs.rs:+1:8: +1:39 - StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:38: +1:39 - _3 = &(_4.0: u32); // scope 0 at $DIR/structs.rs:+1:7: +1:41 - _2 = &raw const (*_3); // scope 0 at $DIR/structs.rs:+1:7: +1:41 - _1 = f(move _2) -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/structs.rs:+1:5: +1:42 - // mir::Constant - // + span: $DIR/structs.rs:78:5: 78:6 - // + literal: Const { ty: fn(*const u32) {f}, val: Value(<ZST>) } + _4 = Escaping { a: const 1_u32, b: const 2_u32, c: move _5 }; + StorageDead(_5); + _3 = &(_4.0: u32); + _2 = &raw const (*_3); + _1 = f(move _2) -> [return: bb2, unwind unreachable]; } bb2: { - StorageDead(_2); // scope 0 at $DIR/structs.rs:+1:41: +1:42 - StorageDead(_4); // scope 0 at $DIR/structs.rs:+1:42: +1:43 - StorageDead(_3); // scope 0 at $DIR/structs.rs:+1:42: +1:43 - StorageDead(_1); // scope 0 at $DIR/structs.rs:+1:42: +1:43 - _0 = const (); // scope 0 at $DIR/structs.rs:+0:19: +2:2 - return; // scope 0 at $DIR/structs.rs:+2:2: +2:2 + StorageDead(_2); + StorageDead(_4); + StorageDead(_3); + StorageDead(_1); + _0 = const (); + return; } } diff --git a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff index 1aa11d17b..a84048365 100644 --- a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff @@ -2,23 +2,23 @@ + // MIR for `flat` after ScalarReplacementOfAggregates fn flat() -> () { - let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:15: +0:15 - let _1: u8; // in scope 0 at $DIR/structs.rs:+1:15: +1:16 - let _2: (); // in scope 0 at $DIR/structs.rs:+1:18: +1:19 - let _3: &str; // in scope 0 at $DIR/structs.rs:+1:21: +1:22 - let _4: std::option::Option<isize>; // in scope 0 at $DIR/structs.rs:+1:24: +1:25 - let mut _5: Foo; // in scope 0 at $DIR/structs.rs:+1:30: +1:70 - let mut _6: (); // in scope 0 at $DIR/structs.rs:+1:45: +1:47 - let mut _7: std::option::Option<isize>; // in scope 0 at $DIR/structs.rs:+1:60: +1:68 -+ let mut _8: u8; // in scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ let mut _9: (); // in scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ let mut _10: &str; // in scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ let mut _11: std::option::Option<isize>; // in scope 0 at $DIR/structs.rs:+1:30: +1:70 + let mut _0: (); + let _1: u8; + let _2: (); + let _3: &str; + let _4: std::option::Option<isize>; + let mut _5: Foo; + let mut _6: (); + let mut _7: std::option::Option<isize>; ++ let mut _8: u8; ++ let mut _9: (); ++ let mut _10: &str; ++ let mut _11: std::option::Option<isize>; scope 1 { - debug a => _1; // in scope 1 at $DIR/structs.rs:+1:15: +1:16 - debug b => _2; // in scope 1 at $DIR/structs.rs:+1:18: +1:19 - debug c => _3; // in scope 1 at $DIR/structs.rs:+1:21: +1:22 - debug d => _4; // in scope 1 at $DIR/structs.rs:+1:24: +1:25 + debug a => _1; + debug b => _2; + debug c => _3; + debug d => _4; scope 2 { scope 3 { scope 4 { @@ -30,51 +30,48 @@ } bb0: { -- StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ StorageLive(_8); // scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ StorageLive(_9); // scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ StorageLive(_10); // scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ StorageLive(_11); // scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ nop; // scope 0 at $DIR/structs.rs:+1:30: +1:70 - StorageLive(_6); // scope 0 at $DIR/structs.rs:+1:45: +1:47 - _6 = (); // scope 0 at $DIR/structs.rs:+1:45: +1:47 - StorageLive(_7); // scope 0 at $DIR/structs.rs:+1:60: +1:68 - _7 = Option::<isize>::Some(const -4_isize); // scope 0 at $DIR/structs.rs:+1:60: +1:68 -- _5 = Foo { a: const 5_u8, b: move _6, c: const "a", d: move _7 }; // scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ _8 = const 5_u8; // scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ _9 = move _6; // scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ _10 = const "a"; // scope 0 at $DIR/structs.rs:+1:30: +1:70 - // mir::Constant - // + span: $DIR/structs.rs:53:52: 53:55 - // + literal: Const { ty: &str, val: Value(Slice(..)) } -+ _11 = move _7; // scope 0 at $DIR/structs.rs:+1:30: +1:70 -+ nop; // scope 0 at $DIR/structs.rs:+1:30: +1:70 - StorageDead(_7); // scope 0 at $DIR/structs.rs:+1:69: +1:70 - StorageDead(_6); // scope 0 at $DIR/structs.rs:+1:69: +1:70 - StorageLive(_1); // scope 0 at $DIR/structs.rs:+1:15: +1:16 -- _1 = (_5.0: u8); // scope 0 at $DIR/structs.rs:+1:15: +1:16 -+ _1 = _8; // scope 0 at $DIR/structs.rs:+1:15: +1:16 - StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:18: +1:19 -- _2 = (_5.1: ()); // scope 0 at $DIR/structs.rs:+1:18: +1:19 -+ _2 = _9; // scope 0 at $DIR/structs.rs:+1:18: +1:19 - StorageLive(_3); // scope 0 at $DIR/structs.rs:+1:21: +1:22 -- _3 = (_5.2: &str); // scope 0 at $DIR/structs.rs:+1:21: +1:22 -+ _3 = _10; // scope 0 at $DIR/structs.rs:+1:21: +1:22 - StorageLive(_4); // scope 0 at $DIR/structs.rs:+1:24: +1:25 -- _4 = (_5.3: std::option::Option<isize>); // scope 0 at $DIR/structs.rs:+1:24: +1:25 -- StorageDead(_5); // scope 0 at $DIR/structs.rs:+1:70: +1:71 -+ _4 = _11; // scope 0 at $DIR/structs.rs:+1:24: +1:25 -+ StorageDead(_8); // scope 0 at $DIR/structs.rs:+1:70: +1:71 -+ StorageDead(_9); // scope 0 at $DIR/structs.rs:+1:70: +1:71 -+ StorageDead(_10); // scope 0 at $DIR/structs.rs:+1:70: +1:71 -+ StorageDead(_11); // scope 0 at $DIR/structs.rs:+1:70: +1:71 -+ nop; // scope 0 at $DIR/structs.rs:+1:70: +1:71 - _0 = const (); // scope 0 at $DIR/structs.rs:+0:15: +6:2 - StorageDead(_4); // scope 0 at $DIR/structs.rs:+6:1: +6:2 - StorageDead(_3); // scope 0 at $DIR/structs.rs:+6:1: +6:2 - StorageDead(_2); // scope 0 at $DIR/structs.rs:+6:1: +6:2 - StorageDead(_1); // scope 0 at $DIR/structs.rs:+6:1: +6:2 - return; // scope 0 at $DIR/structs.rs:+6:2: +6:2 +- StorageLive(_5); ++ StorageLive(_8); ++ StorageLive(_9); ++ StorageLive(_10); ++ StorageLive(_11); ++ nop; + StorageLive(_6); + _6 = (); + StorageLive(_7); + _7 = Option::<isize>::Some(const -4_isize); +- _5 = Foo { a: const 5_u8, b: move _6, c: const "a", d: move _7 }; ++ _8 = const 5_u8; ++ _9 = move _6; ++ _10 = const "a"; ++ _11 = move _7; ++ nop; + StorageDead(_7); + StorageDead(_6); + StorageLive(_1); +- _1 = (_5.0: u8); ++ _1 = _8; + StorageLive(_2); +- _2 = (_5.1: ()); ++ _2 = _9; + StorageLive(_3); +- _3 = (_5.2: &str); ++ _3 = _10; + StorageLive(_4); +- _4 = (_5.3: std::option::Option<isize>); +- StorageDead(_5); ++ _4 = _11; ++ StorageDead(_8); ++ StorageDead(_9); ++ StorageDead(_10); ++ StorageDead(_11); ++ nop; + _0 = const (); + StorageDead(_4); + StorageDead(_3); + StorageDead(_2); + StorageDead(_1); + return; } } diff --git a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff index 7b09ac182..d7c57c293 100644 --- a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff @@ -2,55 +2,55 @@ + // MIR for `ref_copies` after ScalarReplacementOfAggregates fn ref_copies(_1: &Foo) -> () { - debug x => _1; // in scope 0 at $DIR/structs.rs:+0:15: +0:16 - let mut _0: (); // return place in scope 0 at $DIR/structs.rs:+0:24: +0:24 - let _2: Foo; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ let _5: u8; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ let _6: (); // in scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ let _7: &str; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ let _8: std::option::Option<isize>; // in scope 0 at $DIR/structs.rs:+1:9: +1:10 + debug x => _1; + let mut _0: (); + let _2: Foo; ++ let _5: u8; ++ let _6: (); ++ let _7: &str; ++ let _8: std::option::Option<isize>; scope 1 { -- debug y => _2; // in scope 1 at $DIR/structs.rs:+1:9: +1:10 -+ debug y => Foo{ .0 => _5, .1 => _6, .2 => _7, .3 => _8, }; // in scope 1 at $DIR/structs.rs:+1:9: +1:10 - let _3: u8; // in scope 1 at $DIR/structs.rs:+2:9: +2:10 +- debug y => _2; ++ debug y => Foo{ .0 => _5, .1 => _6, .2 => _7, .3 => _8, }; + let _3: u8; scope 2 { - debug t => _3; // in scope 2 at $DIR/structs.rs:+2:9: +2:10 - let _4: &str; // in scope 2 at $DIR/structs.rs:+3:9: +3:10 + debug t => _3; + let _4: &str; scope 3 { - debug u => _4; // in scope 3 at $DIR/structs.rs:+3:9: +3:10 + debug u => _4; } } } bb0: { -- StorageLive(_2); // scope 0 at $DIR/structs.rs:+1:9: +1:10 -- _2 = (*_1); // scope 0 at $DIR/structs.rs:+1:13: +1:15 -+ StorageLive(_5); // scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ StorageLive(_6); // scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ StorageLive(_7); // scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ StorageLive(_8); // scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ nop; // scope 0 at $DIR/structs.rs:+1:9: +1:10 -+ _5 = ((*_1).0: u8); // scope 0 at $DIR/structs.rs:+1:13: +1:15 -+ _6 = ((*_1).1: ()); // scope 0 at $DIR/structs.rs:+1:13: +1:15 -+ _7 = ((*_1).2: &str); // scope 0 at $DIR/structs.rs:+1:13: +1:15 -+ _8 = ((*_1).3: std::option::Option<isize>); // scope 0 at $DIR/structs.rs:+1:13: +1:15 -+ nop; // scope 0 at $DIR/structs.rs:+1:13: +1:15 - StorageLive(_3); // scope 1 at $DIR/structs.rs:+2:9: +2:10 -- _3 = (_2.0: u8); // scope 1 at $DIR/structs.rs:+2:13: +2:16 -+ _3 = _5; // scope 1 at $DIR/structs.rs:+2:13: +2:16 - StorageLive(_4); // scope 2 at $DIR/structs.rs:+3:9: +3:10 -- _4 = (_2.2: &str); // scope 2 at $DIR/structs.rs:+3:13: +3:16 -+ _4 = _7; // scope 2 at $DIR/structs.rs:+3:13: +3:16 - _0 = const (); // scope 0 at $DIR/structs.rs:+0:24: +4:2 - StorageDead(_4); // scope 2 at $DIR/structs.rs:+4:1: +4:2 - StorageDead(_3); // scope 1 at $DIR/structs.rs:+4:1: +4:2 -- StorageDead(_2); // scope 0 at $DIR/structs.rs:+4:1: +4:2 -+ StorageDead(_5); // scope 0 at $DIR/structs.rs:+4:1: +4:2 -+ StorageDead(_6); // scope 0 at $DIR/structs.rs:+4:1: +4:2 -+ StorageDead(_7); // scope 0 at $DIR/structs.rs:+4:1: +4:2 -+ StorageDead(_8); // scope 0 at $DIR/structs.rs:+4:1: +4:2 -+ nop; // scope 0 at $DIR/structs.rs:+4:1: +4:2 - return; // scope 0 at $DIR/structs.rs:+4:2: +4:2 +- StorageLive(_2); +- _2 = (*_1); ++ StorageLive(_5); ++ StorageLive(_6); ++ StorageLive(_7); ++ StorageLive(_8); ++ nop; ++ _5 = ((*_1).0: u8); ++ _6 = ((*_1).1: ()); ++ _7 = ((*_1).2: &str); ++ _8 = ((*_1).3: std::option::Option<isize>); ++ nop; + StorageLive(_3); +- _3 = (_2.0: u8); ++ _3 = _5; + StorageLive(_4); +- _4 = (_2.2: &str); ++ _4 = _7; + _0 = const (); + StorageDead(_4); + StorageDead(_3); +- StorageDead(_2); ++ StorageDead(_5); ++ StorageDead(_6); ++ StorageDead(_7); ++ StorageDead(_8); ++ nop; + return; } } diff --git a/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff index c94e4b137..bf5c3e3bd 100644 --- a/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff @@ -2,32 +2,32 @@ + // MIR for `structs` after ScalarReplacementOfAggregates fn structs(_1: f32) -> f32 { - debug a => _1; // in scope 0 at $DIR/structs.rs:+0:16: +0:17 - let mut _0: f32; // return place in scope 0 at $DIR/structs.rs:+0:27: +0:30 - let mut _2: structs::U; // in scope 0 at $DIR/structs.rs:+6:5: +6:21 - let mut _3: f32; // in scope 0 at $DIR/structs.rs:+6:18: +6:19 -+ let mut _4: usize; // in scope 0 at $DIR/structs.rs:+6:5: +6:21 -+ let mut _5: f32; // in scope 0 at $DIR/structs.rs:+6:5: +6:21 + debug a => _1; + let mut _0: f32; + let mut _2: structs::U; + let mut _3: f32; ++ let mut _4: usize; ++ let mut _5: f32; bb0: { -- StorageLive(_2); // scope 0 at $DIR/structs.rs:+6:5: +6:21 -+ StorageLive(_4); // scope 0 at $DIR/structs.rs:+6:5: +6:21 -+ StorageLive(_5); // scope 0 at $DIR/structs.rs:+6:5: +6:21 -+ nop; // scope 0 at $DIR/structs.rs:+6:5: +6:21 - StorageLive(_3); // scope 0 at $DIR/structs.rs:+6:18: +6:19 - _3 = _1; // scope 0 at $DIR/structs.rs:+6:18: +6:19 -- _2 = U { _foo: const 0_usize, a: move _3 }; // scope 0 at $DIR/structs.rs:+6:5: +6:21 -+ _4 = const 0_usize; // scope 0 at $DIR/structs.rs:+6:5: +6:21 -+ _5 = move _3; // scope 0 at $DIR/structs.rs:+6:5: +6:21 -+ nop; // scope 0 at $DIR/structs.rs:+6:5: +6:21 - StorageDead(_3); // scope 0 at $DIR/structs.rs:+6:20: +6:21 -- _0 = (_2.1: f32); // scope 0 at $DIR/structs.rs:+6:5: +6:23 -- StorageDead(_2); // scope 0 at $DIR/structs.rs:+7:1: +7:2 -+ _0 = _5; // scope 0 at $DIR/structs.rs:+6:5: +6:23 -+ StorageDead(_4); // scope 0 at $DIR/structs.rs:+7:1: +7:2 -+ StorageDead(_5); // scope 0 at $DIR/structs.rs:+7:1: +7:2 -+ nop; // scope 0 at $DIR/structs.rs:+7:1: +7:2 - return; // scope 0 at $DIR/structs.rs:+7:2: +7:2 +- StorageLive(_2); ++ StorageLive(_4); ++ StorageLive(_5); ++ nop; + StorageLive(_3); + _3 = _1; +- _2 = U { _foo: const 0_usize, a: move _3 }; ++ _4 = const 0_usize; ++ _5 = move _3; ++ nop; + StorageDead(_3); +- _0 = (_2.1: f32); +- StorageDead(_2); ++ _0 = _5; ++ StorageDead(_4); ++ StorageDead(_5); ++ nop; + return; } } diff --git a/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff index 5aa054589..6c99d3efd 100644 --- a/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff +++ b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff @@ -2,22 +2,22 @@ + // MIR for `unions` after ScalarReplacementOfAggregates fn unions(_1: f32) -> u32 { - debug a => _1; // in scope 0 at $DIR/structs.rs:+0:15: +0:16 - let mut _0: u32; // return place in scope 0 at $DIR/structs.rs:+0:26: +0:29 - let mut _2: unions::Repr; // in scope 0 at $DIR/structs.rs:+5:14: +5:27 - let mut _3: f32; // in scope 0 at $DIR/structs.rs:+5:24: +5:25 + debug a => _1; + let mut _0: u32; + let mut _2: unions::Repr; + let mut _3: f32; scope 1 { } bb0: { - StorageLive(_2); // scope 1 at $DIR/structs.rs:+5:14: +5:27 - StorageLive(_3); // scope 1 at $DIR/structs.rs:+5:24: +5:25 - _3 = _1; // scope 1 at $DIR/structs.rs:+5:24: +5:25 - _2 = Repr { f: move _3 }; // scope 1 at $DIR/structs.rs:+5:14: +5:27 - StorageDead(_3); // scope 1 at $DIR/structs.rs:+5:26: +5:27 - _0 = (_2.1: u32); // scope 1 at $DIR/structs.rs:+5:14: +5:29 - StorageDead(_2); // scope 0 at $DIR/structs.rs:+6:1: +6:2 - return; // scope 0 at $DIR/structs.rs:+6:2: +6:2 + StorageLive(_2); + StorageLive(_3); + _3 = _1; + _2 = Repr { f: move _3 }; + StorageDead(_3); + _0 = (_2.1: u32); + StorageDead(_2); + return; } } |