Adding some constant folding support for basic floating-point operations#103206
Adding some constant folding support for basic floating-point operations#103206tannergooding merged 4 commits intodotnet:mainfrom
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.
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.
👍, 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.
EgorBo
left a comment
There was a problem hiding this comment.
LGTM with a few comments in gtFoldExprSpecialFloating
This covers operations where it is safe to do so in the face of
NaNand+0 vs -0.