diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff.32bit b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff.32bit new file mode 100644 index 00000000000..df94c897e92 --- /dev/null +++ b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff.32bit @@ -0,0 +1,66 @@ +- // MIR for `foo` before MatchBranchSimplification ++ // MIR for `foo` after MatchBranchSimplification + + fn foo(_1: std::option::Option<()>) -> () { + debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:4:8: 4:11 + let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:4:25: 4:25 + let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + let mut _3: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:5:22: 5:26 + + bb0: { + StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _3 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:5:22: 5:26 +- switchInt(move _3) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:5:22: 5:26 ++ _2 = Eq(move _3, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ // ty::Const ++ // + ty: isize ++ // + val: Value(Scalar(0x00000000)) ++ // mir::Constant ++ // + span: $DIR/matches_reduce_branches.rs:1:1: 1:1 ++ // + literal: Const { ty: isize, val: Value(Scalar(0x00000000)) } ++ goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:5:22: 5:26 + } + + bb1: { + _2 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: bool + // + val: Value(Scalar(0x00)) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: bool, val: Value(Scalar(0x00)) } + goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb2: { + _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + // ty::Const + // + ty: bool + // + val: Value(Scalar(0x01)) + // mir::Constant + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } + goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + } + + bb3: { + switchInt(_2) -> [false: bb4, otherwise: bb5]; // scope 0 at $DIR/matches_reduce_branches.rs:5:5: 7:6 + } + + bb4: { + _0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:5:5: 7:6 + // ty::Const + // + ty: () + // + val: Value(Scalar()) + // mir::Constant + // + span: $DIR/matches_reduce_branches.rs:5:5: 7:6 + // + literal: Const { ty: (), val: Value(Scalar()) } + goto -> bb5; // scope 0 at $DIR/matches_reduce_branches.rs:5:5: 7:6 + } + + bb5: { + StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:8:1: 8:2 + return; // scope 0 at $DIR/matches_reduce_branches.rs:8:2: 8:2 + } + } + diff --git a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff.64bit similarity index 75% rename from src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff rename to src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff.64bit index b0a861f6c5e..06849b4a5d9 100644 --- a/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff +++ b/src/test/mir-opt/matches_reduce_branches.foo.MatchBranchSimplification.diff.64bit @@ -2,16 +2,23 @@ + // MIR for `foo` after MatchBranchSimplification fn foo(_1: std::option::Option<()>) -> () { - debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:3:8: 3:11 - let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:3:25: 3:25 + debug bar => _1; // in scope 0 at $DIR/matches_reduce_branches.rs:4:8: 4:11 + let mut _0: (); // return place in scope 0 at $DIR/matches_reduce_branches.rs:4:25: 4:25 let mut _2: bool; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - let mut _3: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:4:22: 4:26 + let mut _3: isize; // in scope 0 at $DIR/matches_reduce_branches.rs:5:22: 5:26 bb0: { StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL - _3 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:4:22: 4:26 -- switchInt(move _3) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:4:22: 4:26 -+ goto -> bb2; // scope 0 at $DIR/matches_reduce_branches.rs:4:22: 4:26 + _3 = discriminant(_1); // scope 0 at $DIR/matches_reduce_branches.rs:5:22: 5:26 +- switchInt(move _3) -> [0_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/matches_reduce_branches.rs:5:22: 5:26 ++ _2 = Eq(move _3, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL ++ // ty::Const ++ // + ty: isize ++ // + val: Value(Scalar(0x0000000000000000)) ++ // mir::Constant ++ // + span: $DIR/matches_reduce_branches.rs:1:1: 1:1 ++ // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000000)) } ++ goto -> bb3; // scope 0 at $DIR/matches_reduce_branches.rs:5:22: 5:26 } bb1: { @@ -26,39 +33,34 @@ } bb2: { -- _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL -+ _2 = Eq(move _3, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL + _2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL // ty::Const -- // + ty: bool -- // + val: Value(Scalar(0x01)) -+ // + ty: isize -+ // + val: Value(Scalar(0x0000000000000000)) + // + ty: bool + // + val: Value(Scalar(0x01)) // mir::Constant -- // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL -- // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } -+ // + span: $DIR/matches_reduce_branches.rs:1:1: 1:1 -+ // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000000)) } + // + span: $SRC_DIR/core/src/macros/mod.rs:LL:COL + // + literal: Const { ty: bool, val: Value(Scalar(0x01)) } goto -> bb3; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL } bb3: { - switchInt(_2) -> [false: bb4, otherwise: bb5]; // scope 0 at $DIR/matches_reduce_branches.rs:4:5: 6:6 + switchInt(_2) -> [false: bb4, otherwise: bb5]; // scope 0 at $DIR/matches_reduce_branches.rs:5:5: 7:6 } bb4: { - _0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:4:5: 6:6 + _0 = const (); // scope 0 at $DIR/matches_reduce_branches.rs:5:5: 7:6 // ty::Const // + ty: () // + val: Value(Scalar()) // mir::Constant - // + span: $DIR/matches_reduce_branches.rs:4:5: 6:6 + // + span: $DIR/matches_reduce_branches.rs:5:5: 7:6 // + literal: Const { ty: (), val: Value(Scalar()) } - goto -> bb5; // scope 0 at $DIR/matches_reduce_branches.rs:4:5: 6:6 + goto -> bb5; // scope 0 at $DIR/matches_reduce_branches.rs:5:5: 7:6 } bb5: { - StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:7:1: 7:2 - return; // scope 0 at $DIR/matches_reduce_branches.rs:7:2: 7:2 + StorageDead(_2); // scope 0 at $DIR/matches_reduce_branches.rs:8:1: 8:2 + return; // scope 0 at $DIR/matches_reduce_branches.rs:8:2: 8:2 } } diff --git a/src/test/mir-opt/matches_reduce_branches.rs b/src/test/mir-opt/matches_reduce_branches.rs index 2d1a6d8de21..91b6bfc836b 100644 --- a/src/test/mir-opt/matches_reduce_branches.rs +++ b/src/test/mir-opt/matches_reduce_branches.rs @@ -1,3 +1,4 @@ +// EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR matches_reduce_branches.foo.MatchBranchSimplification.diff fn foo(bar: Option<()>) {