Skip to content

JIT: Further liveness cleanups#123999

Merged
jakobbotsch merged 5 commits intodotnet:mainfrom
jakobbotsch:further-liveness-cleanup
Feb 5, 2026
Merged

JIT: Further liveness cleanups#123999
jakobbotsch merged 5 commits intodotnet:mainfrom
jakobbotsch:further-liveness-cleanup

Conversation

@jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented Feb 4, 2026

  • Give each liveness phase its own separate function
  • Remove Compiler::fgIsDoingEarlyLiveness in favor of a new config option in Liveness
  • Move fgLocalVarLivenessChanged into Liveness
  • Rename some fields in Liveness
  • Remove optimization level checks in liveness since we only run liveness when optimizing and have done so for a while
  • Remove the LiveVarAnalysis class and merge it into the Liveness class

No diffs expected. The last change here (removing LiveVarAnalysis) has some TP regressions on MSVC, once again related to inlining decisions.

Copilot AI review requested due to automatic review settings February 4, 2026 11:53
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 4, 2026
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the JIT liveness analysis code to improve code organization and maintainability. The main goal is to separate different liveness phases into distinct functions and consolidate related functionality.

Changes:

  • Replaced runtime check fgIsDoingEarlyLiveness with compile-time template parameter IsEarly
  • Moved fgLocalVarLivenessChanged into the Liveness class as m_livenessChanged
  • Renamed private member fields in Liveness class from fgCur* prefix to m_cur* prefix for consistency
  • Removed the LiveVarAnalysis class and merged its functionality into the Liveness class
  • Removed unnecessary optimization level checks (opts.MinOpts()) since liveness only runs when optimizations are enabled
  • Split the generic fgLocalVarLiveness() into separate specialized functions: fgSsaLiveness(), fgAsyncLiveness(), fgPostLowerLiveness()

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/coreclr/jit/liveness.cpp Main refactoring: field renames, template parameter addition, class consolidation, optimization check removal, new specialized liveness functions
src/coreclr/jit/compiler.h Updated function declarations, removed obsolete fields fgLocalVarLivenessChanged and fgIsDoingEarlyLiveness
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()
src/coreclr/jit/async.cpp Updated call from fgLocalVarLiveness() to fgAsyncLiveness()

@jakobbotsch jakobbotsch marked this pull request as ready for review February 4, 2026 14:20
Copilot AI review requested due to automatic review settings February 4, 2026 14:20
@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS

No asm diffs, some throughput diffs (mostly improvements).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@jakobbotsch jakobbotsch merged commit fbd12d9 into dotnet:main Feb 5, 2026
130 of 132 checks passed
@jakobbotsch jakobbotsch deleted the further-liveness-cleanup branch February 5, 2026 10:34
lewing pushed a commit to lewing/runtime that referenced this pull request Feb 9, 2026
- Give each liveness phase its own separate function
- Remove `Compiler::fgIsDoingEarlyLiveness` in favor of a new config
option in `Liveness`
- Move `fgLocalVarLivenessChanged` into `Liveness`
- Rename some fields in `Liveness`
- Remove optimization level checks in liveness since we only run
liveness when optimizing and have done so for a while
- Remove the `LiveVarAnalysis` class and merge it into the `Liveness`
class

No diffs expected. The last change here (removing `LiveVarAnalysis`) has
some TP regressions on MSVC, once again related to inlining decisions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants