Skip to content

JIT: fix range assertions for bypassed phi blocks - #133268

Open
EgorBo wants to merge 1 commit into
dotnet:mainfrom
EgorBo:fix-133267-phi-range-assertions
Open

JIT: fix range assertions for bypassed phi blocks#133268
EgorBo wants to merge 1 commit into
dotnet:mainfrom
EgorBo:fix-133267-phi-range-assertions

Conversation

@EgorBo

Copy link
Copy Markdown
Member

Fixes#133267. Avoid stale phi-block assertions after jump threading.

Copilot-generated.

Fixesdotnet#133267.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 56f763ef-1e54-421c-9e79-fe14ed2b906a
CopilotAI lite review requested due to automatic review settings September 4, 2026 22:10
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actionsgithub-actionsBot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Sep 4, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It changes JIT range/assertion-merging behavior (compiler correctness surface area), and I did not validate it with local builds/tests in this review.

Pull request overview

This PR updates JIT range-check analysis to avoid relying on potentially stale assertion sets after flow edits (e.g., jump threading bypassing phi-related blocks), and adds a targeted regression test for the reported miscompile scenario.

Changes:

  • Adjust range computation for locals so assertion merging happens at the use site (via MergeAssertion) rather than inside ComputeRangeForLocalDef.
  • Update ComputeRangeForLocalDef signature to no longer take the use block.
  • Add a new JitBlue regression test (Runtime_133267) and register it in Regression_ro_2.csproj.
File summaries
FileDescription
src/coreclr/jit/rangecheck.hUpdates ComputeRangeForLocalDef declaration to drop the BasicBlock* parameter.
src/coreclr/jit/rangecheck.cppMoves assertion merging responsibility to the local-use path (MergeAssertion) to avoid stale phi-block assertion inputs.
src/tests/JIT/Regression/JitBlue/Runtime_133267/Runtime_133267.csAdds a regression test that fails if the JIT incorrectly throws ArgumentException under optimization.
src/tests/JIT/Regression/Regression_ro_2.csprojRegisters the new regression test for compilation/execution in the ro_2 suite.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclrCLR 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.

Unexpected ArgumentException in Tier1 vs Tier0

2 participants

@EgorBo