mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #52612 - matthewjasper:remove-unnecessary-flow, r=nikomatsakis
Don't keep the possibly initialized flow around longer than needed The possibly initialized flow isn't used after liveness is computed, so don't keep it around. Locally this is about a 10% time win for tuple-stress (which is spending a lot of time calculating flows now that it's not spending so much on liveness). r? @nikomatsakis
This commit is contained in:
commit
3900bf8ae3
@ -26,7 +26,7 @@ use dataflow::move_paths::HasMoveData;
|
||||
use dataflow::Borrows;
|
||||
use dataflow::{EverInitializedPlaces, MovingOutStatements};
|
||||
use dataflow::{FlowAtLocation, FlowsAtLocation};
|
||||
use dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
|
||||
use dataflow::MaybeUninitializedPlaces;
|
||||
use either::Either;
|
||||
use std::fmt;
|
||||
use std::rc::Rc;
|
||||
@ -34,7 +34,6 @@ use std::rc::Rc;
|
||||
// (forced to be `pub` due to its use as an associated type below.)
|
||||
crate struct Flows<'b, 'gcx: 'tcx, 'tcx: 'b> {
|
||||
borrows: FlowAtLocation<Borrows<'b, 'gcx, 'tcx>>,
|
||||
pub inits: FlowAtLocation<MaybeInitializedPlaces<'b, 'gcx, 'tcx>>,
|
||||
pub uninits: FlowAtLocation<MaybeUninitializedPlaces<'b, 'gcx, 'tcx>>,
|
||||
pub move_outs: FlowAtLocation<MovingOutStatements<'b, 'gcx, 'tcx>>,
|
||||
pub ever_inits: FlowAtLocation<EverInitializedPlaces<'b, 'gcx, 'tcx>>,
|
||||
@ -46,7 +45,6 @@ crate struct Flows<'b, 'gcx: 'tcx, 'tcx: 'b> {
|
||||
impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> {
|
||||
crate fn new(
|
||||
borrows: FlowAtLocation<Borrows<'b, 'gcx, 'tcx>>,
|
||||
inits: FlowAtLocation<MaybeInitializedPlaces<'b, 'gcx, 'tcx>>,
|
||||
uninits: FlowAtLocation<MaybeUninitializedPlaces<'b, 'gcx, 'tcx>>,
|
||||
move_outs: FlowAtLocation<MovingOutStatements<'b, 'gcx, 'tcx>>,
|
||||
ever_inits: FlowAtLocation<EverInitializedPlaces<'b, 'gcx, 'tcx>>,
|
||||
@ -54,7 +52,6 @@ impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> {
|
||||
) -> Self {
|
||||
Flows {
|
||||
borrows,
|
||||
inits,
|
||||
uninits,
|
||||
move_outs,
|
||||
ever_inits,
|
||||
@ -81,7 +78,6 @@ impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> {
|
||||
macro_rules! each_flow {
|
||||
($this:ident, $meth:ident($arg:ident)) => {
|
||||
FlowAtLocation::$meth(&mut $this.borrows, $arg);
|
||||
FlowAtLocation::$meth(&mut $this.inits, $arg);
|
||||
FlowAtLocation::$meth(&mut $this.uninits, $arg);
|
||||
FlowAtLocation::$meth(&mut $this.move_outs, $arg);
|
||||
FlowAtLocation::$meth(&mut $this.ever_inits, $arg);
|
||||
@ -134,18 +130,6 @@ impl<'b, 'gcx, 'tcx> fmt::Display for Flows<'b, 'gcx, 'tcx> {
|
||||
});
|
||||
s.push_str("] ");
|
||||
|
||||
s.push_str("inits: [");
|
||||
let mut saw_one = false;
|
||||
self.inits.each_state_bit(|mpi_init| {
|
||||
if saw_one {
|
||||
s.push_str(", ");
|
||||
};
|
||||
saw_one = true;
|
||||
let move_path = &self.inits.operator().move_data().move_paths[mpi_init];
|
||||
s.push_str(&format!("{}", move_path));
|
||||
});
|
||||
s.push_str("] ");
|
||||
|
||||
s.push_str("uninits: [");
|
||||
let mut saw_one = false;
|
||||
self.uninits.each_state_bit(|mpi_uninit| {
|
||||
|
@ -216,7 +216,6 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
|
||||
&borrow_set,
|
||||
);
|
||||
let regioncx = Rc::new(regioncx);
|
||||
let flow_inits = flow_inits; // remove mut
|
||||
|
||||
let flow_borrows = FlowAtLocation::new(do_dataflow(
|
||||
tcx,
|
||||
@ -262,7 +261,6 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
|
||||
|
||||
let mut state = Flows::new(
|
||||
flow_borrows,
|
||||
flow_inits,
|
||||
flow_uninits,
|
||||
flow_move_outs,
|
||||
flow_ever_inits,
|
||||
|
Loading…
Reference in New Issue
Block a user