forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#119759 - sfzhu93:master, r=cjgillot
Add FileCheck annotations to dataflow-const-prop tests part of rust-lang#116971. A few shadowing variable names are changed, so that it is easier to match the variable names in MIR using FileCheck syntax. Also, there's a FIXME in [enum.rs](https://github.com/rust-lang/rust/pull/119759/files#diff-7621f55327838e489a95ac99ae1e6126b37c57aff582594e6bee9d7e7e56fc58) because the MIR looks suspicious to me. It has been explained in the comments. r? cjgillot
- Loading branch information
Showing
32 changed files
with
394 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
// skip-filecheck | ||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY | ||
// unit-test: DataflowConstProp | ||
// EMIT_MIR_FOR_EACH_BIT_WIDTH | ||
|
||
// EMIT_MIR array_index.main.DataflowConstProp.diff | ||
|
||
// CHECK-LABEL: fn main() -> () { | ||
fn main() { | ||
// CHECK: let mut [[array_lit:_.*]]: [u32; 4]; | ||
// CHECK: debug x => [[x:_.*]]; | ||
|
||
// CHECK: [[array_lit]] = [const 0_u32, const 1_u32, const 2_u32, const 3_u32]; | ||
// CHECK-NOT: {{_.*}} = Len( | ||
// CHECK-NOT: {{_.*}} = Lt( | ||
// CHECK-NOT: assert(move _ | ||
// CHECK: {{_.*}} = const 4_usize; | ||
// CHECK: {{_.*}} = const true; | ||
// CHECK: assert(const true | ||
// CHECK: [[x]] = [[array_lit]][2 of 3]; | ||
let x: u32 = [0, 1, 2, 3][2]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
// skip-filecheck | ||
// unit-test: DataflowConstProp | ||
|
||
// EMIT_MIR boolean_identities.test.DataflowConstProp.diff | ||
|
||
// CHECK-LABEL: fn test( | ||
pub fn test(x: bool, y: bool) -> bool { | ||
// CHECK-NOT: BitAnd( | ||
// CHECK-NOT: BitOr( | ||
(y | true) & (x & false) | ||
// CHECK: _0 = const false; | ||
// CHECK-NOT: BitAnd( | ||
// CHECK-NOT: BitOr( | ||
} | ||
|
||
// CHECK-LABEL: fn main( | ||
fn main() { | ||
test(true, false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
// skip-filecheck | ||
// unit-test: DataflowConstProp | ||
|
||
// EMIT_MIR cast.main.DataflowConstProp.diff | ||
|
||
// CHECK-LABEL: fn main( | ||
fn main() { | ||
// CHECK: debug a => [[a:_.*]]; | ||
// CHECK: debug b => [[b:_.*]]; | ||
|
||
// CHECK: [[a]] = const 257_i32; | ||
let a = 257; | ||
// CHECK: [[b]] = const 2_u8; | ||
let b = a as u8 + 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
// skip-filecheck | ||
// unit-test: DataflowConstProp | ||
// compile-flags: -Coverflow-checks=on | ||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY | ||
|
||
// EMIT_MIR checked.main.DataflowConstProp.diff | ||
#[allow(arithmetic_overflow)] | ||
|
||
// CHECK-LABEL: fn main( | ||
fn main() { | ||
// CHECK: debug a => [[a:_.*]]; | ||
// CHECK: debug b => [[b:_.*]]; | ||
// CHECK: debug c => [[c:_.*]]; | ||
// CHECK: debug d => [[d:_.*]]; | ||
// CHECK: debug e => [[e:_.*]]; | ||
|
||
// CHECK: [[a]] = const 1_i32; | ||
let a = 1; | ||
|
||
// CHECK: [[b]] = const 2_i32; | ||
let b = 2; | ||
|
||
// CHECK: assert(!const false, | ||
// CHECK: [[c]] = const 3_i32; | ||
let c = a + b; | ||
|
||
// CHECK: [[d]] = const _; | ||
let d = i32::MAX; | ||
|
||
// CHECK: assert(!const true, | ||
// CHECK: [[e]] = const i32::MIN; | ||
let e = d + 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,29 @@ | ||
// skip-filecheck | ||
// unit-test: DataflowConstProp | ||
// compile-flags: -Zmir-enable-passes=+GVN,+Inline | ||
// ignore-debug assertions change the output MIR | ||
// EMIT_MIR_FOR_EACH_BIT_WIDTH | ||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY | ||
|
||
// This test is to check ICE in issue [#115789](https://github.com/rust-lang/rust/issues/115789). | ||
|
||
struct A { | ||
foo: Box<[bool]>, | ||
} | ||
|
||
// EMIT_MIR default_boxed_slice.main.GVN.diff | ||
// EMIT_MIR default_boxed_slice.main.DataflowConstProp.diff | ||
|
||
// CHECK-LABEL: fn main( | ||
fn main() { | ||
// ConstProp will create a constant of type `Box<[bool]>`. | ||
// FIXME: it is not yet a constant. | ||
|
||
// Verify that `DataflowConstProp` does not ICE trying to dereference it directly. | ||
|
||
// CHECK: debug a => [[a:_.*]]; | ||
// We may check other inlined functions as well... | ||
|
||
// CHECK: {{_.*}} = Box::<[bool]>( | ||
// FIXME: should be `{{_.*}} = const Box::<[bool]>` | ||
let a: A = A { foo: Box::default() }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.