diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-03-05 18:06:55 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-03-05 18:15:57 +0000 |
| commit | 248a5301af39f823c92927f81c847f6b2ca32fcd (patch) | |
| tree | a049587f9c1d467d6eceb7b367ee5d732743d2c5 | |
| parent | 0fbfc3e76916521b509b63286296dd0762170d34 (diff) | |
| download | rust-248a5301af39f823c92927f81c847f6b2ca32fcd.tar.gz rust-248a5301af39f823c92927f81c847f6b2ca32fcd.zip | |
Move SROA tests.
19 files changed, 469 insertions, 469 deletions
diff --git a/tests/mir-opt/sroa.constant.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.constant.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 9e33215f2b5..00000000000 --- a/tests/mir-opt/sroa.constant.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,46 +0,0 @@ -- // MIR for `constant` before ScalarReplacementOfAggregates -+ // MIR for `constant` after ScalarReplacementOfAggregates - - fn constant() -> () { - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:15: +0:15 - let _1: (usize, u8); // in scope 0 at $DIR/sroa.rs:+2:9: +2:10 -+ let _4: usize; // in scope 0 at $DIR/sroa.rs:+2:9: +2:10 -+ let _5: u8; // in scope 0 at $DIR/sroa.rs:+2:9: +2:10 - scope 1 { -- debug y => _1; // in scope 1 at $DIR/sroa.rs:+2:9: +2:10 -+ debug y => (usize, u8){ .0 => _4, .1 => _5, }; // in scope 1 at $DIR/sroa.rs:+2:9: +2:10 - let _2: usize; // in scope 1 at $DIR/sroa.rs:+3:9: +3:10 - scope 2 { - debug t => _2; // in scope 2 at $DIR/sroa.rs:+3:9: +3:10 - let _3: u8; // in scope 2 at $DIR/sroa.rs:+4:9: +4:10 - scope 3 { - debug u => _3; // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 - } - } - } - - bb0: { -- StorageLive(_1); // scope 0 at $DIR/sroa.rs:+2:9: +2:10 -+ StorageLive(_4); // scope 0 at $DIR/sroa.rs:+2:9: +2:10 -+ StorageLive(_5); // scope 0 at $DIR/sroa.rs:+2:9: +2:10 -+ nop; // scope 0 at $DIR/sroa.rs:+2:9: +2:10 - _1 = const _; // scope 0 at $DIR/sroa.rs:+2:13: +2:14 -+ _4 = move (_1.0: usize); // scope 1 at $DIR/sroa.rs:+3:9: +3:10 -+ _5 = move (_1.1: u8); // scope 1 at $DIR/sroa.rs:+3:9: +3:10 - StorageLive(_2); // scope 1 at $DIR/sroa.rs:+3:9: +3:10 -- _2 = (_1.0: usize); // scope 1 at $DIR/sroa.rs:+3:13: +3:16 -+ _2 = _4; // scope 1 at $DIR/sroa.rs:+3:13: +3:16 - StorageLive(_3); // scope 2 at $DIR/sroa.rs:+4:9: +4:10 -- _3 = (_1.1: u8); // scope 2 at $DIR/sroa.rs:+4:13: +4:16 -+ _3 = _5; // scope 2 at $DIR/sroa.rs:+4:13: +4:16 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:15: +5:2 - StorageDead(_3); // scope 2 at $DIR/sroa.rs:+5:1: +5:2 - StorageDead(_2); // scope 1 at $DIR/sroa.rs:+5:1: +5:2 -- StorageDead(_1); // scope 0 at $DIR/sroa.rs:+5:1: +5:2 -+ StorageDead(_4); // scope 0 at $DIR/sroa.rs:+5:1: +5:2 -+ StorageDead(_5); // scope 0 at $DIR/sroa.rs:+5:1: +5:2 -+ nop; // scope 0 at $DIR/sroa.rs:+5:1: +5:2 - return; // scope 0 at $DIR/sroa.rs:+5:2: +5:2 - } - } - diff --git a/tests/mir-opt/sroa.copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.copies.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 976f6d44b75..00000000000 --- a/tests/mir-opt/sroa.copies.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,91 +0,0 @@ -- // MIR for `copies` before ScalarReplacementOfAggregates -+ // MIR for `copies` after ScalarReplacementOfAggregates - - fn copies(_1: Foo) -> () { - debug x => _1; // in scope 0 at $DIR/sroa.rs:+0:11: +0:12 - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:19: +0:19 - let _2: Foo; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _11: u8; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _12: (); // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _13: &str; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _14: std::option::Option<isize>; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 - scope 1 { -- debug y => _2; // in scope 1 at $DIR/sroa.rs:+1:9: +1:10 -+ debug y => Foo{ .0 => _11, .1 => _12, .2 => _13, .3 => _14, }; // in scope 1 at $DIR/sroa.rs:+1:9: +1:10 - let _3: u8; // in scope 1 at $DIR/sroa.rs:+2:9: +2:10 - scope 2 { - debug t => _3; // in scope 2 at $DIR/sroa.rs:+2:9: +2:10 - let _4: &str; // in scope 2 at $DIR/sroa.rs:+3:9: +3:10 - scope 3 { - debug u => _4; // in scope 3 at $DIR/sroa.rs:+3:9: +3:10 - let _5: Foo; // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ let _7: u8; // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ let _8: (); // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ let _9: &str; // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ let _10: std::option::Option<isize>; // in scope 3 at $DIR/sroa.rs:+4:9: +4:10 - scope 4 { -- debug z => _5; // in scope 4 at $DIR/sroa.rs:+4:9: +4:10 -+ debug z => Foo{ .0 => _7, .1 => _8, .2 => _9, .3 => _10, }; // in scope 4 at $DIR/sroa.rs:+4:9: +4:10 - let _6: (); // in scope 4 at $DIR/sroa.rs:+5:9: +5:10 - scope 5 { - debug a => _6; // in scope 5 at $DIR/sroa.rs:+5:9: +5:10 - } - } - } - } - } - - bb0: { -- StorageLive(_2); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -- _2 = _1; // scope 0 at $DIR/sroa.rs:+1:13: +1:14 -+ StorageLive(_11); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_12); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_13); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_14); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ nop; // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ _11 = (_1.0: u8); // scope 0 at $DIR/sroa.rs:+1:13: +1:14 -+ _12 = (_1.1: ()); // scope 0 at $DIR/sroa.rs:+1:13: +1:14 -+ _13 = (_1.2: &str); // scope 0 at $DIR/sroa.rs:+1:13: +1:14 -+ _14 = (_1.3: std::option::Option<isize>); // scope 0 at $DIR/sroa.rs:+1:13: +1:14 -+ nop; // scope 0 at $DIR/sroa.rs:+1:13: +1:14 - StorageLive(_3); // scope 1 at $DIR/sroa.rs:+2:9: +2:10 -- _3 = (_2.0: u8); // scope 1 at $DIR/sroa.rs:+2:13: +2:16 -+ _3 = _11; // scope 1 at $DIR/sroa.rs:+2:13: +2:16 - StorageLive(_4); // scope 2 at $DIR/sroa.rs:+3:9: +3:10 -- _4 = (_2.2: &str); // scope 2 at $DIR/sroa.rs:+3:13: +3:16 -- StorageLive(_5); // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -- _5 = _2; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 -+ _4 = _13; // scope 2 at $DIR/sroa.rs:+3:13: +3:16 -+ StorageLive(_7); // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ StorageLive(_8); // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ StorageLive(_9); // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ StorageLive(_10); // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ nop; // scope 3 at $DIR/sroa.rs:+4:9: +4:10 -+ _7 = _11; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 -+ _8 = _12; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 -+ _9 = _13; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 -+ _10 = _14; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 -+ nop; // scope 3 at $DIR/sroa.rs:+4:13: +4:14 - StorageLive(_6); // scope 4 at $DIR/sroa.rs:+5:9: +5:10 -- _6 = (_5.1: ()); // scope 4 at $DIR/sroa.rs:+5:13: +5:16 -+ _6 = _8; // scope 4 at $DIR/sroa.rs:+5:13: +5:16 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:19: +6:2 - StorageDead(_6); // scope 4 at $DIR/sroa.rs:+6:1: +6:2 -- StorageDead(_5); // scope 3 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_7); // scope 3 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_8); // scope 3 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_9); // scope 3 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_10); // scope 3 at $DIR/sroa.rs:+6:1: +6:2 -+ nop; // scope 3 at $DIR/sroa.rs:+6:1: +6:2 - StorageDead(_4); // scope 2 at $DIR/sroa.rs:+6:1: +6:2 - StorageDead(_3); // scope 1 at $DIR/sroa.rs:+6:1: +6:2 -- StorageDead(_2); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_11); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_12); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_13); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 -+ StorageDead(_14); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 -+ nop; // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - return; // scope 0 at $DIR/sroa.rs:+6:2: +6:2 - } - } - diff --git a/tests/mir-opt/sroa.dropping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.dropping.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 17a89e7d8eb..00000000000 --- a/tests/mir-opt/sroa.dropping.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,44 +0,0 @@ -- // MIR for `dropping` before ScalarReplacementOfAggregates -+ // MIR for `dropping` after ScalarReplacementOfAggregates - - fn dropping() -> () { - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:19: +0:19 - let _1: Tag; // in scope 0 at $DIR/sroa.rs:+1:5: +1:32 - let mut _2: S; // in scope 0 at $DIR/sroa.rs:+1:5: +1:30 - let mut _3: Tag; // in scope 0 at $DIR/sroa.rs:+1:7: +1:13 - let mut _4: Tag; // in scope 0 at $DIR/sroa.rs:+1:15: +1:21 - let mut _5: Tag; // in scope 0 at $DIR/sroa.rs:+1:23: +1:29 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/sroa.rs:+1:5: +1:32 - StorageLive(_2); // scope 0 at $DIR/sroa.rs:+1:5: +1:30 - StorageLive(_3); // scope 0 at $DIR/sroa.rs:+1:7: +1:13 - _3 = Tag(const 0_usize); // scope 0 at $DIR/sroa.rs:+1:7: +1:13 - StorageLive(_4); // scope 0 at $DIR/sroa.rs:+1:15: +1:21 - _4 = Tag(const 1_usize); // scope 0 at $DIR/sroa.rs:+1:15: +1:21 - StorageLive(_5); // scope 0 at $DIR/sroa.rs:+1:23: +1:29 - _5 = Tag(const 2_usize); // scope 0 at $DIR/sroa.rs:+1:23: +1:29 - _2 = S(move _3, move _4, move _5); // scope 0 at $DIR/sroa.rs:+1:5: +1:30 - StorageDead(_5); // scope 0 at $DIR/sroa.rs:+1:29: +1:30 - StorageDead(_4); // scope 0 at $DIR/sroa.rs:+1:29: +1:30 - StorageDead(_3); // scope 0 at $DIR/sroa.rs:+1:29: +1:30 - _1 = move (_2.1: Tag); // scope 0 at $DIR/sroa.rs:+1:5: +1:32 - drop(_1) -> bb1; // scope 0 at $DIR/sroa.rs:+1:32: +1:33 - } - - bb1: { - drop((_2.0: Tag)) -> bb3; // scope 0 at $DIR/sroa.rs:+1:32: +1:33 - } - - bb2: { - StorageDead(_2); // scope 0 at $DIR/sroa.rs:+1:32: +1:33 - StorageDead(_1); // scope 0 at $DIR/sroa.rs:+1:32: +1:33 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:19: +2:2 - return; // scope 0 at $DIR/sroa.rs:+2:2: +2:2 - } - - bb3: { - drop((_2.2: Tag)) -> bb2; // scope 0 at $DIR/sroa.rs:+1:32: +1:33 - } - } - diff --git a/tests/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 04d26162aad..00000000000 --- a/tests/mir-opt/sroa.enums.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,43 +0,0 @@ -- // MIR for `enums` before ScalarReplacementOfAggregates -+ // MIR for `enums` after ScalarReplacementOfAggregates - - fn enums(_1: usize) -> usize { - debug a => _1; // in scope 0 at $DIR/sroa.rs:+0:14: +0:15 - let mut _0: usize; // return place in scope 0 at $DIR/sroa.rs:+0:27: +0:32 - let mut _2: std::option::Option<usize>; // in scope 0 at $DIR/sroa.rs:+1:22: +1:29 - let mut _3: usize; // in scope 0 at $DIR/sroa.rs:+1:27: +1:28 - let mut _4: isize; // in scope 0 at $DIR/sroa.rs:+1:12: +1:19 - scope 1 { - debug a => _5; // in scope 1 at $DIR/sroa.rs:+1:17: +1:18 - let _5: usize; // in scope 1 at $DIR/sroa.rs:+1:17: +1:18 - } - - bb0: { - StorageLive(_2); // scope 1 at $DIR/sroa.rs:+1:22: +1:29 - StorageLive(_3); // scope 1 at $DIR/sroa.rs:+1:27: +1:28 - _3 = _1; // scope 1 at $DIR/sroa.rs:+1:27: +1:28 - _2 = Option::<usize>::Some(move _3); // scope 1 at $DIR/sroa.rs:+1:22: +1:29 - StorageDead(_3); // scope 1 at $DIR/sroa.rs:+1:28: +1:29 - _4 = discriminant(_2); // scope 1 at $DIR/sroa.rs:+1:12: +1:19 - switchInt(move _4) -> [1: bb1, otherwise: bb2]; // scope 1 at $DIR/sroa.rs:+1:12: +1:19 - } - - bb1: { - StorageLive(_5); // scope 1 at $DIR/sroa.rs:+1:17: +1:18 - _5 = ((_2 as Some).0: usize); // scope 1 at $DIR/sroa.rs:+1:17: +1:18 - _0 = _5; // scope 1 at $DIR/sroa.rs:+1:32: +1:33 - StorageDead(_5); // scope 0 at $DIR/sroa.rs:+1:34: +1:35 - goto -> bb3; // scope 0 at $DIR/sroa.rs:+1:5: +1:46 - } - - bb2: { - _0 = const 0_usize; // scope 0 at $DIR/sroa.rs:+1:43: +1:44 - goto -> bb3; // scope 0 at $DIR/sroa.rs:+1:5: +1:46 - } - - bb3: { - StorageDead(_2); // scope 0 at $DIR/sroa.rs:+2:1: +2:2 - return; // scope 0 at $DIR/sroa.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/sroa.escaping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.escaping.ScalarReplacementOfAggregates.diff deleted file mode 100644 index fd691fdd153..00000000000 --- a/tests/mir-opt/sroa.escaping.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,44 +0,0 @@ -- // MIR for `escaping` before ScalarReplacementOfAggregates -+ // MIR for `escaping` after ScalarReplacementOfAggregates - - fn escaping() -> () { - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:19: +0:19 - let _1: (); // in scope 0 at $DIR/sroa.rs:+1:5: +1:42 - let mut _2: *const u32; // in scope 0 at $DIR/sroa.rs:+1:7: +1:41 - let _3: &u32; // in scope 0 at $DIR/sroa.rs:+1:7: +1:41 - let _4: Escaping; // in scope 0 at $DIR/sroa.rs:+1:8: +1:39 - let mut _5: u32; // in scope 0 at $DIR/sroa.rs:+1:34: +1:37 - - bb0: { - StorageLive(_1); // scope 0 at $DIR/sroa.rs:+1:5: +1:42 - StorageLive(_2); // scope 0 at $DIR/sroa.rs:+1:7: +1:41 - StorageLive(_3); // scope 0 at $DIR/sroa.rs:+1:7: +1:41 - StorageLive(_4); // scope 0 at $DIR/sroa.rs:+1:8: +1:39 - StorageLive(_5); // scope 0 at $DIR/sroa.rs:+1:34: +1:37 - _5 = g() -> bb1; // scope 0 at $DIR/sroa.rs:+1:34: +1:37 - // mir::Constant - // + span: $DIR/sroa.rs:78:34: 78:35 - // + literal: Const { ty: fn() -> u32 {g}, val: Value(<ZST>) } - } - - bb1: { - _4 = Escaping { a: const 1_u32, b: const 2_u32, c: move _5 }; // scope 0 at $DIR/sroa.rs:+1:8: +1:39 - StorageDead(_5); // scope 0 at $DIR/sroa.rs:+1:38: +1:39 - _3 = &(_4.0: u32); // scope 0 at $DIR/sroa.rs:+1:7: +1:41 - _2 = &raw const (*_3); // scope 0 at $DIR/sroa.rs:+1:7: +1:41 - _1 = f(move _2) -> bb2; // scope 0 at $DIR/sroa.rs:+1:5: +1:42 - // mir::Constant - // + span: $DIR/sroa.rs:78:5: 78:6 - // + literal: Const { ty: fn(*const u32) {f}, val: Value(<ZST>) } - } - - bb2: { - StorageDead(_2); // scope 0 at $DIR/sroa.rs:+1:41: +1:42 - StorageDead(_4); // scope 0 at $DIR/sroa.rs:+1:42: +1:43 - StorageDead(_3); // scope 0 at $DIR/sroa.rs:+1:42: +1:43 - StorageDead(_1); // scope 0 at $DIR/sroa.rs:+1:42: +1:43 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:19: +2:2 - return; // scope 0 at $DIR/sroa.rs:+2:2: +2:2 - } - } - diff --git a/tests/mir-opt/sroa.flat.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.flat.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 69631fc0213..00000000000 --- a/tests/mir-opt/sroa.flat.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,80 +0,0 @@ -- // MIR for `flat` before ScalarReplacementOfAggregates -+ // MIR for `flat` after ScalarReplacementOfAggregates - - fn flat() -> () { - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:15: +0:15 - let _1: u8; // in scope 0 at $DIR/sroa.rs:+1:15: +1:16 - let _2: (); // in scope 0 at $DIR/sroa.rs:+1:18: +1:19 - let _3: &str; // in scope 0 at $DIR/sroa.rs:+1:21: +1:22 - let _4: std::option::Option<isize>; // in scope 0 at $DIR/sroa.rs:+1:24: +1:25 - let mut _5: Foo; // in scope 0 at $DIR/sroa.rs:+1:30: +1:70 - let mut _6: (); // in scope 0 at $DIR/sroa.rs:+1:45: +1:47 - let mut _7: std::option::Option<isize>; // in scope 0 at $DIR/sroa.rs:+1:60: +1:68 -+ let mut _8: u8; // in scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ let mut _9: (); // in scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ let mut _10: &str; // in scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ let mut _11: std::option::Option<isize>; // in scope 0 at $DIR/sroa.rs:+1:30: +1:70 - scope 1 { - debug a => _1; // in scope 1 at $DIR/sroa.rs:+1:15: +1:16 - debug b => _2; // in scope 1 at $DIR/sroa.rs:+1:18: +1:19 - debug c => _3; // in scope 1 at $DIR/sroa.rs:+1:21: +1:22 - debug d => _4; // in scope 1 at $DIR/sroa.rs:+1:24: +1:25 - scope 2 { - scope 3 { - scope 4 { - scope 5 { - } - } - } - } - } - - bb0: { -- StorageLive(_5); // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ StorageLive(_8); // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ StorageLive(_9); // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ StorageLive(_10); // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ StorageLive(_11); // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ nop; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 - StorageLive(_6); // scope 0 at $DIR/sroa.rs:+1:45: +1:47 - _6 = (); // scope 0 at $DIR/sroa.rs:+1:45: +1:47 - StorageLive(_7); // scope 0 at $DIR/sroa.rs:+1:60: +1:68 - _7 = Option::<isize>::Some(const -4_isize); // scope 0 at $DIR/sroa.rs:+1:60: +1:68 -- _5 = Foo { a: const 5_u8, b: move _6, c: const "a", d: move _7 }; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ _8 = const 5_u8; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ _9 = move _6; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ _10 = const "a"; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 - // mir::Constant - // + span: $DIR/sroa.rs:53:52: 53:55 - // + literal: Const { ty: &str, val: Value(Slice(..)) } -+ _11 = move _7; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 -+ nop; // scope 0 at $DIR/sroa.rs:+1:30: +1:70 - StorageDead(_7); // scope 0 at $DIR/sroa.rs:+1:69: +1:70 - StorageDead(_6); // scope 0 at $DIR/sroa.rs:+1:69: +1:70 - StorageLive(_1); // scope 0 at $DIR/sroa.rs:+1:15: +1:16 -- _1 = (_5.0: u8); // scope 0 at $DIR/sroa.rs:+1:15: +1:16 -+ _1 = _8; // scope 0 at $DIR/sroa.rs:+1:15: +1:16 - StorageLive(_2); // scope 0 at $DIR/sroa.rs:+1:18: +1:19 -- _2 = (_5.1: ()); // scope 0 at $DIR/sroa.rs:+1:18: +1:19 -+ _2 = _9; // scope 0 at $DIR/sroa.rs:+1:18: +1:19 - StorageLive(_3); // scope 0 at $DIR/sroa.rs:+1:21: +1:22 -- _3 = (_5.2: &str); // scope 0 at $DIR/sroa.rs:+1:21: +1:22 -+ _3 = _10; // scope 0 at $DIR/sroa.rs:+1:21: +1:22 - StorageLive(_4); // scope 0 at $DIR/sroa.rs:+1:24: +1:25 -- _4 = (_5.3: std::option::Option<isize>); // scope 0 at $DIR/sroa.rs:+1:24: +1:25 -- StorageDead(_5); // scope 0 at $DIR/sroa.rs:+1:70: +1:71 -+ _4 = _11; // scope 0 at $DIR/sroa.rs:+1:24: +1:25 -+ StorageDead(_8); // scope 0 at $DIR/sroa.rs:+1:70: +1:71 -+ StorageDead(_9); // scope 0 at $DIR/sroa.rs:+1:70: +1:71 -+ StorageDead(_10); // scope 0 at $DIR/sroa.rs:+1:70: +1:71 -+ StorageDead(_11); // scope 0 at $DIR/sroa.rs:+1:70: +1:71 -+ nop; // scope 0 at $DIR/sroa.rs:+1:70: +1:71 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:15: +6:2 - StorageDead(_4); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - StorageDead(_3); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - StorageDead(_2); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - StorageDead(_1); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - return; // scope 0 at $DIR/sroa.rs:+6:2: +6:2 - } - } - diff --git a/tests/mir-opt/sroa.ref_copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.ref_copies.ScalarReplacementOfAggregates.diff deleted file mode 100644 index f0d62220dd6..00000000000 --- a/tests/mir-opt/sroa.ref_copies.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,56 +0,0 @@ -- // MIR for `ref_copies` before ScalarReplacementOfAggregates -+ // MIR for `ref_copies` after ScalarReplacementOfAggregates - - fn ref_copies(_1: &Foo) -> () { - debug x => _1; // in scope 0 at $DIR/sroa.rs:+0:15: +0:16 - let mut _0: (); // return place in scope 0 at $DIR/sroa.rs:+0:24: +0:24 - let _2: Foo; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _5: u8; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _6: (); // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _7: &str; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ let _8: std::option::Option<isize>; // in scope 0 at $DIR/sroa.rs:+1:9: +1:10 - scope 1 { -- debug y => _2; // in scope 1 at $DIR/sroa.rs:+1:9: +1:10 -+ debug y => Foo{ .0 => _5, .1 => _6, .2 => _7, .3 => _8, }; // in scope 1 at $DIR/sroa.rs:+1:9: +1:10 - let _3: u8; // in scope 1 at $DIR/sroa.rs:+2:9: +2:10 - scope 2 { - debug t => _3; // in scope 2 at $DIR/sroa.rs:+2:9: +2:10 - let _4: &str; // in scope 2 at $DIR/sroa.rs:+3:9: +3:10 - scope 3 { - debug u => _4; // in scope 3 at $DIR/sroa.rs:+3:9: +3:10 - } - } - } - - bb0: { -- StorageLive(_2); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -- _2 = (*_1); // scope 0 at $DIR/sroa.rs:+1:13: +1:15 -+ StorageLive(_5); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_6); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_7); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ StorageLive(_8); // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ nop; // scope 0 at $DIR/sroa.rs:+1:9: +1:10 -+ _5 = ((*_1).0: u8); // scope 0 at $DIR/sroa.rs:+1:13: +1:15 -+ _6 = ((*_1).1: ()); // scope 0 at $DIR/sroa.rs:+1:13: +1:15 -+ _7 = ((*_1).2: &str); // scope 0 at $DIR/sroa.rs:+1:13: +1:15 -+ _8 = ((*_1).3: std::option::Option<isize>); // scope 0 at $DIR/sroa.rs:+1:13: +1:15 -+ nop; // scope 0 at $DIR/sroa.rs:+1:13: +1:15 - StorageLive(_3); // scope 1 at $DIR/sroa.rs:+2:9: +2:10 -- _3 = (_2.0: u8); // scope 1 at $DIR/sroa.rs:+2:13: +2:16 -+ _3 = _5; // scope 1 at $DIR/sroa.rs:+2:13: +2:16 - StorageLive(_4); // scope 2 at $DIR/sroa.rs:+3:9: +3:10 -- _4 = (_2.2: &str); // scope 2 at $DIR/sroa.rs:+3:13: +3:16 -+ _4 = _7; // scope 2 at $DIR/sroa.rs:+3:13: +3:16 - _0 = const (); // scope 0 at $DIR/sroa.rs:+0:24: +4:2 - StorageDead(_4); // scope 2 at $DIR/sroa.rs:+4:1: +4:2 - StorageDead(_3); // scope 1 at $DIR/sroa.rs:+4:1: +4:2 -- StorageDead(_2); // scope 0 at $DIR/sroa.rs:+4:1: +4:2 -+ StorageDead(_5); // scope 0 at $DIR/sroa.rs:+4:1: +4:2 -+ StorageDead(_6); // scope 0 at $DIR/sroa.rs:+4:1: +4:2 -+ StorageDead(_7); // scope 0 at $DIR/sroa.rs:+4:1: +4:2 -+ StorageDead(_8); // scope 0 at $DIR/sroa.rs:+4:1: +4:2 -+ nop; // scope 0 at $DIR/sroa.rs:+4:1: +4:2 - return; // scope 0 at $DIR/sroa.rs:+4:2: +4:2 - } - } - diff --git a/tests/mir-opt/sroa.structs.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.structs.ScalarReplacementOfAggregates.diff deleted file mode 100644 index 2c63d8b266d..00000000000 --- a/tests/mir-opt/sroa.structs.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,33 +0,0 @@ -- // MIR for `structs` before ScalarReplacementOfAggregates -+ // MIR for `structs` after ScalarReplacementOfAggregates - - fn structs(_1: f32) -> f32 { - debug a => _1; // in scope 0 at $DIR/sroa.rs:+0:16: +0:17 - let mut _0: f32; // return place in scope 0 at $DIR/sroa.rs:+0:27: +0:30 - let mut _2: structs::U; // in scope 0 at $DIR/sroa.rs:+6:5: +6:21 - let mut _3: f32; // in scope 0 at $DIR/sroa.rs:+6:18: +6:19 -+ let mut _4: usize; // in scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ let mut _5: f32; // in scope 0 at $DIR/sroa.rs:+6:5: +6:21 - - bb0: { -- StorageLive(_2); // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ StorageLive(_4); // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ StorageLive(_5); // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ nop; // scope 0 at $DIR/sroa.rs:+6:5: +6:21 - StorageLive(_3); // scope 0 at $DIR/sroa.rs:+6:18: +6:19 - _3 = _1; // scope 0 at $DIR/sroa.rs:+6:18: +6:19 -- _2 = U { _foo: const 0_usize, a: move _3 }; // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ _4 = const 0_usize; // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ _5 = move _3; // scope 0 at $DIR/sroa.rs:+6:5: +6:21 -+ nop; // scope 0 at $DIR/sroa.rs:+6:5: +6:21 - StorageDead(_3); // scope 0 at $DIR/sroa.rs:+6:20: +6:21 -- _0 = (_2.1: f32); // scope 0 at $DIR/sroa.rs:+6:5: +6:23 -- StorageDead(_2); // scope 0 at $DIR/sroa.rs:+7:1: +7:2 -+ _0 = _5; // scope 0 at $DIR/sroa.rs:+6:5: +6:23 -+ StorageDead(_4); // scope 0 at $DIR/sroa.rs:+7:1: +7:2 -+ StorageDead(_5); // scope 0 at $DIR/sroa.rs:+7:1: +7:2 -+ nop; // scope 0 at $DIR/sroa.rs:+7:1: +7:2 - return; // scope 0 at $DIR/sroa.rs:+7:2: +7:2 - } - } - diff --git a/tests/mir-opt/sroa.unions.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa.unions.ScalarReplacementOfAggregates.diff deleted file mode 100644 index adfb01385d4..00000000000 --- a/tests/mir-opt/sroa.unions.ScalarReplacementOfAggregates.diff +++ /dev/null @@ -1,23 +0,0 @@ -- // MIR for `unions` before ScalarReplacementOfAggregates -+ // MIR for `unions` after ScalarReplacementOfAggregates - - fn unions(_1: f32) -> u32 { - debug a => _1; // in scope 0 at $DIR/sroa.rs:+0:15: +0:16 - let mut _0: u32; // return place in scope 0 at $DIR/sroa.rs:+0:26: +0:29 - let mut _2: unions::Repr; // in scope 0 at $DIR/sroa.rs:+5:14: +5:27 - let mut _3: f32; // in scope 0 at $DIR/sroa.rs:+5:24: +5:25 - scope 1 { - } - - bb0: { - StorageLive(_2); // scope 1 at $DIR/sroa.rs:+5:14: +5:27 - StorageLive(_3); // scope 1 at $DIR/sroa.rs:+5:24: +5:25 - _3 = _1; // scope 1 at $DIR/sroa.rs:+5:24: +5:25 - _2 = Repr { f: move _3 }; // scope 1 at $DIR/sroa.rs:+5:14: +5:27 - StorageDead(_3); // scope 1 at $DIR/sroa.rs:+5:26: +5:27 - _0 = (_2.1: u32); // scope 1 at $DIR/sroa.rs:+5:14: +5:29 - StorageDead(_2); // scope 0 at $DIR/sroa.rs:+6:1: +6:2 - return; // scope 0 at $DIR/sroa.rs:+6:2: +6:2 - } - } - diff --git a/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff new file mode 100644 index 00000000000..647681f0e7a --- /dev/null +++ b/tests/mir-opt/sroa/structs.constant.ScalarReplacementOfAggregates.diff @@ -0,0 +1,46 @@ +- // MIR for `constant` before ScalarReplacementOfAggregates ++ // 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 + 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 + 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 + scope 3 { + debug u => _3; // in scope 3 at $DIR/structs.rs:+4:9: +4:10 + } + } + } + + 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 + } + } + diff --git a/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff new file mode 100644 index 00000000000..b0b0da8861f --- /dev/null +++ b/tests/mir-opt/sroa/structs.copies.ScalarReplacementOfAggregates.diff @@ -0,0 +1,91 @@ +- // MIR for `copies` before ScalarReplacementOfAggregates ++ // 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 + 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 + 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 + 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 + 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 + scope 5 { + debug a => _6; // in scope 5 at $DIR/structs.rs:+5:9: +5:10 + } + } + } + } + } + + 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 + } + } + diff --git a/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff new file mode 100644 index 00000000000..b6439c00a00 --- /dev/null +++ b/tests/mir-opt/sroa/structs.dropping.ScalarReplacementOfAggregates.diff @@ -0,0 +1,44 @@ +- // MIR for `dropping` before ScalarReplacementOfAggregates ++ // 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 + + 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) -> bb1; // scope 0 at $DIR/structs.rs:+1:32: +1:33 + } + + bb1: { + drop((_2.0: Tag)) -> bb3; // scope 0 at $DIR/structs.rs:+1:32: +1:33 + } + + 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 + } + + bb3: { + drop((_2.2: Tag)) -> bb2; // scope 0 at $DIR/structs.rs:+1:32: +1:33 + } + } + diff --git a/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff new file mode 100644 index 00000000000..ff1e30c2d8f --- /dev/null +++ b/tests/mir-opt/sroa/structs.enums.ScalarReplacementOfAggregates.diff @@ -0,0 +1,43 @@ +- // MIR for `enums` before ScalarReplacementOfAggregates ++ // 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 + 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 + } + + 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 + } + + 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 + } + + 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 + } + + bb3: { + StorageDead(_2); // scope 0 at $DIR/structs.rs:+2:1: +2:2 + return; // scope 0 at $DIR/structs.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff new file mode 100644 index 00000000000..d45823d4bac --- /dev/null +++ b/tests/mir-opt/sroa/structs.escaping.ScalarReplacementOfAggregates.diff @@ -0,0 +1,44 @@ +- // MIR for `escaping` before ScalarReplacementOfAggregates ++ // 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 + + 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() -> bb1; // 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>) } + } + + 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) -> bb2; // 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>) } + } + + 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 + } + } + diff --git a/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff new file mode 100644 index 00000000000..1aa11d17b67 --- /dev/null +++ b/tests/mir-opt/sroa/structs.flat.ScalarReplacementOfAggregates.diff @@ -0,0 +1,80 @@ +- // MIR for `flat` before ScalarReplacementOfAggregates ++ // 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 + 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 + scope 2 { + scope 3 { + scope 4 { + scope 5 { + } + } + } + } + } + + 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 + } + } + diff --git a/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff new file mode 100644 index 00000000000..7b09ac18263 --- /dev/null +++ b/tests/mir-opt/sroa/structs.ref_copies.ScalarReplacementOfAggregates.diff @@ -0,0 +1,56 @@ +- // MIR for `ref_copies` before ScalarReplacementOfAggregates ++ // 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 + 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 + 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 + scope 3 { + debug u => _4; // in scope 3 at $DIR/structs.rs:+3:9: +3:10 + } + } + } + + 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 + } + } + diff --git a/tests/mir-opt/sroa.rs b/tests/mir-opt/sroa/structs.rs index fff92cf8d9f..7946eeaeae4 100644 --- a/tests/mir-opt/sroa.rs +++ b/tests/mir-opt/sroa/structs.rs @@ -111,12 +111,12 @@ fn main() { constant(); } -// EMIT_MIR sroa.dropping.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.enums.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.structs.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.unions.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.flat.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.escaping.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.copies.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.ref_copies.ScalarReplacementOfAggregates.diff -// EMIT_MIR sroa.constant.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.dropping.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.enums.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.structs.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.unions.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.flat.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.escaping.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.copies.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.ref_copies.ScalarReplacementOfAggregates.diff +// EMIT_MIR structs.constant.ScalarReplacementOfAggregates.diff diff --git a/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff new file mode 100644 index 00000000000..c94e4b137bc --- /dev/null +++ b/tests/mir-opt/sroa/structs.structs.ScalarReplacementOfAggregates.diff @@ -0,0 +1,33 @@ +- // MIR for `structs` before ScalarReplacementOfAggregates ++ // 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 + + 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 + } + } + diff --git a/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff new file mode 100644 index 00000000000..5aa054589e4 --- /dev/null +++ b/tests/mir-opt/sroa/structs.unions.ScalarReplacementOfAggregates.diff @@ -0,0 +1,23 @@ +- // MIR for `unions` before ScalarReplacementOfAggregates ++ // 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 + 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 + } + } + |
