Uh oh!
There was an error while loading. Please reload this page.
JIT: Compute async liveness for address exposed locals - #124001
Conversation
…inopts-async-live-set
This should still give correct liveness at async suspension points given that local addresses cannot be taken across those.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
There was a problem hiding this comment.
Pull request overview
This PR enables precise liveness computation for address-exposed locals during async transformations. Building on #123500 (which introduced full liveness computation for MinOpts with async), this change recognizes that local addresses cannot be taken across async suspension points, allowing the JIT to track address-exposed locals directly instead of conservatively treating them as always live.
Changes:
- Refactored the
Livenessclass template to support multiple liveness computation modes via compile-time template parameters (TrackAddressExposedLocals,IsEarly,EliminateDeadCode) - Replaced
fgLocalVarLiveness()with specialized functions:fgSsaLiveness(),fgAsyncLiveness(), andfgPostLowerLiveness() - Extracted
lvaComputePreciseRefCounts()fromlvaComputeRefCounts()to allow reuse in async transformations
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/liveness.cpp | Major refactoring of liveness computation to use template-based specialization; added fgSsaLiveness(), fgAsyncLiveness(), fgPostLowerLiveness(); renamed member variables for clarity; inlined LiveVarAnalysis into DoLiveVarAnalysis() |
| src/coreclr/jit/async.cpp | Updated to use fgAsyncLiveness() and lvaComputePreciseRefCounts(); simplified AsyncLiveness class by removing m_hasLiveness field; added cleanup logic for unoptimized codegen |
| src/coreclr/jit/compiler.h | Added declarations for new liveness functions and lvaComputePreciseRefCounts(); removed obsolete fgLocalVarLivenessChanged and fgIsDoingEarlyLiveness fields |
| src/coreclr/jit/lclvars.cpp | Extracted lvaComputePreciseRefCounts() as a separate function for reuse |
| src/coreclr/jit/ssabuilder.cpp | Updated call from fgLocalVarLiveness() to fgSsaLiveness() |
| src/coreclr/jit/lower.cpp | Updated calls from fgLocalVarLiveness() to fgPostLowerLiveness() |
| src/coreclr/jit/compiler.cpp | Updated call from fgLocalVarLiveness() to fgSsaLiveness() |
jakobbotsch
commented
Feb 6, 2026
/azp run Fuzzlyn |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jakobbotsch
commented
Feb 6, 2026
cc @dotnet/jit-contrib PTAL @AndyAyersMS This starts tracking address exposed locals for the liveness we do in the runtime async pass. It is based on a few observations:
|
Uh oh!
There was an error while loading. Please reload this page.
This should still give correct liveness at async suspension points given that local addresses cannot be taken across those. Based on dotnet#123500
This should still give correct liveness at async suspension points given that local addresses cannot be taken across those.
Based on #123500