Skip to content

Conversation

jakobbotsch
Copy link
Member

There is no reason to keep the commas around, and for some struct IR it results in illegal IR (e.g. when splitting COMMA(op1, FIELD_LIST(...))).

Fixes an issue I hit over in #118778

There is no reason to keep the commas around, and for some struct IR it
results in illegal IR (e.g. when splitting COMMA(op1, FIELD_LIST(...))).
@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 Sep 2, 2025
@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@jakobbotsch jakobbotsch marked this pull request as ready for review September 2, 2025 20:49
@Copilot Copilot AI review requested due to automatic review settings September 2, 2025 20:49
Copy link
Contributor

@Copilot 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 a JIT issue where comma operators were sometimes incorrectly preserved during tree splitting, leading to illegal IR in certain cases. The fix ensures that comma operators are always properly removed during the splitting process.

Key changes:

  • Added logic to automatically remove comma operators during tree splitting
  • Prevents generation of illegal IR when splitting structures like COMMA(op1, FIELD_LIST(...))
Comments suppressed due to low confidence (1)

src/coreclr/jit/gentree.cpp:1

  • The code modifies *use at line 17171 but then uses the original useInf parameter at line 17172, which still references the old comma node. After line 17171, useInf should be updated to reflect the new use location, or a new UseInfo should be created for the second operand.
// Licensed to the .NET Foundation under one or more agreements.

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS

Some improvements, but most of all ensures we can split the IR shape mentioned above.

@jakobbotsch jakobbotsch merged commit b3de022 into dotnet:main Sep 2, 2025
133 of 137 checks passed
@jakobbotsch jakobbotsch deleted the split-commas-smartly branch September 2, 2025 22:25
filipnavara pushed a commit to filipnavara/runtime that referenced this pull request Sep 5, 2025
There is no reason to keep the commas around, and for some struct IR it
results in illegal IR (e.g. when splitting COMMA(op1, FIELD_LIST(...))).
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.

2 participants