-
Notifications
You must be signed in to change notification settings - Fork 5k
JIT: Keep side effects in promotion decomposition #115221
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
Conversation
If the source is a load from an arbitrary address and the destination is a local that is unused then it may be that we end up creating no loads at all. In that case we should still keep the side effects of the address computation.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
cc @dotnet/jit-contrib PTAL @kunalspathak |
There was a problem hiding this 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 addresses issue #114571 by ensuring that side effects from address computations are preserved even when the resultant load is unused.
- Adds a regression test in Runtime_114571.cs to trigger a NullReferenceException due to a null array access.
- Modifies the JIT promotion decomposition logic in promotiondecomposition.cpp to extract and keep side effects when there are zero uses of the address.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/tests/JIT/Regression/JitBlue/Runtime_114571/Runtime_114571.cs | Introduces a regression test that intentionally causes a NullReferenceException to verify behavior. |
src/coreclr/jit/promotiondecomposition.cpp | Alters the condition to extract side effects when numAddrUses is 0, ensuring side effects are maintained. |
Files not reviewed (1)
- src/tests/JIT/Regression/JitBlue/Runtime_114571/Runtime_114571.csproj: Language not supported
@@ -588,7 +588,17 @@ class DecompositionPlan | |||
numAddrUses++; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding a comment explaining why side effects are extracted when numAddrUses equals 0 to clarify that this branch preserves the side effects of the address computation for unused loads.
// If the address is not used (numAddrUses == 0), we still need to preserve | |
// any side effects from the address computation. Extract these side effects | |
// and add them to the statement list to ensure they are not lost. |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
If the source is a load from an arbitrary address and the destination is a local that is unused then it may be that we end up creating no loads at all. In that case we should still keep the side effects of the address computation.
Fix #114571