JIT: Allow liveness to remove some nodes with contained side effects #116819
+143
−98
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 switchesNodeOrContainedOperandsMayThrow()
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