Revert "Use record_operands_moved
more aggresively"
This reverts commit 7f3e8551dd
.
This commit is contained in:
parent
a71a819480
commit
bed69c6134
11 changed files with 200 additions and 124 deletions
|
@ -12,8 +12,6 @@ use rustc_middle::mir::*;
|
|||
use rustc_middle::ty::{self, Ty, UpvarSubsts};
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::slice;
|
||||
|
||||
impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
/// Returns an rvalue suitable for use until the end of the current
|
||||
/// scope expression.
|
||||
|
@ -120,9 +118,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
block =
|
||||
this.into(this.hir.tcx().mk_place_deref(Place::from(result)), block, value)
|
||||
);
|
||||
let result_operand = Operand::Move(Place::from(result));
|
||||
this.record_operands_moved(slice::from_ref(&result_operand));
|
||||
block.and(Rvalue::Use(result_operand))
|
||||
block.and(Rvalue::Use(Operand::Move(Place::from(result))))
|
||||
}
|
||||
ExprKind::Cast { source } => {
|
||||
let source = unpack!(block = this.as_operand(block, scope, source));
|
||||
|
@ -166,7 +162,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
.map(|f| unpack!(block = this.as_operand(block, scope, f)))
|
||||
.collect();
|
||||
|
||||
this.record_operands_moved(&fields);
|
||||
block.and(Rvalue::Aggregate(box AggregateKind::Array(el_ty), fields))
|
||||
}
|
||||
ExprKind::Tuple { fields } => {
|
||||
|
@ -177,7 +172,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
.map(|f| unpack!(block = this.as_operand(block, scope, f)))
|
||||
.collect();
|
||||
|
||||
this.record_operands_moved(&fields);
|
||||
block.and(Rvalue::Aggregate(box AggregateKind::Tuple, fields))
|
||||
}
|
||||
ExprKind::Closure { closure_id, substs, upvars, movability } => {
|
||||
|
@ -229,7 +223,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
}
|
||||
UpvarSubsts::Closure(substs) => box AggregateKind::Closure(closure_id, substs),
|
||||
};
|
||||
this.record_operands_moved(&operands);
|
||||
block.and(Rvalue::Aggregate(result, operands))
|
||||
}
|
||||
ExprKind::Assign { .. } | ExprKind::AssignOp { .. } => {
|
||||
|
|
|
@ -10,8 +10,6 @@ use rustc_hir as hir;
|
|||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::CanonicalUserTypeAnnotation;
|
||||
|
||||
use std::slice;
|
||||
|
||||
impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
/// Compile `expr`, storing the result into `destination`, which
|
||||
/// is assumed to be uninitialized.
|
||||
|
@ -277,6 +275,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
let fields: Vec<_> = if let Some(FruInfo { base, field_types }) = base {
|
||||
let place_builder = unpack!(block = this.as_place_builder(block, base));
|
||||
|
||||
|
||||
// MIR does not natively support FRU, so for each
|
||||
// base-supplied field, generate an operand that
|
||||
// reads it from the base.
|
||||
|
@ -314,7 +313,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
user_ty,
|
||||
active_field_index,
|
||||
);
|
||||
this.record_operands_moved(&fields);
|
||||
this.cfg.push_assign(
|
||||
block,
|
||||
source_info,
|
||||
|
@ -441,7 +439,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
let scope = this.local_scope();
|
||||
let value = unpack!(block = this.as_operand(block, Some(scope), value));
|
||||
let resume = this.cfg.start_new_block();
|
||||
this.record_operands_moved(slice::from_ref(&value));
|
||||
this.cfg.terminate(
|
||||
block,
|
||||
source_info,
|
||||
|
|
|
@ -3,7 +3,6 @@ use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
|
|||
use crate::thir::*;
|
||||
use rustc_middle::middle::region;
|
||||
use rustc_middle::mir::*;
|
||||
use std::slice;
|
||||
|
||||
impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
/// Builds a block of MIR statements to evaluate the THIR `expr`.
|
||||
|
@ -47,7 +46,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
if this.hir.needs_drop(lhs.ty) {
|
||||
let rhs = unpack!(block = this.as_local_operand(block, rhs));
|
||||
let lhs = unpack!(block = this.as_place(block, lhs));
|
||||
this.record_operands_moved(slice::from_ref(&rhs));
|
||||
unpack!(block = this.build_drop_and_replace(block, lhs_span, lhs, rhs));
|
||||
} else {
|
||||
let rhs = unpack!(block = this.as_local_rvalue(block, rhs));
|
||||
|
|
|
@ -1352,7 +1352,7 @@ impl<'tcx> DropTreeBuilder<'tcx> for Unwind {
|
|||
| TerminatorKind::Yield { .. }
|
||||
| TerminatorKind::GeneratorDrop
|
||||
| TerminatorKind::FalseEdge { .. }
|
||||
| TerminatorKind::InlineAsm { .. } => {
|
||||
| TerminatorKind::InlineAsm {.. } => {
|
||||
span_bug!(term.source_info.span, "cannot unwind from {:?}", term.kind)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue