Skip to content

Commit

Permalink
Auto merge of #68241 - ecstatic-morse:unified-dataflow-impls, r=pnkfelix
Browse files Browse the repository at this point in the history
Migrate borrowck dataflow impls to new framework

This uses #65672 to implement the dataflow analyses needed by borrowck. These include all the `InitializedPlaces` analyses as well as `Borrows`. Additionally, this PR contains several independent changes around the dataflow API which improve performance and make it more ergonomic.

* An optimization that inhibits the caching of block transfer functions for acyclic MIR (~0.3% I-CNT savings).
* A `ResultsVisitor` for dataflow results that is more efficient than `ResultsCursor` when we have to visit every statement unconditionally (~0.3% I-CNT savings).
* An `into_engine` method on `Analysis` that selects the appropriate `Engine` constructor.
* A `contains` method for `ResultsCursor` as a shorthand for `.get().contains()`.
* A `find_descendants` helper on `MovePath` that replaces `has_any_child_of` on the old `FlowsAtLocation`

These changes made porting the dataflow analyses much easier. Finally, this PR removes some now-unused code in `dataflow/at_location.rs` and elsewhere.

You can view the perf results for the final version of this PR [here](https://perf.rust-lang.org/compare.html?start=29b854fb741809c29764e33fc17c32ba9c6523ba&end=6e516c1410c18cfe4eb6d030a39fdb73c8d8a4fe). Here's an example of the graphviz diagrams that are generated for the `MaybeInitializedPlaces` analysis.

![image](https://user-images.githubusercontent.com/29463364/72846117-c3e97d80-3c54-11ea-8171-3d48981c9ddd.png)
  • Loading branch information
bors committed Feb 12, 2020
2 parents cd5441f + 5f40fe9 commit 2ed25f0
Show file tree
Hide file tree
Showing 18 changed files with 788 additions and 516 deletions.
142 changes: 0 additions & 142 deletions src/librustc_mir/borrow_check/flows.rs

This file was deleted.

Loading

0 comments on commit 2ed25f0

Please sign in to comment.