Add FileCheck for checked.rs and default_boxed_slice.rs.

This commit is contained in:
sfzhu93 2024-01-07 21:16:55 -08:00
parent 1eaeaaf08b
commit e05c779ee3
2 changed files with 28 additions and 2 deletions

View File

@ -1,15 +1,30 @@
// skip-filecheck
// unit-test: DataflowConstProp
// compile-flags: -Coverflow-checks=on
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR checked.main.DataflowConstProp.diff
#[allow(arithmetic_overflow)]
// CHECK-LABEL: fn main(
fn main() {
// CHECK: debug a => [[a:_.*]];
// CHECK: debug b => [[b:_.*]];
// CHECK: debug c => [[c:_.*]];
// CHECK: debug d => [[d:_.*]];
// CHECK: debug e => [[e:_.*]];
// CHECK: [[a]] = const 1_i32;
let a = 1;
// CHECK: [[b]] = const 2_i32;
let b = 2;
// CHECK: [[c]] = const 3_i32;
let c = a + b;
// CHECK: [[d]] = const _;
let d = i32::MAX;
// CHECK: [[e]] = const i32::MIN;
let e = d + 1;
}

View File

@ -1,4 +1,3 @@
// skip-filecheck
// unit-test: DataflowConstProp
// compile-flags: -Zmir-enable-passes=+GVN,+Inline
// ignore-debug assertions change the output MIR
@ -11,8 +10,20 @@ struct A {
// EMIT_MIR default_boxed_slice.main.GVN.diff
// EMIT_MIR default_boxed_slice.main.DataflowConstProp.diff
// CHECK-LABEL: fn main(
fn main() {
// ConstProp will create a constant of type `Box<[bool]>`.
// Verify that `DataflowConstProp` does not ICE trying to dereference it directly.
// CHECK: debug a => [[a:_.*]];
// CHECK: scope {{[0-9]+}} (inlined <Box<[bool]> as Default>::default) {
// CHECK: scope {{[0-9]+}} (inlined Unique::<[bool; 0]>::dangling) {
// CHECK: scope {{[0-9]+}} (inlined NonNull::<[bool; 0]>::dangling) {
// We may check other inlined functions as well...
// CHECK: bb{{[0-9]+}}: {
// CHECK: [[box_obj:_.*]] = Box::<[bool]>(_3, const std::alloc::Global);
// CHECK: [[a]] = A { foo: move [[box_obj]] };
let a: A = A { foo: Box::default() };
}