Improve copy_prop and GVN mir-opt passes to remove fewer storage calls

This commit is contained in:
Ohad Ravid
2025-06-03 07:36:50 +03:00
parent 0006519783
commit 5632001f83
213 changed files with 2078 additions and 1068 deletions
+92 -5
View File
@@ -3,9 +3,10 @@
use rustc_middle::mir::visit::*;
use rustc_middle::mir::*;
use rustc_middle::ty::TyCtxt;
use rustc_mir_dataflow::{Analysis, ResultsCursor};
use tracing::{debug, instrument};
use crate::ssa::SsaLocals;
use crate::ssa::{MaybeUninitializedLocals, SsaLocals};
/// Unify locals that copy each other.
///
@@ -16,7 +17,7 @@
/// _d = move? _c
/// where each of the locals is only assigned once.
///
/// We want to replace all those locals by `copy _a`.
/// We want to replace all those locals by `_a` (the "head"), either copied or moved.
pub(super) struct CopyProp;
impl<'tcx> crate::MirPass<'tcx> for CopyProp {
@@ -30,15 +31,19 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let typing_env = body.typing_env(tcx);
let ssa = SsaLocals::new(tcx, body, typing_env);
debug!(borrowed_locals = ?ssa.borrowed_locals());
debug!(copy_classes = ?ssa.copy_classes());
let mut any_replacement = false;
// Locals that participate in copy propagation either as a source or a destination.
let mut unified = DenseBitSet::new_empty(body.local_decls.len());
let mut storage_to_remove = DenseBitSet::new_empty(body.local_decls.len());
for (local, &head) in ssa.copy_classes().iter_enumerated() {
if local != head {
any_replacement = true;
storage_to_remove.insert(head);
unified.insert(head);
unified.insert(local);
}
@@ -48,7 +53,46 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
return;
}
Replacer { tcx, copy_classes: ssa.copy_classes(), unified }.visit_body_preserves_cfg(body);
// When emitting storage statements, we want to retain the head locals' storage statements,
// as this enables better optimizations. For each local use location, we mark the head for storage removal
// only if the head might be uninitialized at that point, or if the local is borrowed
// (since we cannot easily determine when it's used).
let storage_to_remove = if tcx.sess.emit_lifetime_markers() {
storage_to_remove.clear();
// If the local is borrowed, we cannot easily determine if it is used, so we have to remove the storage statements.
let borrowed_locals = ssa.borrowed_locals();
for (local, &head) in ssa.copy_classes().iter_enumerated() {
if local != head && borrowed_locals.contains(local) {
storage_to_remove.insert(head);
}
}
let maybe_uninit = MaybeUninitializedLocals
.iterate_to_fixpoint(tcx, body, Some("mir_opt::copy_prop"))
.into_results_cursor(body);
let mut storage_checker = StorageChecker {
maybe_uninit,
copy_classes: ssa.copy_classes(),
storage_to_remove,
};
for (bb, data) in traversal::reachable(body) {
storage_checker.visit_basic_block_data(bb, data);
}
storage_checker.storage_to_remove
} else {
// Remove the storage statements of all the head locals.
storage_to_remove
};
debug!(?storage_to_remove);
Replacer { tcx, copy_classes: ssa.copy_classes(), unified, storage_to_remove }
.visit_body_preserves_cfg(body);
crate::simplify::remove_unused_definitions(body);
}
@@ -63,6 +107,7 @@ fn is_required(&self) -> bool {
struct Replacer<'a, 'tcx> {
tcx: TyCtxt<'tcx>,
unified: DenseBitSet<Local>,
storage_to_remove: DenseBitSet<Local>,
copy_classes: &'a IndexSlice<Local, Local>,
}
@@ -73,7 +118,13 @@ fn tcx(&self) -> TyCtxt<'tcx> {
#[tracing::instrument(level = "trace", skip(self))]
fn visit_local(&mut self, local: &mut Local, ctxt: PlaceContext, _: Location) {
*local = self.copy_classes[*local];
let new_local = self.copy_classes[*local];
match ctxt {
// Do not modify the local in storage statements.
PlaceContext::NonUse(NonUseContext::StorageLive | NonUseContext::StorageDead) => {}
// We access the value.
_ => *local = new_local,
}
}
#[tracing::instrument(level = "trace", skip(self))]
@@ -93,7 +144,7 @@ fn visit_operand(&mut self, operand: &mut Operand<'tcx>, loc: Location) {
fn visit_statement(&mut self, stmt: &mut Statement<'tcx>, loc: Location) {
// When removing storage statements, we need to remove both (#107511).
if let StatementKind::StorageLive(l) | StatementKind::StorageDead(l) = stmt.kind
&& self.unified.contains(l)
&& self.storage_to_remove.contains(l)
{
stmt.make_nop(true);
}
@@ -109,3 +160,39 @@ fn visit_statement(&mut self, stmt: &mut Statement<'tcx>, loc: Location) {
}
}
}
// Marks heads of copy classes that are maybe uninitialized at the location of a local
// as needing storage statement removal.
struct StorageChecker<'a, 'tcx> {
maybe_uninit: ResultsCursor<'a, 'tcx, MaybeUninitializedLocals>,
copy_classes: &'a IndexSlice<Local, Local>,
storage_to_remove: DenseBitSet<Local>,
}
impl<'a, 'tcx> Visitor<'tcx> for StorageChecker<'a, 'tcx> {
fn visit_local(&mut self, local: Local, context: PlaceContext, loc: Location) {
if !context.is_use() {
return;
}
let head = self.copy_classes[local];
// If the local is the head, or if we already marked it for deletion, we do not need to check it.
if head == local || self.storage_to_remove.contains(head) {
return;
}
self.maybe_uninit.seek_before_primary_effect(loc);
if self.maybe_uninit.get().contains(head) {
debug!(
?loc,
?context,
?local,
?head,
"local's head is maybe uninit at this location, marking head for storage statement removal"
);
self.storage_to_remove.insert(head);
}
}
}
+74 -6
View File
@@ -117,11 +117,12 @@
use rustc_middle::mir::*;
use rustc_middle::ty::layout::HasTypingEnv;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_mir_dataflow::{Analysis, ResultsCursor};
use rustc_span::DUMMY_SP;
use smallvec::SmallVec;
use tracing::{debug, instrument, trace};
use crate::ssa::SsaLocals;
use crate::ssa::{MaybeUninitializedLocals, SsaLocals};
pub(super) struct GVN;
@@ -154,10 +155,34 @@ fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
state.visit_basic_block_data(bb, data);
}
// For each local that is reused (`y` above), we remove its storage statements do avoid any
// difficulty. Those locals are SSA, so should be easy to optimize by LLVM without storage
// statements.
StorageRemover { tcx, reused_locals: state.reused_locals }.visit_body_preserves_cfg(body);
// When emitting storage statements, we want to retain the reused locals' storage statements,
// as this enables better optimizations. For each local use location, we mark it for storage removal
// only if it might be uninitialized at that point.
let storage_to_remove = if tcx.sess.emit_lifetime_markers() {
let maybe_uninit = MaybeUninitializedLocals
.iterate_to_fixpoint(tcx, body, Some("mir_opt::gvn"))
.into_results_cursor(body);
let mut storage_checker = StorageChecker {
reused_locals: &state.reused_locals,
storage_to_remove: DenseBitSet::new_empty(body.local_decls.len()),
maybe_uninit,
};
for (bb, data) in traversal::reachable(body) {
storage_checker.visit_basic_block_data(bb, data);
}
storage_checker.storage_to_remove
} else {
// Remove the storage statements of all the reused locals.
state.reused_locals.clone()
};
debug!(?storage_to_remove);
StorageRemover { tcx, reused_locals: state.reused_locals, storage_to_remove }
.visit_body_preserves_cfg(body);
}
fn is_required(&self) -> bool {
@@ -2033,6 +2058,7 @@ fn visit_terminator(&mut self, terminator: &mut Terminator<'tcx>, location: Loca
struct StorageRemover<'tcx> {
tcx: TyCtxt<'tcx>,
reused_locals: DenseBitSet<Local>,
storage_to_remove: DenseBitSet<Local>,
}
impl<'tcx> MutVisitor<'tcx> for StorageRemover<'tcx> {
@@ -2053,7 +2079,7 @@ fn visit_statement(&mut self, stmt: &mut Statement<'tcx>, loc: Location) {
match stmt.kind {
// When removing storage statements, we need to remove both (#107511).
StatementKind::StorageLive(l) | StatementKind::StorageDead(l)
if self.reused_locals.contains(l) =>
if self.storage_to_remove.contains(l) =>
{
stmt.make_nop(true)
}
@@ -2061,3 +2087,45 @@ fn visit_statement(&mut self, stmt: &mut Statement<'tcx>, loc: Location) {
}
}
}
struct StorageChecker<'a, 'tcx> {
reused_locals: &'a DenseBitSet<Local>,
storage_to_remove: DenseBitSet<Local>,
maybe_uninit: ResultsCursor<'a, 'tcx, MaybeUninitializedLocals>,
}
impl<'a, 'tcx> Visitor<'tcx> for StorageChecker<'a, 'tcx> {
fn visit_local(&mut self, local: Local, context: PlaceContext, location: Location) {
match context {
// These mutating uses do not require the local to be initialized,
// so we cannot use our maybe-uninit check on them.
// However, GVN doesn't introduce or move mutations,
// so this local must already have valid storage at this location.
PlaceContext::MutatingUse(MutatingUseContext::AsmOutput)
| PlaceContext::MutatingUse(MutatingUseContext::Call)
| PlaceContext::MutatingUse(MutatingUseContext::Store)
| PlaceContext::MutatingUse(MutatingUseContext::Yield)
| PlaceContext::NonUse(_) => {
return;
}
// Must check validity for other mutating usages and all non-mutating uses.
PlaceContext::MutatingUse(_) | PlaceContext::NonMutatingUse(_) => {}
}
// We only need to check reused locals which we haven't already removed storage for.
if !self.reused_locals.contains(local) || self.storage_to_remove.contains(local) {
return;
}
self.maybe_uninit.seek_before_primary_effect(location);
if self.maybe_uninit.get().contains(local) {
debug!(
?location,
?local,
"local is reused and is maybe uninit at this location, marking it for storage statement removal"
);
self.storage_to_remove.insert(local);
}
}
}
+62
View File
@@ -14,6 +14,7 @@
use rustc_middle::mir::visit::*;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, TyCtxt};
use rustc_mir_dataflow::Analysis;
use tracing::{debug, instrument, trace};
pub(super) struct SsaLocals {
@@ -391,3 +392,64 @@ pub(crate) fn has_single_storage(&self, local: Local) -> bool {
matches!(self.storage_live[local], Set1::One(_))
}
}
/// A dataflow analysis that tracks locals that are maybe uninitialized.
///
/// This is a simpler analysis than `MaybeUninitializedPlaces`, because it does not track
/// individual fields.
pub(crate) struct MaybeUninitializedLocals;
impl<'tcx> Analysis<'tcx> for MaybeUninitializedLocals {
type Domain = DenseBitSet<Local>;
const NAME: &'static str = "maybe_uninit_locals";
fn bottom_value(&self, body: &Body<'tcx>) -> Self::Domain {
// bottom = all locals are initialized.
DenseBitSet::new_empty(body.local_decls.len())
}
fn initialize_start_block(&self, body: &Body<'tcx>, state: &mut Self::Domain) {
// All locals start as uninitialized...
state.insert_all();
// ...except for arguments, which are definitely initialized.
for arg in body.args_iter() {
state.remove(arg);
}
}
fn apply_primary_statement_effect(
&self,
state: &mut Self::Domain,
statement: &Statement<'tcx>,
_location: Location,
) {
match statement.kind {
// An assignment makes a local initialized.
StatementKind::Assign(box (place, _)) => {
if let Some(local) = place.as_local() {
state.remove(local);
}
}
// Storage{Live,Dead} makes a local uninitialized.
StatementKind::StorageLive(local) | StatementKind::StorageDead(local) => {
state.insert(local);
}
_ => {}
}
}
fn apply_call_return_effect(
&self,
state: &mut Self::Domain,
_block: BasicBlock,
return_places: CallReturnPlaces<'_, 'tcx>,
) {
// The return place of a call is initialized.
return_places.for_each(|place| {
if let Some(local) = place.as_local() {
state.remove(local);
}
});
}
}
+81
View File
@@ -0,0 +1,81 @@
//@ assembly-output: emit-asm
//@ compile-flags: -Copt-level=3
//@ revisions: aarch64
//@ [aarch64] only-aarch64
//@ revisions: linux-x86_64
//@ [linux-x86_64] compile-flags: --target x86_64-unknown-linux-gnu
//@ [linux-x86_64] only-x86_64-unknown-linux-gnu
//@ [linux-x86_64] needs-llvm-components: x86
//@ revisions: windows-x86_64-msvc
//@ [windows-x86_64-msvc] compile-flags: --target x86_64-pc-windows-msvc
//@ [windows-x86_64-msvc] needs-llvm-components: x86
//@ [windows-x86_64-msvc] only-x86_64-pc-windows-msvc
#![crate_type = "lib"]
// Non-overlapping scopes should reuse of the same stack allocation.
pub struct WithOffset<T> {
pub data: T,
pub offset: usize,
}
#[inline(never)]
pub fn peak_w(w: &WithOffset<&[u8; 16]>) {
std::hint::black_box(w);
}
#[inline(never)]
pub fn use_w(w: WithOffset<&[u8; 16]>) {
std::hint::black_box(w);
}
// CHECK-LABEL: scoped_two_small_structs
#[no_mangle]
pub fn scoped_two_small_structs(buf: [u8; 16]) {
{
let w = WithOffset { data: &buf, offset: 0 };
peak_w(&w);
use_w(w);
}
{
let w2 = WithOffset { data: &buf, offset: 1 };
peak_w(&w2);
use_w(w2);
}
// linux-x86_64: subq $16, %rsp
// windows-x86_64-msvc: subq $48, %rsp
// aarch64: sub sp, sp, #48
}
// CHECK-LABEL: scoped_three_small_structs
#[no_mangle]
pub fn scoped_three_small_structs(buf: [u8; 16]) {
{
let w = WithOffset { data: &buf, offset: 0 };
peak_w(&w);
use_w(w);
}
{
let w2 = WithOffset { data: &buf, offset: 1 };
peak_w(&w2);
use_w(w2);
}
{
let w3 = WithOffset { data: &buf, offset: 1 };
peak_w(&w3);
use_w(w3);
}
// Should be the same stack usage as the two struct version.
// linux-x86_64: subq $16, %rsp
// windows-x86_64-msvc: subq $48, %rsp
// aarch64: sub sp, sp, #48
}
+45
View File
@@ -0,0 +1,45 @@
//@ compile-flags: -Copt-level=3
#![crate_type = "lib"]
// Non-overlapping scopes should produce correct llvm.lifetimes,
// which allow reuse of the same stack allocation.
pub struct WithOffset<T> {
pub data: T,
pub offset: usize,
}
#[inline(never)]
pub fn peak_w(w: &WithOffset<&[u8; 16]>) {
std::hint::black_box(w);
}
#[inline(never)]
pub fn use_w(w: WithOffset<&[u8; 16]>) {
std::hint::black_box(w);
}
// CHECK-LABEL: @scoped_small_structs
// CHECK-NEXT: start:
// CHECK-NEXT: [[B:%.*]] = alloca
// CHECK-NEXT: [[A:%.*]] = alloca
// CHECK: call void @llvm.lifetime.start.p0({{(i64 16, )?}}ptr {{.*}}[[A]])
// CHECK: call void @llvm.lifetime.end.p0({{(i64 16, )?}}ptr {{.*}}[[A]])
// CHECK: call void @llvm.lifetime.start.p0({{(i64 16, )?}}ptr {{.*}}[[B]])
// CHECK: call void @llvm.lifetime.end.p0({{(i64 16, )?}}ptr {{.*}}[[B]])
#[no_mangle]
pub fn scoped_small_structs(buf: [u8; 16]) {
{
let w = WithOffset { data: &buf, offset: 0 };
peak_w(&w);
use_w(w);
}
{
let w2 = WithOffset { data: &buf, offset: 1 };
peak_w(&w2);
use_w(w2);
}
}
@@ -55,14 +55,14 @@
}
bb0: {
nop;
StorageLive(_1);
- _1 = const 1_u8;
nop;
+ nop;
StorageLive(_2);
- _2 = const 2_u8;
nop;
+ nop;
StorageLive(_3);
- _3 = const 3_u8;
+ nop;
+ nop;
+ nop;
StorageLive(_4);
StorageLive(_5);
@@ -95,7 +95,7 @@
- _12 = const Point {{ x: 32_u32, y: 32_u32 }};
+ nop;
StorageLive(_13);
nop;
StorageLive(_14);
- _14 = const 32_u32;
+ nop;
StorageLive(_15);
@@ -104,7 +104,7 @@
+ nop;
+ nop;
StorageDead(_15);
nop;
StorageDead(_14);
_0 = const ();
StorageDead(_13);
StorageDead(_12);
@@ -112,9 +112,9 @@
StorageDead(_10);
StorageDead(_9);
StorageDead(_4);
nop;
nop;
nop;
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
return;
}
}
@@ -13,8 +13,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
StorageLive(_2);
StorageLive(_3);
_3 = (const 0_i32, const 1_u8, const 2_i32);
@@ -36,8 +35,7 @@
StorageDead(_5);
StorageDead(_4);
_0 = const ();
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -13,8 +13,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
StorageLive(_2);
StorageLive(_3);
_3 = (const 0_i32, const 1_u8, const 2_i32);
@@ -36,8 +35,7 @@
StorageDead(_5);
StorageDead(_4);
_0 = const ();
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -18,8 +18,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
@@ -48,8 +47,7 @@
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -18,8 +18,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
@@ -48,8 +47,7 @@
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -18,8 +18,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
@@ -48,8 +47,7 @@
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -18,8 +18,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const 0_i32;
StorageLive(_2);
StorageLive(_3);
@@ -48,8 +47,7 @@
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -19,15 +19,13 @@
}
bb0: {
- StorageLive(_3);
+ nop;
StorageLive(_3);
StorageLive(_4);
_4 = copy _2;
- _3 = BitOr(move _4, const true);
+ _3 = const true;
StorageDead(_4);
- StorageLive(_5);
+ nop;
StorageLive(_5);
StorageLive(_6);
_6 = copy _1;
- _5 = BitAnd(move _6, const false);
@@ -43,10 +41,8 @@
+ _0 = const false;
StorageDead(_8);
StorageDead(_7);
- StorageDead(_5);
- StorageDead(_3);
+ nop;
+ nop;
StorageDead(_5);
StorageDead(_3);
return;
}
}
@@ -22,8 +22,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = foo() -> [return: bb1, unwind unreachable];
}
@@ -44,8 +43,7 @@
StorageDead(_5);
StorageDead(_4);
StorageDead(_2);
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -22,8 +22,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = foo() -> [return: bb1, unwind continue];
}
@@ -44,8 +43,7 @@
StorageDead(_5);
StorageDead(_4);
StorageDead(_2);
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -13,8 +13,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
StorageLive(_2);
StorageLive(_3);
_3 = const main::FOO;
@@ -33,8 +32,7 @@
StorageDead(_5);
StorageDead(_4);
_0 = const ();
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -13,8 +13,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
StorageLive(_2);
StorageLive(_3);
_3 = const main::FOO;
@@ -33,8 +32,7 @@
StorageDead(_5);
StorageDead(_4);
_0 = const ();
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -14,10 +14,8 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
- StorageLive(_3);
+ nop;
+ nop;
StorageLive(_2);
StorageLive(_3);
_3 = const {ALLOC0: &u8};
- _2 = copy (*_3);
+ _2 = const 2_u8;
@@ -29,11 +27,9 @@
+ _4 = const 2_u8;
+ _1 = const 4_u8;
StorageDead(_4);
- StorageDead(_2);
+ nop;
StorageDead(_2);
StorageDead(_5);
- StorageDead(_3);
+ nop;
StorageDead(_3);
_0 = const ();
StorageDead(_1);
return;
@@ -11,8 +11,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const 1_u32;
StorageLive(_2);
StorageLive(_3);
@@ -26,8 +25,7 @@
StorageDead(_3);
StorageDead(_2);
_0 = const ();
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -11,8 +11,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const 1_u32;
StorageLive(_2);
StorageLive(_3);
@@ -26,8 +25,7 @@
StorageDead(_3);
StorageDead(_2);
_0 = const ();
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -11,9 +11,8 @@
}
bb0: {
- StorageLive(_1);
StorageLive(_1);
- _1 = (const 1_u32, const 2_u32);
+ nop;
+ _1 = const (1_u32, 2_u32);
StorageLive(_2);
StorageLive(_3);
@@ -27,8 +26,7 @@
StorageDead(_3);
StorageDead(_2);
_0 = const ();
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -11,9 +11,8 @@
}
bb0: {
- StorageLive(_1);
StorageLive(_1);
- _1 = (const 1_u32, const 2_u32);
+ nop;
+ _1 = const (1_u32, 2_u32);
StorageLive(_2);
StorageLive(_3);
@@ -27,8 +26,7 @@
StorageDead(_3);
StorageDead(_2);
_0 = const ();
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
+2 -4
View File
@@ -17,13 +17,11 @@
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
StorageLive(_2);
_2 = const 1_u32;
- _1 = Un { us: move _2 };
- StorageDead(_2);
+ _1 = const Un {{ us: 1_u32 }};
+ nop;
StorageDead(_2);
StorageLive(_3);
StorageLive(_4);
- _4 = copy (_1.0: u32);
@@ -43,12 +43,12 @@
}
bb1: {
- StorageLive(_6);
StorageLive(_6);
StorageLive(_7);
_7 = copy (*_2);
_6 = Not(move _7);
StorageDead(_7);
- StorageLive(_8);
StorageLive(_8);
StorageLive(_9);
_9 = copy (*_2);
_8 = Not(move _9);
@@ -80,8 +80,8 @@
- StorageDead(_14);
_0 = const ();
StorageDead(_13);
- StorageDead(_8);
- StorageDead(_6);
StorageDead(_8);
StorageDead(_6);
- StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
@@ -93,8 +93,8 @@
- StorageDead(_14);
- _5 = const ();
StorageDead(_13);
- StorageDead(_8);
- StorageDead(_6);
StorageDead(_8);
StorageDead(_6);
goto -> bb1;
}
}
@@ -43,12 +43,12 @@
}
bb1: {
- StorageLive(_6);
StorageLive(_6);
StorageLive(_7);
_7 = copy (*_2);
_6 = Not(move _7);
StorageDead(_7);
- StorageLive(_8);
StorageLive(_8);
StorageLive(_9);
_9 = copy (*_2);
_8 = Not(move _9);
@@ -80,8 +80,8 @@
- StorageDead(_14);
_0 = const ();
StorageDead(_13);
- StorageDead(_8);
- StorageDead(_6);
StorageDead(_8);
StorageDead(_6);
- StorageDead(_4);
StorageDead(_2);
StorageDead(_1);
@@ -93,8 +93,8 @@
- StorageDead(_14);
- _5 = const ();
StorageDead(_13);
- StorageDead(_8);
- StorageDead(_6);
StorageDead(_8);
StorageDead(_6);
goto -> bb1;
}
}
@@ -0,0 +1,20 @@
- // MIR for `f` before CopyProp
+ // MIR for `f` after CopyProp
fn f(_1: &mut usize) -> () {
let mut _0: ();
let mut _2: usize;
let mut _3: usize;
bb0: {
StorageLive(_2);
_2 = const 0_usize;
- _3 = copy _2;
- (*_1) = copy _3;
+ (*_1) = copy _2;
StorageDead(_2);
(*_1) = copy _2;
return;
}
}
@@ -0,0 +1,23 @@
- // MIR for `g` before CopyProp
+ // MIR for `g` after CopyProp
fn g() -> usize {
let mut _0: usize;
let mut _1: usize;
let mut _2: usize;
let mut _3: usize;
bb0: {
- StorageLive(_2);
StorageLive(_1);
_1 = const 0_usize;
- _2 = copy _1;
- _3 = copy _2;
- _0 = Add(copy _3, copy _3);
+ _0 = Add(copy _1, copy _1);
StorageDead(_1);
- StorageDead(_2);
return;
}
}
@@ -0,0 +1,57 @@
//@ test-mir-pass: CopyProp
//@ compile-flags: -Zlint-mir=false
#![feature(custom_mir, core_intrinsics)]
use std::intrinsics::mir::*;
// EMIT_MIR copy_prop_storage_preserve_head.f.CopyProp.diff
// EMIT_MIR copy_prop_storage_preserve_head.g.CopyProp.diff
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
pub fn f(_1: &mut usize) {
// CHECK-LABEL: fn f(
mir! {
let _2: usize;
let _3: usize;
// CHECK: bb0: {
{
// CHECK: StorageLive(_2);
// CHECK: (*_1) = copy _2;
// CHECK: StorageDead(_2);
StorageLive(_2);
_2 = 0;
_3 = _2;
(*_1) = _3;
StorageDead(_2);
(*_1) = _2;
Return()
}
}
}
#[custom_mir(dialect = "runtime")]
pub fn g() -> usize {
// CHECK-LABEL: fn g(
mir! {
let _1: usize;
let _2: usize;
let _3: usize;
// CHECK: bb0: {
{
// CHECK: StorageLive(_1);
// CHECK: _0 = Add(copy _1, copy _1);
// CHECK: StorageDead(_1);
StorageLive(_2);
StorageLive(_1);
_1 = 0;
_2 = _1;
_3 = _2;
RET = _3 + _3;
// Even though the storage statements are in reverse order,
// we should be able to keep the ones for _1.
StorageDead(_1);
StorageDead(_2);
Return()
}
}
}
@@ -0,0 +1,20 @@
- // MIR for `f` before CopyProp
+ // MIR for `f` after CopyProp
fn f(_1: (T, T)) -> T {
let mut _0: T;
let mut _2: T;
let mut _3: T;
let mut _4: &T;
bb0: {
StorageLive(_2);
_2 = copy (_1.0: T);
_3 = copy _2;
_4 = &_3;
StorageDead(_2);
_0 = copy (*_4);
return;
}
}
@@ -0,0 +1,36 @@
//! Check that we remove the storage statements if one of the locals is borrowed,
//! and the head isn't borrowed.
//@ test-mir-pass: CopyProp
#![feature(custom_mir, core_intrinsics, freeze)]
use std::intrinsics::mir::*;
use std::marker::Freeze;
// EMIT_MIR copy_prop_storage_removed_when_local_borrowed.f.CopyProp.diff
#[custom_mir(dialect = "runtime")]
pub fn f<T: Copy + Freeze>(_1: (T, T)) -> T {
// CHECK-LABEL: fn f(
mir! {
let _2: T;
let _3: T;
let _4: &T;
// CHECK: bb0: {
{
// FIXME: Currently, copy propagation will not unify borrowed locals.
// If it does, the storage statements for `_2` should be remove
// so these checks will need to be updated.
// CHECK: StorageLive(_2);
// CHECK: _4 = &_3;
// CHECK: StorageDead(_2);
StorageLive(_2);
_2 = _1.0;
_3 = _2;
_4 = &_3;
StorageDead(_2);
RET = *_4;
Return()
}
}
}
@@ -0,0 +1,28 @@
- // MIR for `dead_twice` before CopyProp
+ // MIR for `dead_twice` after CopyProp
fn dead_twice(_1: T) -> T {
let mut _0: T;
let mut _2: T;
let mut _3: T;
let mut _4: T;
bb0: {
- StorageLive(_2);
_2 = opaque::<T>(move _1) -> [return: bb1, unwind unreachable];
}
bb1: {
- _4 = move _2;
- StorageDead(_2);
- StorageLive(_2);
- _0 = opaque::<T>(move _4) -> [return: bb2, unwind unreachable];
+ _0 = opaque::<T>(copy _2) -> [return: bb2, unwind unreachable];
}
bb2: {
- StorageDead(_2);
return;
}
}
@@ -0,0 +1,27 @@
- // MIR for `live_twice` before CopyProp
+ // MIR for `live_twice` after CopyProp
fn live_twice(_1: T) -> T {
let mut _0: T;
let mut _2: T;
let mut _3: T;
let mut _4: T;
bb0: {
- StorageLive(_2);
_2 = opaque::<T>(move _1) -> [return: bb1, unwind unreachable];
}
bb1: {
- _4 = move _2;
- StorageLive(_2);
- _0 = opaque::<T>(copy _4) -> [return: bb2, unwind unreachable];
+ _0 = opaque::<T>(copy _2) -> [return: bb2, unwind unreachable];
}
bb2: {
- StorageDead(_2);
return;
}
}
@@ -0,0 +1,70 @@
//@ test-mir-pass: CopyProp
//@ compile-flags: -Zlint-mir=false
#![feature(custom_mir, core_intrinsics)]
// Check that we remove the storage statements if the head
// becomes uninitialized before it is used again.
use std::intrinsics::mir::*;
// EMIT_MIR copy_prop_storage_twice.dead_twice.CopyProp.diff
#[custom_mir(dialect = "runtime")]
pub fn dead_twice<T: Copy>(_1: T) -> T {
// CHECK-LABEL: fn dead_twice(
mir! {
let _2: T;
let _3: T;
{
// CHECK-NOT: StorageLive(_2);
StorageLive(_2);
Call(_2 = opaque(Move(_1)), ReturnTo(bb1), UnwindUnreachable())
}
bb1 = {
// CHECK-NOT: StorageDead(_2);
// CHECK-NOT: StorageLive(_2);
// CHECK: _0 = opaque::<T>(copy _2) -> [return: bb2, unwind unreachable];
let _3 = Move(_2);
StorageDead(_2);
StorageLive(_2);
Call(RET = opaque(Move(_3)), ReturnTo(bb2), UnwindUnreachable())
}
bb2 = {
// CHECK-NOT: StorageDead(_2);
StorageDead(_2);
Return()
}
}
}
// EMIT_MIR copy_prop_storage_twice.live_twice.CopyProp.diff
#[custom_mir(dialect = "runtime")]
pub fn live_twice<T: Copy>(_1: T) -> T {
// CHECK-LABEL: fn live_twice(
mir! {
let _2: T;
let _3: T;
{
// CHECK-NOT: StorageLive(_2);
StorageLive(_2);
Call(_2 = opaque(Move(_1)), ReturnTo(bb1), UnwindUnreachable())
}
bb1 = {
// CHECK-NOT: StorageLive(_2);
// CHECK: _0 = opaque::<T>(copy _2) -> [return: bb2, unwind unreachable];
let _3 = Move(_2);
StorageLive(_2);
Call(RET = opaque(_3), ReturnTo(bb2), UnwindUnreachable())
}
bb2 = {
// CHECK-NOT: StorageDead(_2);
StorageDead(_2);
Return()
}
}
}
#[inline(never)]
fn opaque<T>(a: T) -> T {
a
}
@@ -0,0 +1,27 @@
- // MIR for `f` before CopyProp
+ // MIR for `f` after CopyProp
fn f(_1: &mut usize) -> () {
let mut _0: ();
let mut _2: usize;
let mut _3: usize;
bb0: {
StorageLive(_2);
_2 = const 42_usize;
- _3 = copy _2;
- (*_1) = copy _3;
+ (*_1) = copy _2;
StorageDead(_2);
return;
}
bb1: {
StorageLive(_2);
- (*_1) = copy _3;
+ (*_1) = copy _2;
StorageDead(_2);
return;
}
}
@@ -0,0 +1,37 @@
//! Check that we do not remove the storage statements if the head
//! is uninitialized in an unreachable block.
//@ test-mir-pass: CopyProp
#![feature(custom_mir, core_intrinsics)]
use std::intrinsics::mir::*;
// EMIT_MIR copy_prop_storage_unreachable.f.CopyProp.diff
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
pub fn f(_1: &mut usize) {
// CHECK-LABEL: fn f(
mir! {
let _2: usize;
let _3: usize;
{
// CHECK: StorageLive(_2);
// CHECK: (*_1) = copy _2;
// CHECK: StorageDead(_2);
StorageLive(_2);
_2 = 42;
_3 = _2;
(*_1) = _3;
StorageDead(_2);
Return()
}
bb1 = {
// Ensure that _2 is considered uninitialized by `MaybeUninitializedLocals`.
StorageLive(_2);
// Use of _3 (in an unreachable block) when definition of _2 is unavailable.
(*_1) = _3;
StorageDead(_2);
Return()
}
}
}
@@ -26,7 +26,7 @@
}
bb1: {
- StorageLive(_2);
StorageLive(_2);
_2 = copy _1;
- StorageLive(_3);
- _3 = copy _2;
@@ -46,7 +46,7 @@
StorageDead(_5);
_0 = const ();
- StorageDead(_3);
- StorageDead(_2);
StorageDead(_2);
StorageDead(_1);
return;
}
@@ -26,7 +26,7 @@
}
bb1: {
- StorageLive(_2);
StorageLive(_2);
_2 = copy _1;
- StorageLive(_3);
- _3 = copy _2;
@@ -46,7 +46,7 @@
StorageDead(_5);
_0 = const ();
- StorageDead(_3);
- StorageDead(_2);
StorageDead(_2);
StorageDead(_1);
return;
}
+2 -1
View File
@@ -11,7 +11,7 @@ fn main() {
// CHECK: debug x => [[x:_.*]];
// CHECK: debug y => [[y:_.*]];
// CHECK: debug z => [[y]];
// CHECK-NOT: StorageLive([[y]]);
// CHECK: StorageLive([[y]]);
// CHECK: [[y]] = copy [[x]];
// CHECK-NOT: StorageLive(_3);
// CHECK-NOT: _3 = copy [[y]];
@@ -19,6 +19,7 @@ fn main() {
// CHECK-NOT: _4 = copy _3;
// CHECK-NOT: _1 = move _4;
// CHECK: [[x]] = copy [[y]];
// CHECK: StorageDead([[y]]);
let mut x = val();
let y = x;
let z = y;
@@ -11,6 +11,7 @@ fn f(_1: usize) -> usize {
}
bb0: {
StorageLive(_2);
_2 = copy _1;
_1 = const 5_usize;
_1 = copy _2;
@@ -21,6 +22,7 @@ fn f(_1: usize) -> usize {
bb1: {
StorageDead(_4);
StorageDead(_2);
return;
}
}
@@ -11,6 +11,7 @@ fn f(_1: usize) -> usize {
}
bb0: {
StorageLive(_2);
_2 = copy _1;
_1 = const 5_usize;
_1 = copy _2;
@@ -21,6 +22,7 @@ fn f(_1: usize) -> usize {
bb1: {
StorageDead(_4);
StorageDead(_2);
return;
}
}
@@ -86,7 +86,7 @@
}
bb6: {
- StorageLive(_16);
StorageLive(_16);
_16 = copy ((_11 as Some).0: usize);
StorageLive(_17);
- StorageLive(_18);
@@ -116,7 +116,7 @@
StorageDead(_17);
- StorageDead(_18);
- _10 = const ();
- StorageDead(_16);
StorageDead(_16);
StorageDead(_13);
StorageDead(_11);
- StorageDead(_10);
@@ -86,7 +86,7 @@
}
bb6: {
- StorageLive(_16);
StorageLive(_16);
_16 = copy ((_11 as Some).0: usize);
StorageLive(_17);
- StorageLive(_18);
@@ -116,7 +116,7 @@
StorageDead(_17);
- StorageDead(_18);
- _10 = const ();
- StorageDead(_16);
StorageDead(_16);
StorageDead(_13);
StorageDead(_11);
- StorageDead(_10);
+2 -2
View File
@@ -5,8 +5,8 @@
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug i => [[i:_.*]];
// CHECK-NOT: StorageLive([[i]]);
// CHECK-NOT: StorageDead([[i]]);
// CHECK: StorageLive([[i]]);
// CHECK: StorageDead([[i]]);
let mut sum = 0;
let a = [0, 10, 20, 30];
@@ -0,0 +1,32 @@
- // MIR for `f_head_borrowed` before CopyProp
+ // MIR for `f_head_borrowed` after CopyProp
fn f_head_borrowed() -> () {
let mut _0: ();
let mut _1: S;
let mut _2: S;
let mut _3: S;
let mut _4: &S;
let mut _5: &S;
bb0: {
StorageLive(_1);
_1 = S(const 1_u32, const 2_u32);
- StorageLive(_2);
_4 = &_1;
- _2 = copy _1;
- _3 = opaque::<S>(move _1) -> [return: bb1, unwind unreachable];
+ _3 = opaque::<S>(copy _1) -> [return: bb1, unwind unreachable];
}
bb1: {
- StorageDead(_2);
StorageDead(_1);
_5 = opaque::<&S>(move _4) -> [return: bb2, unwind unreachable];
}
bb2: {
return;
}
}
@@ -0,0 +1,25 @@
- // MIR for `f_move` before CopyProp
+ // MIR for `f_move` after CopyProp
fn f_move() -> () {
let mut _0: ();
let mut _1: S;
let mut _2: S;
let mut _3: S;
bb0: {
StorageLive(_1);
_1 = S(const 1_u32, const 2_u32);
- StorageLive(_2);
- _2 = copy _1;
- _3 = opaque::<S>(move _1) -> [return: bb1, unwind unreachable];
+ _3 = opaque::<S>(copy _1) -> [return: bb1, unwind unreachable];
}
bb1: {
- StorageDead(_2);
StorageDead(_1);
return;
}
}
+75
View File
@@ -0,0 +1,75 @@
//! Check that we do not remove storage statements when the head is alive for all usages.
//@ test-mir-pass: CopyProp
// EMIT_MIR issue_141649.f_move.CopyProp.diff
// EMIT_MIR issue_141649.f_head_borrowed.CopyProp.diff
#![feature(custom_mir, core_intrinsics)]
use std::intrinsics::mir::*;
struct S(u32, u32);
#[custom_mir(dialect = "runtime")]
pub fn f_move() {
// CHECK-LABEL: fn f_move(
mir! {
let _1: S;
let _2: S;
let _3: S;
{
// CHECK: StorageLive(_1);
// CHECK-NOT: StorageLive(_2);
// CHECK: _3 = opaque::<S>(copy _1) -> [return: bb1, unwind unreachable];
StorageLive(_1);
_1 = S(1, 2);
StorageLive(_2);
_2 = _1;
Call(_3 = opaque(Move(_1)), ReturnTo(bb1), UnwindUnreachable())
}
bb1 = {
// CHECK-NOT: StorageDead(_2);
// CHECK: StorageDead(_1);
StorageDead(_2);
StorageDead(_1);
Return()
}
}
}
#[custom_mir(dialect = "runtime")]
fn f_head_borrowed() {
// CHECK-LABEL: fn f_head_borrowed(
mir! {
let _1: S;
let _2: S;
let _3: S;
let _4: &S;
let _5: &S;
{
// CHECK: StorageLive(_1);
// CHECK-NOT: StorageLive(_2);
// CHECK: _3 = opaque::<S>(copy _1) -> [return: bb1, unwind unreachable];
StorageLive(_1);
_1 = S(1, 2);
StorageLive(_2);
_4 = &_1;
_2 = _1;
Call(_3 = opaque(Move(_1)), ReturnTo(bb1), UnwindUnreachable())
}
bb1 = {
// CHECK-NOT: StorageDead(_2);
// CHECK: StorageDead(_1);
StorageDead(_2);
StorageDead(_1);
Call(_5 = opaque(Move(_4)), ReturnTo(bb2), UnwindUnreachable())
}
bb2 = {
Return()
}
}
}
#[inline(never)]
fn opaque<T>(a: T) -> T {
a
}
@@ -0,0 +1,25 @@
- // MIR for `f_move` before CopyProp
+ // MIR for `f_move` after CopyProp
fn f_move() -> () {
let mut _0: ();
let mut _1: S;
let mut _2: S;
let mut _3: S;
bb0: {
- StorageLive(_1);
_1 = S(const 1_u32, const 2_u32);
- StorageLive(_2);
- _2 = copy _1;
- _3 = opaque::<S>(move _1) -> [return: bb1, unwind unreachable];
+ _3 = opaque::<S>(copy _1) -> [return: bb1, unwind unreachable];
}
bb1: {
- StorageDead(_2);
- StorageDead(_1);
return;
}
}
@@ -0,0 +1,42 @@
//! In lower opt levels, we remove (more) storage statements using a simpler strategy.
//@ test-mir-pass: CopyProp
//@ compile-flags: -Copt-level=0
// EMIT_MIR issue_141649_debug.f_move.CopyProp.diff
#![feature(custom_mir, core_intrinsics)]
use std::intrinsics::mir::*;
struct S(u32, u32);
#[custom_mir(dialect = "runtime")]
pub fn f_move() {
// CHECK-LABEL: fn f_move(
mir! {
let _1: S;
let _2: S;
let _3: S;
{
// CHECK-NOT: StorageLive(_1);
// CHECK-NOT: StorageLive(_2);
// CHECK: _3 = opaque::<S>(copy _1) -> [return: bb1, unwind unreachable];
StorageLive(_1);
_1 = S(1, 2);
StorageLive(_2);
_2 = _1;
Call(_3 = opaque(Move(_1)), ReturnTo(bb1), UnwindUnreachable())
}
bb1 = {
// CHECK-NOT: StorageDead(_2);
// CHECK-NOT: StorageDead(_1);
StorageDead(_2);
StorageDead(_1);
Return()
}
}
}
#[inline(never)]
fn opaque<T>(a: T) -> T {
a
}
@@ -22,7 +22,7 @@
}
bb0: {
- StorageLive(_2);
StorageLive(_2);
_2 = &raw mut _1;
StorageLive(_3);
StorageLive(_4);
@@ -44,7 +44,7 @@
_0 = const ();
- StorageDead(_5);
StorageDead(_3);
- StorageDead(_2);
StorageDead(_2);
return;
}
}
@@ -22,7 +22,7 @@
}
bb0: {
- StorageLive(_2);
StorageLive(_2);
_2 = &raw mut _1;
StorageLive(_3);
StorageLive(_4);
@@ -44,7 +44,7 @@
_0 = const ();
- StorageDead(_5);
StorageDead(_3);
- StorageDead(_2);
StorageDead(_2);
return;
}
}
@@ -21,7 +21,7 @@
}
bb0: {
- StorageLive(_2);
StorageLive(_2);
_2 = &raw mut _1;
StorageLive(_3);
_3 = &raw mut (*_2);
@@ -40,7 +40,7 @@
_0 = const ();
- StorageDead(_4);
StorageDead(_3);
- StorageDead(_2);
StorageDead(_2);
return;
}
}
@@ -21,7 +21,7 @@
}
bb0: {
- StorageLive(_2);
StorageLive(_2);
_2 = &raw mut _1;
StorageLive(_3);
_3 = &raw mut (*_2);
@@ -40,7 +40,7 @@
_0 = const ();
- StorageDead(_4);
StorageDead(_3);
- StorageDead(_2);
StorageDead(_2);
return;
}
}
@@ -21,7 +21,7 @@
}
bb0: {
- StorageLive(_2);
StorageLive(_2);
_2 = &mut _1;
StorageLive(_3);
_3 = &mut (*_2);
@@ -40,7 +40,7 @@
_0 = const ();
- StorageDead(_4);
StorageDead(_3);
- StorageDead(_2);
StorageDead(_2);
return;
}
}
@@ -21,7 +21,7 @@
}
bb0: {
- StorageLive(_2);
StorageLive(_2);
_2 = &mut _1;
StorageLive(_3);
_3 = &mut (*_2);
@@ -40,7 +40,7 @@
_0 = const ();
- StorageDead(_4);
StorageDead(_3);
- StorageDead(_2);
StorageDead(_2);
return;
}
}
@@ -21,7 +21,7 @@
}
bb0: {
- StorageLive(_2);
StorageLive(_2);
_2 = &mut _1;
StorageLive(_3);
_3 = &raw mut (*_2);
@@ -40,7 +40,7 @@
_0 = const ();
- StorageDead(_4);
StorageDead(_3);
- StorageDead(_2);
StorageDead(_2);
return;
}
}
@@ -21,7 +21,7 @@
}
bb0: {
- StorageLive(_2);
StorageLive(_2);
_2 = &mut _1;
StorageLive(_3);
_3 = &raw mut (*_2);
@@ -40,7 +40,7 @@
_0 = const ();
- StorageDead(_4);
StorageDead(_3);
- StorageDead(_2);
StorageDead(_2);
return;
}
}
@@ -71,13 +71,11 @@
_2 = &_3;
_1 = &(*_2);
StorageDead(_2);
- StorageLive(_5);
+ nop;
StorageLive(_5);
_10 = copy (*_1);
_11 = copy ((_10.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute);
_5 = &raw const (*_11);
- StorageLive(_6);
+ nop;
StorageLive(_6);
StorageLive(_7);
_7 = copy _5;
StorageLive(_14);
@@ -98,10 +96,8 @@
StorageDead(_9);
_0 = const ();
StorageDead(_8);
- StorageDead(_6);
- StorageDead(_5);
+ nop;
+ nop;
StorageDead(_6);
StorageDead(_5);
drop(_3) -> [return: bb1, unwind unreachable];
}
+ }
@@ -51,13 +51,11 @@
_2 = &_3;
_1 = &(*_2);
StorageDead(_2);
- StorageLive(_5);
+ nop;
StorageLive(_5);
_10 = copy (*_1);
_11 = copy ((_10.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute);
_5 = &raw const (*_11);
- StorageLive(_6);
+ nop;
StorageLive(_6);
StorageLive(_7);
_7 = copy _5;
StorageLive(_12);
@@ -78,10 +76,8 @@
StorageDead(_9);
_0 = const ();
StorageDead(_8);
- StorageDead(_6);
- StorageDead(_5);
+ nop;
+ nop;
StorageDead(_6);
StorageDead(_5);
drop(_3) -> [return: bb2, unwind: bb3];
}
@@ -71,13 +71,11 @@
_2 = &_3;
_1 = &(*_2);
StorageDead(_2);
- StorageLive(_5);
+ nop;
StorageLive(_5);
_10 = copy (*_1);
_11 = copy ((_10.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute);
_5 = &raw const (*_11);
- StorageLive(_6);
+ nop;
StorageLive(_6);
StorageLive(_7);
_7 = copy _5;
StorageLive(_14);
@@ -98,10 +96,8 @@
StorageDead(_9);
_0 = const ();
StorageDead(_8);
- StorageDead(_6);
- StorageDead(_5);
+ nop;
+ nop;
StorageDead(_6);
StorageDead(_5);
drop(_3) -> [return: bb1, unwind unreachable];
}
+ }
@@ -51,13 +51,11 @@
_2 = &_3;
_1 = &(*_2);
StorageDead(_2);
- StorageLive(_5);
+ nop;
StorageLive(_5);
_10 = copy (*_1);
_11 = copy ((_10.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute);
_5 = &raw const (*_11);
- StorageLive(_6);
+ nop;
StorageLive(_6);
StorageLive(_7);
_7 = copy _5;
StorageLive(_12);
@@ -78,10 +76,8 @@
StorageDead(_9);
_0 = const ();
StorageDead(_8);
- StorageDead(_6);
- StorageDead(_5);
+ nop;
+ nop;
StorageDead(_6);
StorageDead(_5);
drop(_3) -> [return: bb2, unwind: bb3];
}
@@ -78,8 +78,7 @@
}
bb4: {
- StorageLive(_8);
+ nop;
StorageLive(_8);
_8 = copy ((_6 as Some).0: usize);
StorageLive(_9);
_9 = copy _1;
@@ -108,8 +107,7 @@
StorageDead(_11);
StorageDead(_10);
StorageDead(_9);
- StorageDead(_8);
+ nop;
StorageDead(_8);
goto -> bb8;
}
@@ -78,8 +78,7 @@
}
bb4: {
- StorageLive(_8);
+ nop;
StorageLive(_8);
_8 = copy ((_6 as Some).0: usize);
StorageLive(_9);
_9 = copy _1;
@@ -108,8 +107,7 @@
StorageDead(_11);
StorageDead(_10);
StorageDead(_9);
- StorageDead(_8);
+ nop;
StorageDead(_8);
goto -> bb8;
}
@@ -78,8 +78,7 @@
}
bb4: {
- StorageLive(_8);
+ nop;
StorageLive(_8);
_8 = copy ((_6 as Some).0: usize);
StorageLive(_9);
_9 = copy _1;
@@ -108,8 +107,7 @@
StorageDead(_11);
StorageDead(_10);
StorageDead(_9);
- StorageDead(_8);
+ nop;
StorageDead(_8);
goto -> bb8;
}
@@ -78,8 +78,7 @@
}
bb4: {
- StorageLive(_8);
+ nop;
StorageLive(_8);
_8 = copy ((_6 as Some).0: usize);
StorageLive(_9);
_9 = copy _1;
@@ -108,8 +107,7 @@
StorageDead(_11);
StorageDead(_10);
StorageDead(_9);
- StorageDead(_8);
+ nop;
StorageDead(_8);
goto -> bb8;
}
@@ -91,8 +91,7 @@
}
bb0: {
- StorageLive(_3);
+ nop;
StorageLive(_3);
StorageLive(_4);
_4 = copy _1;
- _3 = MyId(move _4);
@@ -113,8 +112,7 @@
bb1: {
StorageDead(_6);
StorageDead(_5);
- StorageLive(_8);
+ nop;
StorageLive(_8);
StorageLive(_9);
_9 = copy _1;
StorageLive(_10);
@@ -139,8 +137,7 @@
bb2: {
StorageDead(_12);
StorageDead(_11);
- StorageLive(_14);
+ nop;
StorageLive(_14);
StorageLive(_15);
_15 = copy _1;
- _14 = Result::<Never, u16>::Err(move _15);
@@ -161,8 +158,7 @@
bb3: {
StorageDead(_17);
StorageDead(_16);
- StorageLive(_19);
+ nop;
StorageLive(_19);
StorageLive(_20);
_20 = copy _1;
- _19 = Option::<u16>::Some(move _20);
@@ -201,8 +197,7 @@
bb5: {
StorageDead(_27);
StorageDead(_26);
- StorageLive(_29);
+ nop;
StorageLive(_29);
StorageLive(_30);
_30 = copy _1;
StorageLive(_31);
@@ -248,8 +243,7 @@
bb7: {
StorageDead(_39);
StorageDead(_38);
- StorageLive(_41);
+ nop;
StorageLive(_41);
StorageLive(_42);
_42 = copy _1;
- _41 = (move _42,);
@@ -269,8 +263,7 @@
bb8: {
StorageDead(_44);
StorageDead(_43);
- StorageLive(_46);
+ nop;
StorageLive(_46);
StorageLive(_47);
_47 = copy _1;
- _46 = [move _47];
@@ -290,8 +283,7 @@
bb9: {
StorageDead(_49);
StorageDead(_48);
- StorageLive(_51);
+ nop;
StorageLive(_51);
StorageLive(_52);
_52 = copy _2;
StorageLive(_53);
@@ -316,24 +308,16 @@
StorageDead(_55);
StorageDead(_54);
_0 = const ();
- StorageDead(_51);
- StorageDead(_46);
- StorageDead(_41);
+ nop;
+ nop;
+ nop;
StorageDead(_51);
StorageDead(_46);
StorageDead(_41);
StorageDead(_35);
- StorageDead(_29);
+ nop;
StorageDead(_29);
StorageDead(_24);
- StorageDead(_19);
- StorageDead(_14);
- StorageDead(_8);
- StorageDead(_3);
+ nop;
+ nop;
+ nop;
+ nop;
StorageDead(_19);
StorageDead(_14);
StorageDead(_8);
StorageDead(_3);
return;
}
}
@@ -91,8 +91,7 @@
}
bb0: {
- StorageLive(_3);
+ nop;
StorageLive(_3);
StorageLive(_4);
_4 = copy _1;
- _3 = MyId(move _4);
@@ -113,8 +112,7 @@
bb1: {
StorageDead(_6);
StorageDead(_5);
- StorageLive(_8);
+ nop;
StorageLive(_8);
StorageLive(_9);
_9 = copy _1;
StorageLive(_10);
@@ -139,8 +137,7 @@
bb2: {
StorageDead(_12);
StorageDead(_11);
- StorageLive(_14);
+ nop;
StorageLive(_14);
StorageLive(_15);
_15 = copy _1;
- _14 = Result::<Never, u16>::Err(move _15);
@@ -161,8 +158,7 @@
bb3: {
StorageDead(_17);
StorageDead(_16);
- StorageLive(_19);
+ nop;
StorageLive(_19);
StorageLive(_20);
_20 = copy _1;
- _19 = Option::<u16>::Some(move _20);
@@ -201,8 +197,7 @@
bb5: {
StorageDead(_27);
StorageDead(_26);
- StorageLive(_29);
+ nop;
StorageLive(_29);
StorageLive(_30);
_30 = copy _1;
StorageLive(_31);
@@ -248,8 +243,7 @@
bb7: {
StorageDead(_39);
StorageDead(_38);
- StorageLive(_41);
+ nop;
StorageLive(_41);
StorageLive(_42);
_42 = copy _1;
- _41 = (move _42,);
@@ -269,8 +263,7 @@
bb8: {
StorageDead(_44);
StorageDead(_43);
- StorageLive(_46);
+ nop;
StorageLive(_46);
StorageLive(_47);
_47 = copy _1;
- _46 = [move _47];
@@ -290,8 +283,7 @@
bb9: {
StorageDead(_49);
StorageDead(_48);
- StorageLive(_51);
+ nop;
StorageLive(_51);
StorageLive(_52);
_52 = copy _2;
StorageLive(_53);
@@ -316,24 +308,16 @@
StorageDead(_55);
StorageDead(_54);
_0 = const ();
- StorageDead(_51);
- StorageDead(_46);
- StorageDead(_41);
+ nop;
+ nop;
+ nop;
StorageDead(_51);
StorageDead(_46);
StorageDead(_41);
StorageDead(_35);
- StorageDead(_29);
+ nop;
StorageDead(_29);
StorageDead(_24);
- StorageDead(_19);
- StorageDead(_14);
- StorageDead(_8);
- StorageDead(_3);
+ nop;
+ nop;
+ nop;
+ nop;
StorageDead(_19);
StorageDead(_14);
StorageDead(_8);
StorageDead(_3);
return;
}
}
@@ -108,8 +108,7 @@
StorageDead(_6);
StorageDead(_5);
StorageLive(_8);
- StorageLive(_9);
+ nop;
StorageLive(_9);
StorageLive(_10);
_10 = copy _1;
StorageLive(_11);
@@ -123,8 +122,7 @@
}
bb3: {
- StorageDead(_9);
+ nop;
StorageDead(_9);
StorageDead(_8);
StorageLive(_12);
StorageLive(_13);
@@ -108,8 +108,7 @@
StorageDead(_6);
StorageDead(_5);
StorageLive(_8);
- StorageLive(_9);
+ nop;
StorageLive(_9);
StorageLive(_10);
_10 = copy _1;
StorageLive(_11);
@@ -123,8 +122,7 @@
}
bb3: {
- StorageDead(_9);
+ nop;
StorageDead(_9);
StorageDead(_8);
StorageLive(_12);
StorageLive(_13);
@@ -70,8 +70,7 @@
StorageDead(_7);
StorageDead(_6);
StorageLive(_10);
- StorageLive(_11);
+ nop;
StorageLive(_11);
StorageLive(_12);
_12 = copy _1;
StorageLive(_13);
@@ -92,8 +91,7 @@
}
bb6: {
- StorageDead(_11);
+ nop;
StorageDead(_11);
StorageDead(_10);
StorageLive(_15);
StorageLive(_16);
@@ -70,8 +70,7 @@
StorageDead(_7);
StorageDead(_6);
StorageLive(_10);
- StorageLive(_11);
+ nop;
StorageLive(_11);
StorageLive(_12);
_12 = copy _1;
StorageLive(_13);
@@ -92,8 +91,7 @@
}
bb6: {
- StorageDead(_11);
+ nop;
StorageDead(_11);
StorageDead(_10);
StorageLive(_15);
StorageLive(_16);
+6 -12
View File
@@ -104,14 +104,11 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const 1_i64;
- StorageLive(_2);
+ nop;
StorageLive(_2);
_2 = const 1_u64;
- StorageLive(_3);
+ nop;
StorageLive(_3);
_3 = const 1f64;
StorageLive(_4);
StorageLive(_5);
@@ -552,12 +549,9 @@
StorageDead(_90);
StorageDead(_89);
_0 = const ();
- StorageDead(_3);
- StorageDead(_2);
- StorageDead(_1);
+ nop;
+ nop;
+ nop;
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
return;
}
}
+6 -12
View File
@@ -104,14 +104,11 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const 1_i64;
- StorageLive(_2);
+ nop;
StorageLive(_2);
_2 = const 1_u64;
- StorageLive(_3);
+ nop;
StorageLive(_3);
_3 = const 1f64;
StorageLive(_4);
StorageLive(_5);
@@ -552,12 +549,9 @@
StorageDead(_90);
StorageDead(_89);
_0 = const ();
- StorageDead(_3);
- StorageDead(_2);
- StorageDead(_1);
+ nop;
+ nop;
+ nop;
StorageDead(_3);
StorageDead(_2);
StorageDead(_1);
return;
}
}
@@ -49,8 +49,7 @@
}
bb0: {
- StorageLive(_5);
+ nop;
StorageLive(_5);
StorageLive(_6);
_6 = copy _1;
- _5 = move _6 as *const u32 (PtrToPtr);
@@ -78,10 +77,9 @@
StorageDead(_12);
- _10 = move _11 as *const u32 (PtrToPtr);
- StorageDead(_11);
- StorageLive(_13);
+ _10 = copy _11;
+ nop;
+ nop;
StorageLive(_13);
StorageLive(_14);
_14 = copy _4;
- _13 = move _14 as *const u32 (PtrToPtr);
@@ -122,12 +120,10 @@
StorageDead(_21);
StorageDead(_18);
StorageDead(_15);
- StorageDead(_13);
+ nop;
StorageDead(_13);
StorageDead(_10);
StorageDead(_7);
- StorageDead(_5);
+ nop;
StorageDead(_5);
return;
}
}
@@ -49,8 +49,7 @@
}
bb0: {
- StorageLive(_5);
+ nop;
StorageLive(_5);
StorageLive(_6);
_6 = copy _1;
- _5 = move _6 as *const u32 (PtrToPtr);
@@ -78,10 +77,9 @@
StorageDead(_12);
- _10 = move _11 as *const u32 (PtrToPtr);
- StorageDead(_11);
- StorageLive(_13);
+ _10 = copy _11;
+ nop;
+ nop;
StorageLive(_13);
StorageLive(_14);
_14 = copy _4;
- _13 = move _14 as *const u32 (PtrToPtr);
@@ -122,12 +120,10 @@
StorageDead(_21);
StorageDead(_18);
StorageDead(_15);
- StorageDead(_13);
+ nop;
StorageDead(_13);
StorageDead(_10);
StorageDead(_7);
- StorageDead(_5);
+ nop;
StorageDead(_5);
return;
}
}
@@ -22,22 +22,19 @@
}
bb0: {
- StorageLive(_2);
+ nop;
StorageLive(_2);
StorageLive(_3);
_3 = copy _1;
- _2 = move _3 as *const [u8; 4] (PtrToPtr);
+ _2 = copy _1 as *const [u8; 4] (PtrToPtr);
StorageDead(_3);
- StorageLive(_4);
+ nop;
StorageLive(_4);
StorageLive(_5);
_5 = copy _2;
- _4 = move _5 as *const u8 (PtrToPtr);
+ _4 = copy _1 as *const u8 (PtrToPtr);
StorageDead(_5);
- StorageLive(_6);
+ nop;
StorageLive(_6);
StorageLive(_7);
_7 = copy _4;
- _6 = move _7 as *const () (PtrToPtr);
@@ -48,12 +45,9 @@
- _0 = *const [u8] from (move _8, const 4_usize);
+ _0 = *const [u8] from (copy _1, const 4_usize);
StorageDead(_8);
- StorageDead(_6);
- StorageDead(_4);
- StorageDead(_2);
+ nop;
+ nop;
+ nop;
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);
return;
}
}
@@ -22,22 +22,19 @@
}
bb0: {
- StorageLive(_2);
+ nop;
StorageLive(_2);
StorageLive(_3);
_3 = copy _1;
- _2 = move _3 as *const [u8; 4] (PtrToPtr);
+ _2 = copy _1 as *const [u8; 4] (PtrToPtr);
StorageDead(_3);
- StorageLive(_4);
+ nop;
StorageLive(_4);
StorageLive(_5);
_5 = copy _2;
- _4 = move _5 as *const u8 (PtrToPtr);
+ _4 = copy _1 as *const u8 (PtrToPtr);
StorageDead(_5);
- StorageLive(_6);
+ nop;
StorageLive(_6);
StorageLive(_7);
_7 = copy _4;
- _6 = move _7 as *const () (PtrToPtr);
@@ -48,12 +45,9 @@
- _0 = *const [u8] from (move _8, const 4_usize);
+ _0 = *const [u8] from (copy _1, const 4_usize);
StorageDead(_8);
- StorageDead(_6);
- StorageDead(_4);
- StorageDead(_2);
+ nop;
+ nop;
+ nop;
StorageDead(_6);
StorageDead(_4);
StorageDead(_2);
return;
}
}
@@ -25,9 +25,8 @@
}
bb0: {
- StorageLive(_2);
StorageLive(_2);
- _2 = const core::num::<impl u64>::MAX as usize (IntToInt);
+ nop;
+ _2 = const usize::MAX;
StorageLive(_3);
StorageLive(_4);
@@ -96,8 +95,7 @@
bb7: {
StorageDead(_14);
StorageDead(_3);
- StorageDead(_2);
+ nop;
StorageDead(_2);
return;
}
}
@@ -25,9 +25,8 @@
}
bb0: {
- StorageLive(_2);
StorageLive(_2);
- _2 = const core::num::<impl u64>::MAX as usize (IntToInt);
+ nop;
+ _2 = const usize::MAX;
StorageLive(_3);
StorageLive(_4);
@@ -96,8 +95,7 @@
bb7: {
StorageDead(_14);
StorageDead(_3);
- StorageDead(_2);
+ nop;
StorageDead(_2);
return;
}
}
@@ -20,16 +20,14 @@
bb0: {
StorageLive(_2);
_2 = &(*_1);
- StorageLive(_3);
+ nop;
StorageLive(_3);
_3 = copy (*_2);
StorageLive(_4);
- _4 = copy (*_2);
+ _4 = copy _3;
_0 = const ();
StorageDead(_4);
- StorageDead(_3);
+ nop;
StorageDead(_3);
StorageDead(_2);
return;
}
@@ -20,16 +20,14 @@
bb0: {
StorageLive(_2);
_2 = &(*_1);
- StorageLive(_3);
+ nop;
StorageLive(_3);
_3 = copy (*_2);
StorageLive(_4);
- _4 = copy (*_2);
+ _4 = copy _3;
_0 = const ();
StorageDead(_4);
- StorageDead(_3);
+ nop;
StorageDead(_3);
StorageDead(_2);
return;
}
@@ -14,16 +14,14 @@
}
bb0: {
- StorageLive(_2);
+ nop;
StorageLive(_2);
_2 = copy ((*_1).0: &u8);
StorageLive(_3);
- _3 = copy ((*_1).0: &u8);
+ _3 = copy _2;
_0 = const ();
StorageDead(_3);
- StorageDead(_2);
+ nop;
StorageDead(_2);
return;
}
}
@@ -14,16 +14,14 @@
}
bb0: {
- StorageLive(_2);
+ nop;
StorageLive(_2);
_2 = copy ((*_1).0: &u8);
StorageLive(_3);
- _3 = copy ((*_1).0: &u8);
+ _3 = copy _2;
_0 = const ();
StorageDead(_3);
- StorageDead(_2);
+ nop;
StorageDead(_2);
return;
}
}
@@ -32,16 +32,14 @@
_3 = copy ((*_2).0: &u8);
StorageLive(_4);
_4 = copy (*_1);
- StorageLive(_5);
+ nop;
StorageLive(_5);
_5 = copy ((*_4).0: &u8);
StorageLive(_6);
- _6 = copy ((*_4).0: &u8);
+ _6 = copy _5;
_0 = const ();
StorageDead(_6);
- StorageDead(_5);
+ nop;
StorageDead(_5);
StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
@@ -32,16 +32,14 @@
_3 = copy ((*_2).0: &u8);
StorageLive(_4);
_4 = copy (*_1);
- StorageLive(_5);
+ nop;
StorageLive(_5);
_5 = copy ((*_4).0: &u8);
StorageLive(_6);
- _6 = copy ((*_4).0: &u8);
+ _6 = copy _5;
_0 = const ();
StorageDead(_6);
- StorageDead(_5);
+ nop;
StorageDead(_5);
StorageDead(_4);
StorageDead(_3);
StorageDead(_2);
@@ -35,8 +35,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer(Safe), AsCast));
StorageLive(_2);
StorageLive(_3);
@@ -48,8 +47,7 @@
bb1: {
StorageDead(_3);
StorageDead(_2);
- StorageLive(_4);
+ nop;
StorageLive(_4);
_4 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer(Safe), AsCast));
StorageLive(_5);
StorageLive(_6);
@@ -61,12 +59,10 @@
bb2: {
StorageDead(_6);
StorageDead(_5);
- StorageLive(_7);
StorageLive(_7);
- _7 = {closure@$DIR/gvn.rs:629:19: 629:21};
- StorageLive(_8);
+ nop;
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:629:19: 629:21};
+ nop;
StorageLive(_8);
StorageLive(_9);
- _9 = copy _7;
- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
@@ -83,8 +79,7 @@
bb3: {
StorageDead(_11);
StorageDead(_10);
- StorageLive(_12);
+ nop;
StorageLive(_12);
StorageLive(_13);
- _13 = copy _7;
- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
@@ -102,16 +97,11 @@
StorageDead(_15);
StorageDead(_14);
_0 = const ();
- StorageDead(_12);
- StorageDead(_8);
- StorageDead(_7);
- StorageDead(_4);
- StorageDead(_1);
+ nop;
+ nop;
+ nop;
+ nop;
+ nop;
StorageDead(_12);
StorageDead(_8);
StorageDead(_7);
StorageDead(_4);
StorageDead(_1);
return;
}
}
@@ -35,8 +35,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer(Safe), AsCast));
StorageLive(_2);
StorageLive(_3);
@@ -48,8 +47,7 @@
bb1: {
StorageDead(_3);
StorageDead(_2);
- StorageLive(_4);
+ nop;
StorageLive(_4);
_4 = identity::<u8> as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer(Safe), AsCast));
StorageLive(_5);
StorageLive(_6);
@@ -61,12 +59,10 @@
bb2: {
StorageDead(_6);
StorageDead(_5);
- StorageLive(_7);
StorageLive(_7);
- _7 = {closure@$DIR/gvn.rs:629:19: 629:21};
- StorageLive(_8);
+ nop;
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:629:19: 629:21};
+ nop;
StorageLive(_8);
StorageLive(_9);
- _9 = copy _7;
- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
@@ -83,8 +79,7 @@
bb3: {
StorageDead(_11);
StorageDead(_10);
- StorageLive(_12);
+ nop;
StorageLive(_12);
StorageLive(_13);
- _13 = copy _7;
- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
@@ -102,16 +97,11 @@
StorageDead(_15);
StorageDead(_14);
_0 = const ();
- StorageDead(_12);
- StorageDead(_8);
- StorageDead(_7);
- StorageDead(_4);
- StorageDead(_1);
+ nop;
+ nop;
+ nop;
+ nop;
+ nop;
StorageDead(_12);
StorageDead(_8);
StorageDead(_7);
StorageDead(_4);
StorageDead(_1);
return;
}
}
@@ -16,11 +16,9 @@
}
bb0: {
- StorageLive(_2);
+ nop;
StorageLive(_2);
_2 = &raw mut (*_1);
- StorageLive(_3);
+ nop;
StorageLive(_3);
StorageLive(_4);
_4 = copy _2;
- _3 = move _4 as *const [i32] (PtrToPtr);
@@ -31,10 +29,8 @@
- _0 = PtrMetadata(move _5);
+ _0 = PtrMetadata(copy _1);
StorageDead(_5);
- StorageDead(_3);
- StorageDead(_2);
+ nop;
+ nop;
StorageDead(_3);
StorageDead(_2);
return;
}
}
@@ -16,11 +16,9 @@
}
bb0: {
- StorageLive(_2);
+ nop;
StorageLive(_2);
_2 = &raw mut (*_1);
- StorageLive(_3);
+ nop;
StorageLive(_3);
StorageLive(_4);
_4 = copy _2;
- _3 = move _4 as *const [i32] (PtrToPtr);
@@ -31,10 +29,8 @@
- _0 = PtrMetadata(move _5);
+ _0 = PtrMetadata(copy _1);
StorageDead(_5);
- StorageDead(_3);
- StorageDead(_2);
+ nop;
+ nop;
StorageDead(_3);
StorageDead(_2);
return;
}
}
@@ -12,8 +12,7 @@
}
bb0: {
- StorageLive(_2);
+ nop;
StorageLive(_2);
StorageLive(_3);
_3 = copy _1;
- _2 = *const [i32] from (move _3, const 1_usize);
@@ -24,8 +23,7 @@
- _0 = PtrMetadata(move _4);
+ _0 = const 1_usize;
StorageDead(_4);
- StorageDead(_2);
+ nop;
StorageDead(_2);
return;
}
}
@@ -12,8 +12,7 @@
}
bb0: {
- StorageLive(_2);
+ nop;
StorageLive(_2);
StorageLive(_3);
_3 = copy _1;
- _2 = *const [i32] from (move _3, const 1_usize);
@@ -24,8 +23,7 @@
- _0 = PtrMetadata(move _4);
+ _0 = const 1_usize;
StorageDead(_4);
- StorageDead(_2);
+ nop;
StorageDead(_2);
return;
}
}
@@ -112,8 +112,7 @@
bb8: {
StorageDead(_17);
StorageDead(_16);
- StorageLive(_18);
+ nop;
StorageLive(_18);
_18 = &mut _1;
StorageLive(_19);
StorageLive(_20);
@@ -168,8 +167,7 @@
StorageDead(_28);
_0 = const ();
StorageDead(_19);
- StorageDead(_18);
+ nop;
StorageDead(_18);
drop(_1) -> [return: bb13, unwind unreachable];
}
@@ -112,8 +112,7 @@
bb8: {
StorageDead(_17);
StorageDead(_16);
- StorageLive(_18);
+ nop;
StorageLive(_18);
_18 = &mut _1;
StorageLive(_19);
StorageLive(_20);
@@ -168,8 +167,7 @@
StorageDead(_28);
_0 = const ();
StorageDead(_19);
- StorageDead(_18);
+ nop;
StorageDead(_18);
drop(_1) -> [return: bb13, unwind: bb15];
}
@@ -23,8 +23,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const 5_i32;
StorageLive(_2);
StorageLive(_3);
@@ -71,8 +70,7 @@
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -23,8 +23,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const 5_i32;
StorageLive(_2);
StorageLive(_3);
@@ -71,8 +70,7 @@
StorageDead(_3);
_0 = const ();
StorageDead(_2);
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
}
@@ -17,8 +17,7 @@
}
bb0: {
- StorageLive(_2);
+ nop;
StorageLive(_2);
StorageLive(_3);
_3 = &(*_1);
_2 = core::slice::<impl [i32]>::as_ptr(move _3) -> [return: bb1, unwind unreachable];
@@ -26,8 +25,7 @@
bb1: {
StorageDead(_3);
- StorageLive(_4);
+ nop;
StorageLive(_4);
_4 = const 123_usize;
StorageLive(_5);
_5 = copy _2;
@@ -38,10 +36,8 @@
+ _0 = *const [i32] from (copy _2, const 123_usize);
StorageDead(_6);
StorageDead(_5);
- StorageDead(_4);
- StorageDead(_2);
+ nop;
+ nop;
StorageDead(_4);
StorageDead(_2);
return;
}
}
@@ -17,8 +17,7 @@
}
bb0: {
- StorageLive(_2);
+ nop;
StorageLive(_2);
StorageLive(_3);
_3 = &(*_1);
_2 = core::slice::<impl [i32]>::as_ptr(move _3) -> [return: bb1, unwind continue];
@@ -26,8 +25,7 @@
bb1: {
StorageDead(_3);
- StorageLive(_4);
+ nop;
StorageLive(_4);
_4 = const 123_usize;
StorageLive(_5);
_5 = copy _2;
@@ -38,10 +36,8 @@
+ _0 = *const [i32] from (copy _2, const 123_usize);
StorageDead(_6);
StorageDead(_5);
- StorageDead(_4);
- StorageDead(_2);
+ nop;
+ nop;
StorageDead(_4);
StorageDead(_2);
return;
}
}
@@ -17,8 +17,7 @@
}
bb0: {
- StorageLive(_3);
+ nop;
StorageLive(_3);
StorageLive(_4);
_4 = copy _1;
StorageLive(_5);
@@ -43,8 +42,7 @@
+ _0 = (copy _1, move _8);
StorageDead(_8);
StorageDead(_6);
- StorageDead(_3);
+ nop;
StorageDead(_3);
return;
}
}
@@ -17,8 +17,7 @@
}
bb0: {
- StorageLive(_3);
+ nop;
StorageLive(_3);
StorageLive(_4);
_4 = copy _1;
StorageLive(_5);
@@ -43,8 +42,7 @@
+ _0 = (copy _1, move _8);
StorageDead(_8);
StorageDead(_6);
- StorageDead(_3);
+ nop;
StorageDead(_3);
return;
}
}
+14 -28
View File
@@ -82,8 +82,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const "my favourite slice";
StorageLive(_2);
StorageLive(_3);
@@ -113,9 +112,8 @@
StorageLive(_7);
StorageLive(_8);
- StorageLive(_9);
- StorageLive(_10);
+ nop;
+ nop;
StorageLive(_10);
StorageLive(_11);
_11 = &(*_1);
_10 = core::str::<impl str>::as_ptr(move _11) -> [return: bb3, unwind unreachable];
@@ -125,9 +123,8 @@
StorageDead(_11);
_9 = &_10;
- StorageLive(_12);
- StorageLive(_13);
+ nop;
+ nop;
StorageLive(_13);
StorageLive(_14);
- _14 = &(*_4);
+ _14 = &(*_1);
@@ -168,14 +165,11 @@
StorageDead(_17);
StorageDead(_16);
StorageDead(_15);
- StorageDead(_13);
- StorageDead(_10);
+ nop;
+ nop;
StorageDead(_13);
StorageDead(_10);
StorageDead(_8);
StorageDead(_7);
- StorageLive(_29);
+ nop;
StorageLive(_29);
StorageLive(_30);
_30 = &(*_1);
_29 = move _30 as &[u8] (Transmute);
@@ -190,9 +184,8 @@
bb6: {
StorageDead(_19);
StorageDead(_18);
- StorageLive(_21);
StorageLive(_21);
- _21 = core::panicking::AssertKind::Eq;
+ nop;
+ _21 = const core::panicking::AssertKind::Eq;
StorageLive(_22);
StorageLive(_23);
@@ -221,9 +214,8 @@
StorageLive(_33);
StorageLive(_34);
- StorageLive(_35);
- StorageLive(_36);
+ nop;
+ nop;
StorageLive(_36);
StorageLive(_37);
_37 = &(*_1);
_36 = core::str::<impl str>::as_ptr(move _37) -> [return: bb8, unwind unreachable];
@@ -233,9 +225,8 @@
StorageDead(_37);
_35 = &_36;
- StorageLive(_38);
- StorageLive(_39);
+ nop;
+ nop;
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
_39 = core::slice::<impl [u8]>::as_ptr(move _40) -> [return: bb9, unwind unreachable];
@@ -275,27 +266,22 @@
StorageDead(_43);
StorageDead(_42);
StorageDead(_41);
- StorageDead(_39);
- StorageDead(_36);
+ nop;
+ nop;
StorageDead(_39);
StorageDead(_36);
StorageDead(_34);
StorageDead(_33);
_0 = const ();
- StorageDead(_29);
+ nop;
StorageDead(_29);
StorageDead(_4);
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
bb11: {
StorageDead(_45);
StorageDead(_44);
- StorageLive(_47);
StorageLive(_47);
- _47 = core::panicking::AssertKind::Eq;
+ nop;
+ _47 = const core::panicking::AssertKind::Eq;
StorageLive(_48);
StorageLive(_49);
+14 -28
View File
@@ -82,8 +82,7 @@
}
bb0: {
- StorageLive(_1);
+ nop;
StorageLive(_1);
_1 = const "my favourite slice";
StorageLive(_2);
StorageLive(_3);
@@ -113,9 +112,8 @@
StorageLive(_7);
StorageLive(_8);
- StorageLive(_9);
- StorageLive(_10);
+ nop;
+ nop;
StorageLive(_10);
StorageLive(_11);
_11 = &(*_1);
_10 = core::str::<impl str>::as_ptr(move _11) -> [return: bb3, unwind continue];
@@ -125,9 +123,8 @@
StorageDead(_11);
_9 = &_10;
- StorageLive(_12);
- StorageLive(_13);
+ nop;
+ nop;
StorageLive(_13);
StorageLive(_14);
- _14 = &(*_4);
+ _14 = &(*_1);
@@ -168,14 +165,11 @@
StorageDead(_17);
StorageDead(_16);
StorageDead(_15);
- StorageDead(_13);
- StorageDead(_10);
+ nop;
+ nop;
StorageDead(_13);
StorageDead(_10);
StorageDead(_8);
StorageDead(_7);
- StorageLive(_29);
+ nop;
StorageLive(_29);
StorageLive(_30);
_30 = &(*_1);
_29 = move _30 as &[u8] (Transmute);
@@ -190,9 +184,8 @@
bb6: {
StorageDead(_19);
StorageDead(_18);
- StorageLive(_21);
StorageLive(_21);
- _21 = core::panicking::AssertKind::Eq;
+ nop;
+ _21 = const core::panicking::AssertKind::Eq;
StorageLive(_22);
StorageLive(_23);
@@ -221,9 +214,8 @@
StorageLive(_33);
StorageLive(_34);
- StorageLive(_35);
- StorageLive(_36);
+ nop;
+ nop;
StorageLive(_36);
StorageLive(_37);
_37 = &(*_1);
_36 = core::str::<impl str>::as_ptr(move _37) -> [return: bb8, unwind continue];
@@ -233,9 +225,8 @@
StorageDead(_37);
_35 = &_36;
- StorageLive(_38);
- StorageLive(_39);
+ nop;
+ nop;
StorageLive(_39);
StorageLive(_40);
_40 = &(*_29);
_39 = core::slice::<impl [u8]>::as_ptr(move _40) -> [return: bb9, unwind continue];
@@ -275,27 +266,22 @@
StorageDead(_43);
StorageDead(_42);
StorageDead(_41);
- StorageDead(_39);
- StorageDead(_36);
+ nop;
+ nop;
StorageDead(_39);
StorageDead(_36);
StorageDead(_34);
StorageDead(_33);
_0 = const ();
- StorageDead(_29);
+ nop;
StorageDead(_29);
StorageDead(_4);
- StorageDead(_1);
+ nop;
StorageDead(_1);
return;
}
bb11: {
StorageDead(_45);
StorageDead(_44);
- StorageLive(_47);
StorageLive(_47);
- _47 = core::panicking::AssertKind::Eq;
+ nop;
+ _47 = const core::panicking::AssertKind::Eq;
StorageLive(_48);
StorageLive(_49);

Some files were not shown because too many files have changed in this diff Show More