Skip to content

JIT: Allow liveness to remove some nodes with contained side effects #116819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented Jun 19, 2025

Contained operands with side effects can usually be handled by clearing their containment status. This is what we did before #116144 which changed the DCE to skip nodes with contained side effects. However, the only case that does not support its own standalone codegen is currently embedded mask ops, so switch to check more specifically for this case.

This fixes a case where after removing a call node we could end up with a unused FIELD_LIST with a contained IND node, and also fixes the regressions seen because of #116144.

Also switches GenTree::VisitOperands to return the visit result, and switches NodeOrContainedOperandsMayThrow() to use it (it is slightly more efficient than the iterator version).

Most ideally we would just allow these embedded mask ops to work as top-level nodes, like all other containment candidates.

Fix #116814

Contained operands with side effects can usually be handled by clearing
their containment status. This is what we did before
3091730 which changed the DCE to skip
nodes with contained side effects. However, the only case that does not
support its own standalone codegen is currently embedded mask ops, so
switch to check more specifically for this case.

This fixes a case where after removing a call node we could end up with
a unused `FIELD_LIST` with a contained IND node, and also fixes the
regressions seen because of 3091730.
@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 Jun 19, 2025
Copy link
Contributor

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

// Only embedded mask ops do not support standalone codegen. All other
// nodes can be uncontained.
//
bool Compiler::fgCanUncontainOrRemoveOperands(GenTree* node)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm happy that this won't break anything I was fixing.

@jakobbotsch jakobbotsch marked this pull request as ready for review June 20, 2025 08:59
@jakobbotsch
Copy link
Member Author

PTAL @dotnet/jit-contrib

Minor diffs. Essentially just undoing the regressions from #116144

@jakobbotsch jakobbotsch requested a review from a team June 20, 2025 09:04
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: Assertion failed '!node->IsUnusedValue() || !node->OperIs(GT_FIELD_LIST, GT_INIT_VAL)' during 'Global local var liveness'
3 participants