Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FileCheck annotations to dataflow-const-prop tests #119759

Merged
merged 19 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tests/mir-opt/dataflow-const-prop/array_index.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
// 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:_.*]];

let x: u32 = [0, 1, 2, 3][2];
// CHECK: bb{{[0-9]+}}: {
// CHECK: [[array_lit]] = [const 0_u32, const 1_u32, const 2_u32, const 3_u32];
// CHECK: [[index:_.*]] = const 2_usize;
// CHECK: bb{{[0-9]+}}: {
// CHECK-NOT: [[x]] = [[array_lit]][[[index]]];
sfzhu93 marked this conversation as resolved.
Show resolved Hide resolved
// CHECK: [[x]] = [[array_lit]][2 of 3];
}
5 changes: 4 additions & 1 deletion tests/mir-opt/dataflow-const-prop/boolean_identities.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// skip-filecheck
// unit-test: DataflowConstProp

// EMIT_MIR boolean_identities.test.DataflowConstProp.diff

// CHECK-LABEL: fn test(
pub fn test(x: bool, y: bool) -> bool {
(y | true) & (x & false)
// CHECK: _0 = const false;
sfzhu93 marked this conversation as resolved.
Show resolved Hide resolved
}

// CHECK-LABEL: fn main(
fn main() {
test(true, false);
}
8 changes: 7 additions & 1 deletion tests/mir-opt/dataflow-const-prop/cast.rs
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;
}