Skip to content

Conversation

@lqd
Copy link
Member

@lqd lqd commented Dec 31, 2025

This PR rewrites the loan liveness algorithm to compute localized constraints lazily during traversal, to avoid the sometimes costly conversion and indexing happening in the current eager algorithm (or for now as well, the need to reshape the liveness data to better list regions live at a given point).

It thus greatly reduces the current alpha overhead, although it wasn't entirely removed of course (we're obviously doing more work to improve precision): the worst offending benchmark has a +5-6% wall-time regression — but icounts are worse looking (+13%) rn.

Best reviewed per-commit, as steps are in sequence to simplify the process or unify some things.

r? @jackh726

lqd added 8 commits December 29, 2025 23:38
now that the analysis is only using the regular liveness shape, we don't
need to store it transposed, and thus don't need the container where it
was stored: the liveness context would be alone in the polonius context.

we thus remove the latter, and rename the former.
we may need to traverse the lazy graph multiple times:
- to record loan liveness
- to dump the localized outlives constraint in the polonius MIR dump

to do that we extract the previous loan liveness code into an abstract
traversal + visitor handling the liveness-specific parts, while the MIR
dump will be able to record constraints in its own visitor.
now that we need to hold the graph for MIR dumping, and the associated
data to traverse it, there is no difference between the main context and
diagnostics context, so we merge them.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 31, 2025
@lqd lqd changed the title Compute localized outlives constraint lazily Compute localized outlives constraints lazily Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants