Add FileCheck for array_index.rs, boolean_identities.rs and cast.rs

This commit is contained in:
sfzhu93 2024-01-07 21:16:22 -08:00
parent fde0e98247
commit 1eaeaaf08b
3 changed files with 22 additions and 3 deletions

View File

@ -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]]];
// CHECK: [[x]] = [[array_lit]][2 of 3];
}

View File

@ -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;
}
// CHECK-LABEL: fn main(
fn main() {
test(true, false);
}

View File

@ -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;
}