-
Notifications
You must be signed in to change notification settings - Fork 5.2k
JIT: avoid looking for integral ranges for non-integer constants #117220
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
We increasingly see constant byrefs. Make sure those don't trip up range-based optimizations. Fixes dotnet#116861.
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 adds an early exit in the relational comparison optimizer to skip range-based optimizations when either operand isn’t an integral type.
- Caches
op1andop2for reuse - Checks both operand types with
varTypeIsIntegral - Returns immediately if a non-integral type is detected
Comments suppressed due to low confidence (1)
src/coreclr/jit/morph.cpp:9071
- Consider adding unit tests to cover the new early-return path for non-integral operands (e.g., floating-point constants) to verify that the optimizer skips range logic as intended.
if (!varTypeIsIntegral(op1->TypeGet()) || !varTypeIsIntegral(op2->TypeGet()))
|
@EgorBo PTAL |
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
|
/azp run runtime-coreclr libraries-pgo |
|
Azure Pipelines successfully started running 1 pipeline(s). |
tannergooding
left a comment
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.
The nuance between integer and byref constants seems to come up quite a bit.
I wonder if we'd have less overall problems if we had CNS_INT and CNS_REF here, so we could be more explicit about the two concepts and what is safe for each (or something like IsIntegralConst(/*allowByref*/ true) where it defaults to not including ref/byref typed integer constants.
|
libraries-pgo failure is unrelated: opened #117225 |
We increasingly see constant byrefs. Make sure those don't trip up range-based optimizations.
Fixes #116861.