summary refs log tree commit diff
path: root/src/librustc_mir/dataflow
AgeCommit message (Collapse)AuthorLines
2018-07-24Auto merge of #52597 - oli-obk:promotion_simplify, r=nagisabors-0/+4
Promoteds are statics and statics have a place, not just a value r? @eddyb This makes everything around promoteds a little simpler
2018-07-24Rollup merge of #52641 - ljedrz:mir_dataflow_misc, r=cramertjkennytm-12/+3
Simplify 2 functions in rustc_mir/dataflow - `graphviz::outgoing`: the `enumerate` only provides indices; use a range instead - `DataflowState::interpret_set`: change a push loop to an iterator and remove the `each_bit` helper function
2018-07-23Simplify 2 functions in rustc_mir/dataflowljedrz-12/+3
2018-07-23Remove unneded lifetimes relations declarationSantiago Pastorino-2/+2
2018-07-23Let mir reference lifetime be inferredSantiago Pastorino-2/+2
2018-07-23Promoteds are statics and statics have a place, not just a valueOliver Schneider-0/+4
2018-07-21Add specific message when moving from upvars in a non-FnOnce closureMatthew Jasper-5/+5
2018-07-17Auto merge of #52335 - nnethercote:BitSlice-fixes, r=nikomatsakisbors-27/+17
`BitSlice` fixes `propagate_bits_into_entry_set_for` and `BitSlice::bitwise` are hot for some benchmarks under NLL. I tried and failed to speed them up. (Increasing the size of `bit_slice::Word` from `usize` to `u128` caused a slowdown, even though decreasing the size of `bitvec::Word` from `u128` to `u64` also caused a slowdown. Weird.) Anyway, along the way I fixed up several problems in and around the `BitSlice` code. r? @nikomatsakis
2018-07-13compute region values using SCCs not iterative flowNiko Matsakis-1/+1
The strategy is this: - we compute SCCs once all outlives constraints are known - we allocate a set of values **per region** for storing liveness - we allocate a set of values **per SCC** for storing the final values - when we add a liveness constraint to the region R, we also add it to the final value of the SCC to which R belongs - then we can apply the constraints by just walking the DAG for the SCCs and union'ing the children (which have their liveness constraints within) There are a few intermediate refactorings that I really ought to have broken out into their own commits: - reverse the constraint graph so that `R1: R2` means `R1 -> R2` and not `R2 -> R1`. This fits better with the SCC computation and new style of inference (`->` now means "take value from" and not "push value into") - this does affect some of the UI tests, since they traverse the graph, but mostly the artificial ones and they don't necessarily seem worse - put some things (constraint set, etc) into `Rc`. This lets us root them to permit mutation and iteration. It also guarantees they don't change, which is critical to the correctness of the algorithm. - Generalize various helpers that previously operated only on points to work on any sort of region element.
2018-07-13Make BitSlice's `Word` properly generic.Nicholas Nethercote-15/+15
Currently `Word` is `usize`, and there are various places in the code that assume this. This patch mostly just changes `usize` occurrences to `Word`. Most of the changes were found as compile errors when I changed `Word` to a type other than `usize`, but there was one non-obvious case in librustc_mir/dataflow/mod.rs that caused bounds check failures before I fixed it.
2018-07-13Inline and remove `DataflowAnalysis::num_bits_overall()`.Nicholas Nethercote-13/+3
It has a single callsite, and duplicates some code from that callsite. The code is more concise and clearer this way.
2018-07-06Rollup merge of #52067 - csmoe:issue-51167, r=nikomatsakisMark Rousskov-1/+2
Visit the mir basic blocks in reverse-postfix order cc #51167 r? @nikomatsakis
2018-07-05reverse_postordercsmoe-1/+2
2018-07-03Address #51813Pramod Bisht-44/+44
2018-07-01Auto merge of #51869 - nnethercote:rm-clone_from, r=nikomatsakisbors-2/+2
Avoid needless allocations in `liveness_of_locals`. We don't need to replace the heap-allocated bitset, we can just overwrite its contents. This speeds up most NLL benchmarks, the best by 1.5%. r? @nikomatsakis
2018-06-29Rename `IdxSet::clone_from`.Nicholas Nethercote-2/+2
The current situation is something of a mess. - `IdxSetBuf` derefs to `IdxSet`. - `IdxSetBuf` implements `Clone`, and therefore has a provided `clone_from` method, which does allocation and so is expensive. - `IdxSet` has a `clone_from` method that is non-allocating and therefore cheap, but this method is not from the `Clone` trait. As a result, if you have an `IdxSetBuf` called `b`, if you call `b.clone_from(b2)` you'll get the expensive `IdxSetBuf` method, but if you call `(*b).clone_from(b2)` you'll get the cheap `IdxSetBuf` method. `liveness_of_locals()` does the former, presumably unintentionally, and therefore does lots of unnecessary allocations. Having a `clone_from` method that isn't from the `Clone` trait is a bad idea in general, so this patch renames it as `overwrite`. This avoids the unnecessary allocations in `liveness_of_locals()`, speeding up most NLL benchmarks, the best by 1.5%. It also means that calls of the form `(*b).clone_from(b2)` can be rewritten as `b.overwrite(b2)`.
2018-06-27Group move errors before reporting, add suggestionsMatthew Jasper-11/+10
2018-06-19Avoid allocations in `has_any_child_of`.Nicholas Nethercote-11/+18
`has_any_child_of` is hot. It allocates a `Vec` that almost always doesn't exceed a length of 1. This patch peels off the first iteration of the loop, avoiding the need for the `Vec` creation in ~99% of cases.
2018-06-06When NLL has illegal move due to borrowed content, provide feedback about ↵Felix S. Klock II-5/+20
why the move wasn't a copy. This should address #51190.
2018-05-30Auto merge of #51106 - davidtwco:issue-50934, r=nikomatsakisbors-13/+77
Optimize the way that loans are killed in borrowck dataflow Fixes #50934. r? @nikomatsakis
2018-05-29rust-lang/rust#27282: Add `StatementKind::ReadForMatch` to MIR.Felix S. Klock II-0/+4
(This is just the data structure changes and some boilerplate match code that followed from it; the actual emission of these statements comes in a follow-up commit.)
2018-05-29fix off by one errorNiko Matsakis-1/+1
2018-05-29tweak debug output some moreNiko Matsakis-2/+7
2018-05-29Ensure that all statements in block are visited not just successors of a block.David Wood-8/+18
2018-05-29add some debugging statementsNiko Matsakis-0/+3
2018-05-29Refactored DFS to be much cleaner. Added continue after noting that borrow ↵David Wood-99/+27
is out of scope at location.
2018-05-27Ensure that depth first search does not get stuck in cycles.David Wood-12/+28
2018-05-27Ensure that we don't skip the last statement.David Wood-2/+2
2018-05-27Use precomputed DFS of borrows that out of scope at a location.David Wood-14/+116
2018-05-24Use AllFacts from polonius-engineSantiago Pastorino-1/+1
2018-05-19Remove extra calls to kill_loans_out_of_scope_at_location - keep only ↵David Wood-5/+0
before_statement_effect and before_terminator_effect.
2018-05-03Instrument `statement_effect_on_borrows` for the `lhs = &place` case.Felix S. Klock II-0/+6
2018-05-01rustc: return impl Iterator from Terminator(Kind)::successors(_mut).Eduard-Mihai Burtescu-3/+3
2018-04-15remove -Znll -- borrowck=mir implies nll nowNiko Matsakis-31/+20
2018-04-15stop using `borrows` for anything but iterating over live dataNiko Matsakis-26/+1
2018-04-15thread borrow-set around moreNiko Matsakis-3/+3
2018-04-15remove `ReserveOrActivateIndex`Niko Matsakis-62/+20
2018-04-15use the `activations_at_location` map to check activationsNiko Matsakis-0/+7
Not gen bits
2018-04-15encapsulate ReserveOrActivateIndex into the borrows dataflowNiko Matsakis-1/+0
2018-04-15construct the `BorrowSet` outside of `borrows`Niko Matsakis-8/+8
2018-04-15extract code to build borrow-set into `borrow_check::borrow_set`Niko Matsakis-404/+12
Also: - Extract common helper functions into a helper trait. - Kill a bit of dead code.
2018-04-15relocate `BorrowData` etc into `borrow_check::borrow_set`Niko Matsakis-77/+26
2018-04-15gather activation locations for 2-phase borrows in 1 passNiko Matsakis-98/+139
2018-04-15remove `assigned_map` (appears to be dead code)Niko Matsakis-9/+0
2018-04-07Auto merge of #49678 - bobtwinkles:fix_multiple_activations, r=nikomatsakisbors-14/+8
two-phase borrows: support multiple activations in one statement The need for this has arisen since the introduction of two-phase borrows on method autorefs in #49348. r'ing @pnkfelix to keep things off Niko's plate so he can make this redundant, and @pnkfelix is familiar with the code. Fixes #49635 Fixes #49662 r? @pnkfelix
2018-04-06Use `Ident` instead of `Name` in `MetaItem`Vadim Petrochenkov-1/+1
2018-04-04two-phase borrows: support multiple activations in one statementbobtwinkles-14/+8
The need for this has arisen since the introduction of two-phase borrows on method autorefs. Fixes 49635 Fixes 49662
2018-04-02avoid IdxSets containing garbage above the universe lengthAriel Ben-Yehuda-2/+2
This makes sure that all bits in each IdxSet between the universe length and the end of the word are all zero instead of being in an indeterminate state. This fixes a crash with RUST_LOG=rustc_mir, and is probably a good idea anyway.
2018-03-24Auto merge of #48482 - davidtwco:issue-47184, r=nikomatsakisbors-0/+2
NLL should identify and respect the lifetime annotations that the user wrote Part of #47184. r? @nikomatsakis
2018-03-22Added UserAssertTy statement.David Wood-0/+2