Skip to content

Commit 51345ce

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 616b66d + 401ced3 commit 51345ce

Some content is hidden

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

46 files changed

+1636
-162
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/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
@@ -120,14 +120,14 @@ pub struct MoveDataParamEnv<'gcx, 'tcx> {
120120
pub(crate) param_env: ty::ParamEnv<'gcx>,
121121
}
122122

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

514514
impl<'a, E:Idx> BlockSets<'a, E> {
515-
fn gen(&mut self, e: &E) {
515+
pub(crate) fn gen(&mut self, e: &E) {
516516
self.gen_set.add(e);
517517
self.kill_set.remove(e);
518518
}
@@ -537,7 +537,7 @@ impl<'a, E:Idx> BlockSets<'a, E> {
537537
}
538538
}
539539

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

0 commit comments

Comments
 (0)