Skip to content

Commit

Permalink
FileCheck slice_len.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Dec 2, 2023
1 parent 3e90c1b commit 19767eb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
let mut _7: usize;
let mut _8: bool;
let mut _9: &[u32; 3];
scope 1 {
debug a => _1;
}

bb0: {
StorageLive(_1);
Expand Down Expand Up @@ -39,8 +42,8 @@
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
_0 = const ();
StorageDead(_1);
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
let mut _7: usize;
let mut _8: bool;
let mut _9: &[u32; 3];
scope 1 {
debug a => _1;
}

bb0: {
StorageLive(_1);
Expand Down Expand Up @@ -39,8 +42,8 @@
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
_0 = const ();
StorageDead(_1);
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
let mut _7: usize;
let mut _8: bool;
let mut _9: &[u32; 3];
scope 1 {
debug a => _1;
}

bb0: {
StorageLive(_1);
Expand Down Expand Up @@ -39,8 +42,8 @@
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
_0 = const ();
StorageDead(_1);
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
let mut _7: usize;
let mut _8: bool;
let mut _9: &[u32; 3];
scope 1 {
debug a => _1;
}

bb0: {
StorageLive(_1);
Expand Down Expand Up @@ -39,8 +42,8 @@
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
_0 = const ();
StorageDead(_1);
return;
}
}
Expand Down
9 changes: 6 additions & 3 deletions tests/mir-opt/const_prop/slice_len.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp
// compile-flags: -Zmir-enable-passes=+InstSimplify
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// EMIT_MIR_FOR_EACH_BIT_WIDTH

// EMIT_MIR slice_len.main.ConstProp.diff
fn main() {
(&[1u32, 2, 3] as &[u32])[1];
// CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]];
// CHECK: assert(const true,
// CHECK: [[a]] = const 2_u32;
let a = (&[1u32, 2, 3] as &[u32])[1];
}

0 comments on commit 19767eb

Please sign in to comment.