Skip to content

Conversation

@amanasifkhalid
Copy link
Contributor

@amanasifkhalid amanasifkhalid commented Aug 14, 2025

Follow-up to #118463. As we walk a loop's blocks in RPO, propagate the side-effecting nature of each block to its successors, rather than flipping a single flag once side-effecting code is encountered.

Copilot AI review requested due to automatic review settings August 14, 2025 16:10
@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 Aug 14, 2025
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 improves the precision of side effect propagation during loop hoisting optimization in the JIT compiler. The change replaces a simple boolean flag with a more sophisticated bit vector approach to track which blocks have encountered side effects.

  • Replaces the m_beforeSideEffect boolean field with a m_sideEffectBlocks bit vector
  • Tracks side effect state per block rather than globally across the entire loop
  • Propagates side effect state to successor blocks when side effects are encountered

@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.

@amanasifkhalid
Copy link
Contributor Author

cc @dotnet/jit-contrib, @AndyAyersMS PTAL. Diffs show PerfScore improvements outnumbering regressions in most collections, except for libraries_tests_no_tiered_compilation. Thanks!

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Can you call out some specific benchmarks where you expect to see perf improvements?

Can you verify any of these with local runs? Or via Egorbot?

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

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

Approving but would still like to see some examples where this will resolve current perf issues.

@amanasifkhalid
Copy link
Contributor Author

@EgorBot --arm --filter ByteMark.BenchLUDecomp

@amanasifkhalid
Copy link
Contributor Author

@AndyAyersMS I'm not seeing as much impact in the microbenchmarks as I hoped for, mainly because this seems to impact the OSR variants of various benchmarks instead of their Tier 1 variants. Since this change looks riskier than #118463, I'm ok with holding off on this.

@AndyAyersMS
Copy link
Member

@AndyAyersMS I'm not seeing as much impact in the microbenchmarks as I hoped for, mainly because this seems to impact the OSR variants of various benchmarks instead of their Tier 1 variants. Since this change looks riskier than #118463, I'm ok with holding off on this.

Sure, makes sense. Thanks for checking.

@JulieLeeMSFT
Copy link
Member

@AndyAyersMS, is this ready to merge?

@AndyAyersMS
Copy link
Member

We backed out a previous change so I'd say no. We need to look at that one and this carefully.

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