Skip to content

Conversation

@jakobbotsch
Copy link
Member

Fix #122289

Didn't add the regression test because it will be broken by #122023.

I also tried adding conservative handling to SideEffectSet for the situation (see earlier commit), but that introduced a lot of regressions in cases where the reordering is ok, so I went with a more localized fix here.

@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 Dec 8, 2025
@jakobbotsch jakobbotsch marked this pull request as ready for review December 8, 2025 16:56
Copilot AI review requested due to automatic review settings December 8, 2025 16:56
@jakobbotsch
Copy link
Member Author

PTAL @dotnet/jit-contrib

No diffs

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 fixes issue #122289 by adding a check for nodes that consume CPU flags before reordering them in the OptimizeCallIndirectTargetEvaluation function. The fix prevents incorrect code generation that could occur when nodes consuming flags are reordered relative to the nodes that set those flags.

  • Adds OperConsumesFlags() check to prevent unsafe node reordering
  • Uses a localized fix rather than a more conservative approach that caused regressions
  • Follows existing patterns used in similar reordering checks in the codebase

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.

JIT: New lowering target evaluation optimization can move nodes past flags consumers

2 participants