Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-i-m committed Mar 20, 2021
1 parent fd516af commit b9ecba3
Show file tree
Hide file tree
Showing 74 changed files with 320 additions and 652 deletions.
2 changes: 0 additions & 2 deletions src/test/mir-opt/exponential-or.rs
@@ -1,7 +1,5 @@
// Test that simple or-patterns don't get expanded to exponentially large CFGs

#![feature(or_patterns)]

// EMIT_MIR exponential_or.match_tuple.SimplifyCfg-initial.after.mir
fn match_tuple(x: (u32, bool, Option<i32>, u32)) -> u32 {
match x {
Expand Down
@@ -1,83 +1,83 @@
// MIR for `match_tuple` after SimplifyCfg-initial

fn match_tuple(_1: (u32, bool, Option<i32>, u32)) -> u32 {
debug x => _1; // in scope 0 at $DIR/exponential-or.rs:6:16: 6:17
let mut _0: u32; // return place in scope 0 at $DIR/exponential-or.rs:6:53: 6:56
let mut _2: isize; // in scope 0 at $DIR/exponential-or.rs:8:37: 8:48
let mut _3: bool; // in scope 0 at $DIR/exponential-or.rs:8:70: 8:77
let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:8:70: 8:77
let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:8:62: 8:67
let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:8:62: 8:67
let _7: u32; // in scope 0 at $DIR/exponential-or.rs:8:10: 8:21
let _8: u32; // in scope 0 at $DIR/exponential-or.rs:8:57: 8:78
let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:8:83: 8:84
let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:8:87: 8:88
debug x => _1; // in scope 0 at $DIR/exponential-or.rs:4:16: 4:17
let mut _0: u32; // return place in scope 0 at $DIR/exponential-or.rs:4:53: 4:56
let mut _2: isize; // in scope 0 at $DIR/exponential-or.rs:6:37: 6:48
let mut _3: bool; // in scope 0 at $DIR/exponential-or.rs:6:70: 6:77
let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:6:70: 6:77
let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:6:62: 6:67
let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:6:62: 6:67
let _7: u32; // in scope 0 at $DIR/exponential-or.rs:6:10: 6:21
let _8: u32; // in scope 0 at $DIR/exponential-or.rs:6:57: 6:78
let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:6:83: 6:84
let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:6:87: 6:88
scope 1 {
debug y => _7; // in scope 1 at $DIR/exponential-or.rs:8:10: 8:21
debug z => _8; // in scope 1 at $DIR/exponential-or.rs:8:57: 8:78
debug y => _7; // in scope 1 at $DIR/exponential-or.rs:6:10: 6:21
debug z => _8; // in scope 1 at $DIR/exponential-or.rs:6:57: 6:78
}

bb0: {
FakeRead(ForMatchedPlace, _1); // scope 0 at $DIR/exponential-or.rs:7:11: 7:12
switchInt((_1.0: u32)) -> [1_u32: bb2, 4_u32: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:8:15: 8:16
FakeRead(ForMatchedPlace, _1); // scope 0 at $DIR/exponential-or.rs:5:11: 5:12
switchInt((_1.0: u32)) -> [1_u32: bb2, 4_u32: bb2, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:6:15: 6:16
}

bb1: {
_0 = const 0_u32; // scope 0 at $DIR/exponential-or.rs:9:14: 9:15
goto -> bb10; // scope 0 at $DIR/exponential-or.rs:7:5: 10:6
_0 = const 0_u32; // scope 0 at $DIR/exponential-or.rs:7:14: 7:15
goto -> bb10; // scope 0 at $DIR/exponential-or.rs:5:5: 8:6
}

bb2: {
_2 = discriminant((_1.2: std::option::Option<i32>)); // scope 0 at $DIR/exponential-or.rs:8:37: 8:48
switchInt(move _2) -> [0_isize: bb4, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:8:37: 8:48
_2 = discriminant((_1.2: std::option::Option<i32>)); // scope 0 at $DIR/exponential-or.rs:6:37: 6:48
switchInt(move _2) -> [0_isize: bb4, 1_isize: bb3, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:6:37: 6:48
}

bb3: {
switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1_i32: bb4, 8_i32: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:8:42: 8:43
switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1_i32: bb4, 8_i32: bb4, otherwise: bb1]; // scope 0 at $DIR/exponential-or.rs:6:42: 6:43
}

bb4: {
_5 = Le(const 6_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:8:62: 8:67
switchInt(move _5) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential-or.rs:8:62: 8:67
_5 = Le(const 6_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:6:62: 6:67
switchInt(move _5) -> [false: bb6, otherwise: bb5]; // scope 0 at $DIR/exponential-or.rs:6:62: 6:67
}

bb5: {
_6 = Le((_1.3: u32), const 9_u32); // scope 0 at $DIR/exponential-or.rs:8:62: 8:67
switchInt(move _6) -> [false: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:8:62: 8:67
_6 = Le((_1.3: u32), const 9_u32); // scope 0 at $DIR/exponential-or.rs:6:62: 6:67
switchInt(move _6) -> [false: bb6, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:6:62: 6:67
}

bb6: {
_3 = Le(const 13_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:8:70: 8:77
switchInt(move _3) -> [false: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential-or.rs:8:70: 8:77
_3 = Le(const 13_u32, (_1.3: u32)); // scope 0 at $DIR/exponential-or.rs:6:70: 6:77
switchInt(move _3) -> [false: bb1, otherwise: bb7]; // scope 0 at $DIR/exponential-or.rs:6:70: 6:77
}

bb7: {
_4 = Le((_1.3: u32), const 16_u32); // scope 0 at $DIR/exponential-or.rs:8:70: 8:77
switchInt(move _4) -> [false: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:8:70: 8:77
_4 = Le((_1.3: u32), const 16_u32); // scope 0 at $DIR/exponential-or.rs:6:70: 6:77
switchInt(move _4) -> [false: bb1, otherwise: bb8]; // scope 0 at $DIR/exponential-or.rs:6:70: 6:77
}

bb8: {
falseEdge -> [real: bb9, imaginary: bb1]; // scope 0 at $DIR/exponential-or.rs:8:9: 8:79
falseEdge -> [real: bb9, imaginary: bb1]; // scope 0 at $DIR/exponential-or.rs:6:9: 6:79
}

bb9: {
StorageLive(_7); // scope 0 at $DIR/exponential-or.rs:8:10: 8:21
_7 = (_1.0: u32); // scope 0 at $DIR/exponential-or.rs:8:10: 8:21
StorageLive(_8); // scope 0 at $DIR/exponential-or.rs:8:57: 8:78
_8 = (_1.3: u32); // scope 0 at $DIR/exponential-or.rs:8:57: 8:78
StorageLive(_9); // scope 1 at $DIR/exponential-or.rs:8:83: 8:84
_9 = _7; // scope 1 at $DIR/exponential-or.rs:8:83: 8:84
StorageLive(_10); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88
_10 = _8; // scope 1 at $DIR/exponential-or.rs:8:87: 8:88
_0 = BitXor(move _9, move _10); // scope 1 at $DIR/exponential-or.rs:8:83: 8:88
StorageDead(_10); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88
StorageDead(_9); // scope 1 at $DIR/exponential-or.rs:8:87: 8:88
StorageDead(_8); // scope 0 at $DIR/exponential-or.rs:8:87: 8:88
StorageDead(_7); // scope 0 at $DIR/exponential-or.rs:8:87: 8:88
goto -> bb10; // scope 0 at $DIR/exponential-or.rs:7:5: 10:6
StorageLive(_7); // scope 0 at $DIR/exponential-or.rs:6:10: 6:21
_7 = (_1.0: u32); // scope 0 at $DIR/exponential-or.rs:6:10: 6:21
StorageLive(_8); // scope 0 at $DIR/exponential-or.rs:6:57: 6:78
_8 = (_1.3: u32); // scope 0 at $DIR/exponential-or.rs:6:57: 6:78
StorageLive(_9); // scope 1 at $DIR/exponential-or.rs:6:83: 6:84
_9 = _7; // scope 1 at $DIR/exponential-or.rs:6:83: 6:84
StorageLive(_10); // scope 1 at $DIR/exponential-or.rs:6:87: 6:88
_10 = _8; // scope 1 at $DIR/exponential-or.rs:6:87: 6:88
_0 = BitXor(move _9, move _10); // scope 1 at $DIR/exponential-or.rs:6:83: 6:88
StorageDead(_10); // scope 1 at $DIR/exponential-or.rs:6:87: 6:88
StorageDead(_9); // scope 1 at $DIR/exponential-or.rs:6:87: 6:88
StorageDead(_8); // scope 0 at $DIR/exponential-or.rs:6:87: 6:88
StorageDead(_7); // scope 0 at $DIR/exponential-or.rs:6:87: 6:88
goto -> bb10; // scope 0 at $DIR/exponential-or.rs:5:5: 8:6
}

bb10: {
return; // scope 0 at $DIR/exponential-or.rs:11:2: 11:2
return; // scope 0 at $DIR/exponential-or.rs:9:2: 9:2
}
}
1 change: 0 additions & 1 deletion src/test/mir-opt/issues/issue-75439.rs
@@ -1,7 +1,6 @@
// EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff

#![feature(const_fn_transmute)]
#![feature(or_patterns)]

use std::mem::transmute;

Expand Down
Expand Up @@ -2,17 +2,17 @@
+ // MIR for `foo` after MatchBranchSimplification

fn foo(_1: [u8; 16]) -> Option<[u8; 4]> {
debug bytes => _1; // in scope 0 at $DIR/issue-75439.rs:8:12: 8:17
let mut _0: std::option::Option<[u8; 4]>; // return place in scope 0 at $DIR/issue-75439.rs:8:32: 8:47
let _2: [u32; 4]; // in scope 0 at $DIR/issue-75439.rs:10:9: 10:15
let mut _3: [u8; 16]; // in scope 0 at $DIR/issue-75439.rs:10:47: 10:52
let mut _5: [u8; 4]; // in scope 0 at $DIR/issue-75439.rs:13:14: 13:38
let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:13:33: 13:35
debug bytes => _1; // in scope 0 at $DIR/issue-75439.rs:7:12: 7:17
let mut _0: std::option::Option<[u8; 4]>; // return place in scope 0 at $DIR/issue-75439.rs:7:32: 7:47
let _2: [u32; 4]; // in scope 0 at $DIR/issue-75439.rs:9:9: 9:15
let mut _3: [u8; 16]; // in scope 0 at $DIR/issue-75439.rs:9:47: 9:52
let mut _5: [u8; 4]; // in scope 0 at $DIR/issue-75439.rs:12:14: 12:38
let mut _6: u32; // in scope 0 at $DIR/issue-75439.rs:12:33: 12:35
scope 1 {
debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:10:9: 10:15
let _4: u32; // in scope 1 at $DIR/issue-75439.rs:12:27: 12:29
debug dwords => _2; // in scope 1 at $DIR/issue-75439.rs:9:9: 9:15
let _4: u32; // in scope 1 at $DIR/issue-75439.rs:11:27: 11:29
scope 3 {
debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:12:27: 12:29
debug ip => _4; // in scope 3 at $DIR/issue-75439.rs:11:27: 11:29
scope 4 {
}
}
Expand All @@ -21,67 +21,67 @@
}

bb0: {
StorageLive(_2); // scope 0 at $DIR/issue-75439.rs:10:9: 10:15
StorageLive(_3); // scope 2 at $DIR/issue-75439.rs:10:47: 10:52
_3 = _1; // scope 2 at $DIR/issue-75439.rs:10:47: 10:52
_2 = transmute::<[u8; 16], [u32; 4]>(move _3) -> bb1; // scope 2 at $DIR/issue-75439.rs:10:37: 10:53
StorageLive(_2); // scope 0 at $DIR/issue-75439.rs:9:9: 9:15
StorageLive(_3); // scope 2 at $DIR/issue-75439.rs:9:47: 9:52
_3 = _1; // scope 2 at $DIR/issue-75439.rs:9:47: 9:52
_2 = transmute::<[u8; 16], [u32; 4]>(move _3) -> bb1; // scope 2 at $DIR/issue-75439.rs:9:37: 9:53
// mir::Constant
// + span: $DIR/issue-75439.rs:10:37: 10:46
// + span: $DIR/issue-75439.rs:9:37: 9:46
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn([u8; 16]) -> [u32; 4] {std::intrinsics::transmute::<[u8; 16], [u32; 4]>}, val: Value(Scalar(<ZST>)) }
}

bb1: {
StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:10:52: 10:53
switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:12:13: 12:14
StorageDead(_3); // scope 2 at $DIR/issue-75439.rs:9:52: 9:53
switchInt(_2[0 of 4]) -> [0_u32: bb2, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:13: 11:14
}

bb2: {
switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:12:16: 12:17
switchInt(_2[1 of 4]) -> [0_u32: bb3, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:16: 11:17
}

bb3: {
switchInt(_2[2 of 4]) -> [0_u32: bb6, 4294901760_u32: bb7, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:12:19: 12:20
switchInt(_2[2 of 4]) -> [0_u32: bb6, 4294901760_u32: bb7, otherwise: bb4]; // scope 1 at $DIR/issue-75439.rs:11:19: 11:20
}

bb4: {
discriminant(_0) = 0; // scope 1 at $DIR/issue-75439.rs:15:9: 15:13
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6
discriminant(_0) = 0; // scope 1 at $DIR/issue-75439.rs:14:9: 14:13
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
}

bb5: {
StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:13:14: 13:38
StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:13:33: 13:35
_6 = _4; // scope 4 at $DIR/issue-75439.rs:13:33: 13:35
_5 = transmute::<u32, [u8; 4]>(move _6) -> bb8; // scope 4 at $DIR/issue-75439.rs:13:23: 13:36
StorageLive(_5); // scope 3 at $DIR/issue-75439.rs:12:14: 12:38
StorageLive(_6); // scope 4 at $DIR/issue-75439.rs:12:33: 12:35
_6 = _4; // scope 4 at $DIR/issue-75439.rs:12:33: 12:35
_5 = transmute::<u32, [u8; 4]>(move _6) -> bb8; // scope 4 at $DIR/issue-75439.rs:12:23: 12:36
// mir::Constant
// + span: $DIR/issue-75439.rs:13:23: 13:32
// + span: $DIR/issue-75439.rs:12:23: 12:32
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u32) -> [u8; 4] {std::intrinsics::transmute::<u32, [u8; 4]>}, val: Value(Scalar(<ZST>)) }
}

bb6: {
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:12:27: 12:29
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:12:27: 12:29
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
}

bb7: {
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:12:27: 12:29
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:12:27: 12:29
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6
StorageLive(_4); // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
_4 = _2[3 of 4]; // scope 1 at $DIR/issue-75439.rs:11:27: 11:29
goto -> bb5; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
}

bb8: {
StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:13:35: 13:36
((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:13:9: 13:39
discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:13:9: 13:39
StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:13:38: 13:39
StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:14:5: 14:6
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:12:5: 16:6
StorageDead(_6); // scope 4 at $DIR/issue-75439.rs:12:35: 12:36
((_0 as Some).0: [u8; 4]) = move _5; // scope 3 at $DIR/issue-75439.rs:12:9: 12:39
discriminant(_0) = 1; // scope 3 at $DIR/issue-75439.rs:12:9: 12:39
StorageDead(_5); // scope 3 at $DIR/issue-75439.rs:12:38: 12:39
StorageDead(_4); // scope 1 at $DIR/issue-75439.rs:13:5: 13:6
goto -> bb9; // scope 1 at $DIR/issue-75439.rs:11:5: 15:6
}

bb9: {
StorageDead(_2); // scope 0 at $DIR/issue-75439.rs:17:1: 17:2
return; // scope 0 at $DIR/issue-75439.rs:17:2: 17:2
StorageDead(_2); // scope 0 at $DIR/issue-75439.rs:16:1: 16:2
return; // scope 0 at $DIR/issue-75439.rs:16:2: 16:2
}
}

@@ -1,6 +1,5 @@
// Tests using a combination of pattern features has the expected borrow checking behavior
#![feature(bindings_after_at)]
#![feature(or_patterns)]
#![feature(box_patterns)]

enum Test {
Expand Down

0 comments on commit b9ecba3

Please sign in to comment.