Add FileCheck to 3 tests: large_array_index, mult_by_zero, and offset_of

This commit is contained in:
sfzhu93 2024-01-08 20:18:59 -08:00
parent 24aefa0e5d
commit 9452d7ed1a
3 changed files with 39 additions and 3 deletions

View File

@ -1,10 +1,18 @@
// skip-filecheck
// unit-test: DataflowConstProp // unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR large_array_index.main.DataflowConstProp.diff // EMIT_MIR large_array_index.main.DataflowConstProp.diff
// CHECK-LABEL: fn main
fn main() { fn main() {
// check that we don't propagate this, because it's too large // check that we don't propagate this, because it's too large
// CHECK: debug x => [[x:_.*]];
// CHECK: [[array_lit:_.*]] = [const 0_u8; 5000];
// CHECK: {{_.*}} = const 5000_usize;
// CHECK: {{_.*}} = const true;
// CHECK-LABEL: assert(const true
// CHECK: [[x]] = [[array_lit]][2 of 3];
let x: u8 = [0_u8; 5000][2]; let x: u8 = [0_u8; 5000][2];
} }

View File

@ -1,9 +1,10 @@
// skip-filecheck
// unit-test: DataflowConstProp // unit-test: DataflowConstProp
// EMIT_MIR mult_by_zero.test.DataflowConstProp.diff // EMIT_MIR mult_by_zero.test.DataflowConstProp.diff
// CHECK-LABEL: fn test
fn test(x : i32) -> i32 { fn test(x : i32) -> i32 {
x * 0 x * 0
// CHECK: _0 = const 0_i32;
} }
fn main() { fn main() {

View File

@ -1,4 +1,3 @@
// skip-filecheck
// unit-test: DataflowConstProp // unit-test: DataflowConstProp
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR_FOR_EACH_PANIC_STRATEGY
@ -29,18 +28,46 @@ struct Delta<T> {
} }
// EMIT_MIR offset_of.concrete.DataflowConstProp.diff // EMIT_MIR offset_of.concrete.DataflowConstProp.diff
// CHECK-LABEL: fn concrete
fn concrete() { fn concrete() {
// CHECK: debug x => [[x:_.*]];
// CHECK: debug y => [[y:_.*]];
// CHECK: debug z0 => [[z0:_.*]];
// CHECK: debug z1 => [[z1:_.*]];
// CHECK: [[x]] = must_use::<usize>(const 4_usize) -> [return: {{bb[0-9]+}}, unwind continue];
let x = offset_of!(Alpha, x); let x = offset_of!(Alpha, x);
// CHECK: [[y]] = must_use::<usize>(const 0_usize) -> [return: {{bb[0-9]+}}, unwind continue];
let y = offset_of!(Alpha, y); let y = offset_of!(Alpha, y);
// CHECK: [[z0]] = must_use::<usize>(const 2_usize) -> [return: {{bb[0-9]+}}, unwind continue];
let z0 = offset_of!(Alpha, z.0); let z0 = offset_of!(Alpha, z.0);
// CHECK: [[z1]] = must_use::<usize>(const 3_usize) -> [return: {{bb[0-9]+}}, unwind continue];
let z1 = offset_of!(Alpha, z.1); let z1 = offset_of!(Alpha, z.1);
} }
// EMIT_MIR offset_of.generic.DataflowConstProp.diff // EMIT_MIR offset_of.generic.DataflowConstProp.diff
// CHECK-LABEL: generic
fn generic<T>() { fn generic<T>() {
// CHECK: debug gx => [[gx:_.*]];
// CHECK: debug gy => [[gy:_.*]];
// CHECK: debug dx => [[dx:_.*]];
// CHECK: debug dy => [[dy:_.*]];
// CHECK: [[gx]] = must_use::<usize>(move {{_[0-9]+}}) -> [return: {{bb[0-9]+}}, unwind continue];
let gx = offset_of!(Gamma<T>, x); let gx = offset_of!(Gamma<T>, x);
// CHECK: [[gy]] = must_use::<usize>(move {{_[0-9]+}}) -> [return: {{bb[0-9]+}}, unwind continue];
let gy = offset_of!(Gamma<T>, y); let gy = offset_of!(Gamma<T>, y);
// CHECK: [[dx]] = must_use::<usize>(const 0_usize) -> [return: {{bb[0-9]+}}, unwind continue];
let dx = offset_of!(Delta<T>, x); let dx = offset_of!(Delta<T>, x);
// CHECK: [[dy]] = must_use::<usize>(const 2_usize) -> [return: {{bb[0-9]+}}, unwind continue];
let dy = offset_of!(Delta<T>, y); let dy = offset_of!(Delta<T>, y);
} }