Skip to content

Commit e05c779

Browse files
committed
Add FileCheck for checked.rs and default_boxed_slice.rs.
1 parent 1eaeaaf commit e05c779

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
// skip-filecheck
21
// unit-test: DataflowConstProp
32
// compile-flags: -Coverflow-checks=on
43
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
54

65
// EMIT_MIR checked.main.DataflowConstProp.diff
76
#[allow(arithmetic_overflow)]
7+
8+
// CHECK-LABEL: fn main(
89
fn main() {
10+
// CHECK: debug a => [[a:_.*]];
11+
// CHECK: debug b => [[b:_.*]];
12+
// CHECK: debug c => [[c:_.*]];
13+
// CHECK: debug d => [[d:_.*]];
14+
// CHECK: debug e => [[e:_.*]];
15+
16+
// CHECK: [[a]] = const 1_i32;
917
let a = 1;
18+
19+
// CHECK: [[b]] = const 2_i32;
1020
let b = 2;
21+
22+
// CHECK: [[c]] = const 3_i32;
1123
let c = a + b;
1224

25+
// CHECK: [[d]] = const _;
1326
let d = i32::MAX;
27+
28+
// CHECK: [[e]] = const i32::MIN;
1429
let e = d + 1;
1530
}

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// skip-filecheck
21
// unit-test: DataflowConstProp
32
// compile-flags: -Zmir-enable-passes=+GVN,+Inline
43
// ignore-debug assertions change the output MIR
@@ -11,8 +10,20 @@ struct A {
1110

1211
// EMIT_MIR default_boxed_slice.main.GVN.diff
1312
// EMIT_MIR default_boxed_slice.main.DataflowConstProp.diff
13+
14+
// CHECK-LABEL: fn main(
1415
fn main() {
1516
// ConstProp will create a constant of type `Box<[bool]>`.
1617
// Verify that `DataflowConstProp` does not ICE trying to dereference it directly.
18+
19+
// CHECK: debug a => [[a:_.*]];
20+
// CHECK: scope {{[0-9]+}} (inlined <Box<[bool]> as Default>::default) {
21+
// CHECK: scope {{[0-9]+}} (inlined Unique::<[bool; 0]>::dangling) {
22+
// CHECK: scope {{[0-9]+}} (inlined NonNull::<[bool; 0]>::dangling) {
23+
// We may check other inlined functions as well...
24+
25+
// CHECK: bb{{[0-9]+}}: {
26+
// CHECK: [[box_obj:_.*]] = Box::<[bool]>(_3, const std::alloc::Global);
27+
// CHECK: [[a]] = A { foo: move [[box_obj]] };
1728
let a: A = A { foo: Box::default() };
1829
}

0 commit comments

Comments
 (0)