Skip to content

Commit 9452d7e

Browse files
committed
Add FileCheck to 3 tests: large_array_index, mult_by_zero, and offset_of
1 parent 24aefa0 commit 9452d7e

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
// skip-filecheck
21
// unit-test: DataflowConstProp
32
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
43
// EMIT_MIR_FOR_EACH_BIT_WIDTH
54

65
// EMIT_MIR large_array_index.main.DataflowConstProp.diff
6+
7+
// CHECK-LABEL: fn main
78
fn main() {
89
// check that we don't propagate this, because it's too large
10+
11+
// CHECK: debug x => [[x:_.*]];
12+
// CHECK: [[array_lit:_.*]] = [const 0_u8; 5000];
13+
// CHECK: {{_.*}} = const 5000_usize;
14+
// CHECK: {{_.*}} = const true;
15+
// CHECK-LABEL: assert(const true
16+
// CHECK: [[x]] = [[array_lit]][2 of 3];
917
let x: u8 = [0_u8; 5000][2];
1018
}

tests/mir-opt/dataflow-const-prop/mult_by_zero.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
// skip-filecheck
21
// unit-test: DataflowConstProp
32

43
// EMIT_MIR mult_by_zero.test.DataflowConstProp.diff
4+
// CHECK-LABEL: fn test
55
fn test(x : i32) -> i32 {
66
x * 0
7+
// CHECK: _0 = const 0_i32;
78
}
89

910
fn main() {

tests/mir-opt/dataflow-const-prop/offset_of.rs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// skip-filecheck
21
// unit-test: DataflowConstProp
32
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
43

@@ -29,18 +28,46 @@ struct Delta<T> {
2928
}
3029

3130
// EMIT_MIR offset_of.concrete.DataflowConstProp.diff
31+
32+
// CHECK-LABEL: fn concrete
3233
fn concrete() {
34+
// CHECK: debug x => [[x:_.*]];
35+
// CHECK: debug y => [[y:_.*]];
36+
// CHECK: debug z0 => [[z0:_.*]];
37+
// CHECK: debug z1 => [[z1:_.*]];
38+
39+
// CHECK: [[x]] = must_use::<usize>(const 4_usize) -> [return: {{bb[0-9]+}}, unwind continue];
3340
let x = offset_of!(Alpha, x);
41+
42+
// CHECK: [[y]] = must_use::<usize>(const 0_usize) -> [return: {{bb[0-9]+}}, unwind continue];
3443
let y = offset_of!(Alpha, y);
44+
45+
// CHECK: [[z0]] = must_use::<usize>(const 2_usize) -> [return: {{bb[0-9]+}}, unwind continue];
3546
let z0 = offset_of!(Alpha, z.0);
47+
48+
// CHECK: [[z1]] = must_use::<usize>(const 3_usize) -> [return: {{bb[0-9]+}}, unwind continue];
3649
let z1 = offset_of!(Alpha, z.1);
3750
}
3851

3952
// EMIT_MIR offset_of.generic.DataflowConstProp.diff
53+
54+
// CHECK-LABEL: generic
4055
fn generic<T>() {
56+
// CHECK: debug gx => [[gx:_.*]];
57+
// CHECK: debug gy => [[gy:_.*]];
58+
// CHECK: debug dx => [[dx:_.*]];
59+
// CHECK: debug dy => [[dy:_.*]];
60+
61+
// CHECK: [[gx]] = must_use::<usize>(move {{_[0-9]+}}) -> [return: {{bb[0-9]+}}, unwind continue];
4162
let gx = offset_of!(Gamma<T>, x);
63+
64+
// CHECK: [[gy]] = must_use::<usize>(move {{_[0-9]+}}) -> [return: {{bb[0-9]+}}, unwind continue];
4265
let gy = offset_of!(Gamma<T>, y);
66+
67+
// CHECK: [[dx]] = must_use::<usize>(const 0_usize) -> [return: {{bb[0-9]+}}, unwind continue];
4368
let dx = offset_of!(Delta<T>, x);
69+
70+
// CHECK: [[dy]] = must_use::<usize>(const 2_usize) -> [return: {{bb[0-9]+}}, unwind continue];
4471
let dy = offset_of!(Delta<T>, y);
4572
}
4673

0 commit comments

Comments
 (0)