- // MIR for `enum_different_variant` before GVN + // MIR for `enum_different_variant` after GVN fn enum_different_variant(_1: &Enum1) -> Enum1 { debug v => _1; let mut _0: Enum1; let mut _2: isize; let _3: &AllCopy; let mut _8: i32; let mut _9: u64; let mut _10: [i8; 3]; let mut _11: AllCopy; let _12: &AllCopy; let mut _17: i32; let mut _18: u64; let mut _19: [i8; 3]; let mut _20: AllCopy; scope 1 { debug v => _3; let _4: i32; scope 2 { debug a => _4; let _5: u64; scope 3 { debug b => _5; let _6: [i8; 3]; scope 4 { debug c => _6; let _7: AllCopy; scope 5 { debug all_copy => _7; } } } } } scope 6 { debug v => _12; let _13: i32; scope 7 { debug a => _13; let _14: u64; scope 8 { debug b => _14; let _15: [i8; 3]; scope 9 { debug c => _15; let _16: AllCopy; scope 10 { debug all_copy => _16; } } } } } bb0: { _2 = discriminant((*_1)); switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1]; } bb1: { unreachable; } bb2: { StorageLive(_12); _12 = &(((*_1) as B).0: AllCopy); - StorageLive(_13); - _13 = copy ((*_12).0: i32); - StorageLive(_14); - _14 = copy ((*_12).1: u64); - StorageLive(_15); - _15 = copy ((*_12).2: [i8; 3]); - StorageLive(_16); + nop; + _13 = copy ((((*_1) as B).0: AllCopy).0: i32); + nop; + _14 = copy ((((*_1) as B).0: AllCopy).1: u64); + nop; + _15 = copy ((((*_1) as B).0: AllCopy).2: [i8; 3]); + nop; StorageLive(_17); _17 = copy _13; StorageLive(_18); _18 = copy _14; StorageLive(_19); _19 = copy _15; - _16 = AllCopy { a: move _17, b: move _18, c: move _19 }; + _16 = copy (((*_1) as B).0: AllCopy); StorageDead(_19); StorageDead(_18); StorageDead(_17); StorageLive(_20); - _20 = move _16; - _0 = Enum1::A(move _20); + _20 = copy _16; + _0 = Enum1::A(copy _16); StorageDead(_20); - StorageDead(_16); - StorageDead(_15); - StorageDead(_14); - StorageDead(_13); + nop; + nop; + nop; + nop; StorageDead(_12); goto -> bb4; } bb3: { StorageLive(_3); _3 = &(((*_1) as A).0: AllCopy); - StorageLive(_4); - _4 = copy ((*_3).0: i32); - StorageLive(_5); - _5 = copy ((*_3).1: u64); - StorageLive(_6); - _6 = copy ((*_3).2: [i8; 3]); - StorageLive(_7); + nop; + _4 = copy ((((*_1) as A).0: AllCopy).0: i32); + nop; + _5 = copy ((((*_1) as A).0: AllCopy).1: u64); + nop; + _6 = copy ((((*_1) as A).0: AllCopy).2: [i8; 3]); + nop; StorageLive(_8); _8 = copy _4; StorageLive(_9); _9 = copy _5; StorageLive(_10); _10 = copy _6; - _7 = AllCopy { a: move _8, b: move _9, c: move _10 }; + _7 = copy (((*_1) as A).0: AllCopy); StorageDead(_10); StorageDead(_9); StorageDead(_8); StorageLive(_11); - _11 = move _7; - _0 = Enum1::B(move _11); + _11 = copy _7; + _0 = Enum1::B(copy _7); StorageDead(_11); - StorageDead(_7); - StorageDead(_6); - StorageDead(_5); - StorageDead(_4); + nop; + nop; + nop; + nop; StorageDead(_3); goto -> bb4; } bb4: { return; } }