Skip to content

Commit

Permalink
Auto merge of #47954 - eddyb:copy-elision, r=<try>
Browse files Browse the repository at this point in the history
[WIP] Implement a "place unification" MIR optimization (aka source/destination propagation).

*nothing to see here* (PR open for testing purposes)

note to self: **DO NOT MERGE** without inspecting all `FIXME` / `HACK` comments
  • Loading branch information
bors committed Feb 13, 2018
2 parents 4d2d3fc + 44afedf commit e8aeb68
Show file tree
Hide file tree
Showing 56 changed files with 1,830 additions and 261 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use rustc::mir::{BasicBlock, Location};
use rustc_data_structures::indexed_set::{self, IdxSetBuf};
use rustc_data_structures::indexed_vec::Idx;

use dataflow::{BitDenotation, BlockSets, DataflowResults};
use dataflow::move_paths::{HasMoveData, MovePathIndex};
use analysis::dataflow::{BitDenotation, BlockSets, DataflowResults};
use analysis::dataflow::move_paths::{HasMoveData, MovePathIndex};

use std::iter;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub use super::*;

use rustc::mir::*;
use rustc::mir::visit::Visitor;
use dataflow::BitDenotation;
use analysis::dataflow::BitDenotation;

/// This calculates if any part of a MIR local could have previously been borrowed.
/// This means that once a local has been borrowed, its bit will always be set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use rustc_data_structures::bitslice::{BitwiseOperator};
use rustc_data_structures::indexed_set::{IdxSet};
use rustc_data_structures::indexed_vec::{Idx, IndexVec};

use dataflow::{BitDenotation, BlockSets, InitialFlow};
pub use dataflow::indexes::{BorrowIndex, ReserveOrActivateIndex};
use analysis::dataflow::{BitDenotation, BlockSets, InitialFlow};
pub use analysis::dataflow::indexes::{BorrowIndex, ReserveOrActivateIndex};
use borrow_check::nll::region_infer::RegionInferenceContext;
use borrow_check::nll::ToRegionVid;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
pub use super::*;

use rustc::mir::*;
use dataflow::BitDenotation;
use analysis::dataflow::BitDenotation;

#[derive(Copy, Clone)]
pub struct MaybeStorageLive<'a, 'tcx: 'a> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ pub struct MoveDataParamEnv<'gcx, 'tcx> {
pub(crate) param_env: ty::ParamEnv<'gcx>,
}

pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
mir: &'a Mir<'tcx>,
node_id: ast::NodeId,
attributes: &[ast::Attribute],
dead_unwinds: &IdxSet<BasicBlock>,
bd: BD,
p: P)
-> DataflowResults<BD>
pub(crate) fn do_dataflow<BD, P>(tcx: TyCtxt,
mir: &Mir,
node_id: ast::NodeId,
attributes: &[ast::Attribute],
dead_unwinds: &IdxSet<BasicBlock>,
bd: BD,
p: P)
-> DataflowResults<BD>
where BD: BitDenotation + InitialFlow,
P: Fn(&BD, BD::Idx) -> DebugFormatted
{
Expand All @@ -139,7 +139,7 @@ pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation
{
pub(crate) fn run<P>(self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
tcx: TyCtxt,
node_id: ast::NodeId,
attributes: &[ast::Attribute],
p: P) -> DataflowResults<BD>
Expand Down Expand Up @@ -513,7 +513,7 @@ pub struct BlockSets<'a, E: Idx> {
}

impl<'a, E:Idx> BlockSets<'a, E> {
fn gen(&mut self, e: &E) {
pub(crate) fn gen(&mut self, e: &E) {
self.gen_set.add(e);
self.kill_set.remove(e);
}
Expand All @@ -538,7 +538,7 @@ impl<'a, E:Idx> BlockSets<'a, E> {
}
}

fn kill(&mut self, e: &E) {
pub(crate) fn kill(&mut self, e: &E) {
self.gen_set.remove(e);
self.kill_set.add(e);
}
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e8aeb68

Please sign in to comment.