Skip to content

Commit 703e051

Browse files
committed
add perf fixme for MaybeInitializedPlaces domain
1 parent 430e230 commit 703e051

File tree

1 file changed

+12
-0
lines changed
  • compiler/rustc_borrowck/src/type_check/liveness

1 file changed

+12
-0
lines changed

compiler/rustc_borrowck/src/type_check/liveness/trace.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,18 @@ impl<'a, 'typeck, 'tcx> LivenessContext<'a, 'typeck, 'tcx> {
472472
self.flow_inits.get_or_insert_with(|| {
473473
let tcx = self.typeck.tcx();
474474
let body = self.typeck.body;
475+
// FIXME: reduce the `MaybeInitializedPlaces` domain to the useful `MovePath`s.
476+
//
477+
// This dataflow analysis computes maybe-initializedness of all move paths, which
478+
// explains why it can be expensive on big functions. But this data is only used in
479+
// drop-liveness. Therefore, most of the move paths computed here are ultimately unused,
480+
// even if the results are computed lazily and "no relevant live locals with drop
481+
// points" is the common case.
482+
//
483+
// So we only need the ones for 1) relevant live locals 2) that have drop points. That's
484+
// a much, much smaller domain: in our benchmarks, when it's not zero (the most likely
485+
// case), there are a few dozens compared to e.g. thousands or tens of thousands of
486+
// locals and move paths.
475487
let flow_inits = MaybeInitializedPlaces::new(tcx, body, self.move_data)
476488
.iterate_to_fixpoint(tcx, body, Some("borrowck"))
477489
.into_results_cursor(body);

0 commit comments

Comments
 (0)