-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Adding some constant folding support for basic floating-point operations #103206
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
CC. @dotnet/jit-contrib, just as the title indicates this enables constant folding for floating-point where it's applicable to do. Namely this applies to NaN propagation and a few cases where operations with With the |
src/coreclr/jit/gentree.cpp
Outdated
|
||
if (FloatingPointUtils::isNaN(val)) | ||
{ | ||
if (opHasSideEffects) |
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.
There is a convinient API that can help with side-effects, e.g. in this case it's:
gtWrapWithSideEffects(nanCns, op, GTF_ALL_EFFECT);
it's also fine to conservatively give up on them if it doesn't affect diffs I guess
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.
👍, didn't realize we had a helper for this. I've updated it, might get a follow up PR that looks to do the same for the integer folding.
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 with a few comments in gtFoldExprSpecialFloating
This covers operations where it is safe to do so in the face of
NaN
and+0 vs -0
.