Skip to content

Commit e8aeb68

Browse files
committed
Auto merge of #47954 - eddyb:copy-elision, r=<try>
[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
2 parents 4d2d3fc + 44afedf commit e8aeb68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1830
-261
lines changed
File renamed without changes.

src/librustc_mir/dataflow/at_location.rs src/librustc_mir/analysis/dataflow/at_location.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use rustc::mir::{BasicBlock, Location};
1515
use rustc_data_structures::indexed_set::{self, IdxSetBuf};
1616
use rustc_data_structures::indexed_vec::Idx;
1717

18-
use dataflow::{BitDenotation, BlockSets, DataflowResults};
19-
use dataflow::move_paths::{HasMoveData, MovePathIndex};
18+
use analysis::dataflow::{BitDenotation, BlockSets, DataflowResults};
19+
use analysis::dataflow::move_paths::{HasMoveData, MovePathIndex};
2020

2121
use std::iter;
2222

src/librustc_mir/dataflow/impls/borrowed_locals.rs src/librustc_mir/analysis/dataflow/impls/borrowed_locals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub use super::*;
1212

1313
use rustc::mir::*;
1414
use rustc::mir::visit::Visitor;
15-
use dataflow::BitDenotation;
15+
use analysis::dataflow::BitDenotation;
1616

1717
/// This calculates if any part of a MIR local could have previously been borrowed.
1818
/// This means that once a local has been borrowed, its bit will always be set

src/librustc_mir/dataflow/impls/borrows.rs src/librustc_mir/analysis/dataflow/impls/borrows.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use rustc_data_structures::bitslice::{BitwiseOperator};
2323
use rustc_data_structures::indexed_set::{IdxSet};
2424
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
2525

26-
use dataflow::{BitDenotation, BlockSets, InitialFlow};
27-
pub use dataflow::indexes::{BorrowIndex, ReserveOrActivateIndex};
26+
use analysis::dataflow::{BitDenotation, BlockSets, InitialFlow};
27+
pub use analysis::dataflow::indexes::{BorrowIndex, ReserveOrActivateIndex};
2828
use borrow_check::nll::region_infer::RegionInferenceContext;
2929
use borrow_check::nll::ToRegionVid;
3030

src/librustc_mir/dataflow/impls/storage_liveness.rs src/librustc_mir/analysis/dataflow/impls/storage_liveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
pub use super::*;
1212

1313
use rustc::mir::*;
14-
use dataflow::BitDenotation;
14+
use analysis::dataflow::BitDenotation;
1515

1616
#[derive(Copy, Clone)]
1717
pub struct MaybeStorageLive<'a, 'tcx: 'a> {

src/librustc_mir/dataflow/mod.rs src/librustc_mir/analysis/dataflow/mod.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ pub struct MoveDataParamEnv<'gcx, 'tcx> {
121121
pub(crate) param_env: ty::ParamEnv<'gcx>,
122122
}
123123

124-
pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
125-
mir: &'a Mir<'tcx>,
126-
node_id: ast::NodeId,
127-
attributes: &[ast::Attribute],
128-
dead_unwinds: &IdxSet<BasicBlock>,
129-
bd: BD,
130-
p: P)
131-
-> DataflowResults<BD>
124+
pub(crate) fn do_dataflow<BD, P>(tcx: TyCtxt,
125+
mir: &Mir,
126+
node_id: ast::NodeId,
127+
attributes: &[ast::Attribute],
128+
dead_unwinds: &IdxSet<BasicBlock>,
129+
bd: BD,
130+
p: P)
131+
-> DataflowResults<BD>
132132
where BD: BitDenotation + InitialFlow,
133133
P: Fn(&BD, BD::Idx) -> DebugFormatted
134134
{
@@ -139,7 +139,7 @@ pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
139139
impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation
140140
{
141141
pub(crate) fn run<P>(self,
142-
tcx: TyCtxt<'a, 'gcx, 'tcx>,
142+
tcx: TyCtxt,
143143
node_id: ast::NodeId,
144144
attributes: &[ast::Attribute],
145145
p: P) -> DataflowResults<BD>
@@ -513,7 +513,7 @@ pub struct BlockSets<'a, E: Idx> {
513513
}
514514

515515
impl<'a, E:Idx> BlockSets<'a, E> {
516-
fn gen(&mut self, e: &E) {
516+
pub(crate) fn gen(&mut self, e: &E) {
517517
self.gen_set.add(e);
518518
self.kill_set.remove(e);
519519
}
@@ -538,7 +538,7 @@ impl<'a, E:Idx> BlockSets<'a, E> {
538538
}
539539
}
540540

541-
fn kill(&mut self, e: &E) {
541+
pub(crate) fn kill(&mut self, e: &E) {
542542
self.gen_set.remove(e);
543543
self.kill_set.add(e);
544544
}
File renamed without changes.

0 commit comments

Comments
 (0)