Skip to content
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

JIT: avoid local jtrue assertions involving floating types #94935

Merged
merged 1 commit into from
Nov 18, 2023

Conversation

AndyAyersMS
Copy link
Member

Float relop equality does not imply bitwise equality. So skip making local jtrue assertions about floating types.

Contributes to #93246.

Float relop equality does not imply bitwise equality. So skip
making local jtrue assertions about floating types.

Contributes to dotnet#93246.
@ghost ghost assigned AndyAyersMS Nov 17, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 17, 2023
@ghost
Copy link

ghost commented Nov 17, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

Float relop equality does not imply bitwise equality. So skip making local jtrue assertions about floating types.

Contributes to #93246.

Author: AndyAyersMS
Assignees: AndyAyersMS
Labels:

area-CodeGen-coreclr

Milestone: -

@AndyAyersMS
Copy link
Member Author

@jakobbotsch PTAL
cc @dotnet/jit-contrib

This is also running in a draft PR where cross-block is enabled; see #94689

@@ -2205,6 +2205,13 @@ AssertionInfo Compiler::optAssertionGenJtrue(GenTree* tree)
GenTree* op1 = relop->AsOp()->gtOp1->gtCommaStoreVal();
GenTree* op2 = relop->AsOp()->gtOp2->gtCommaStoreVal();

// Avoid creating local assertions for float types.
//
if (optLocalAssertionProp && varTypeIsFloating(op1))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍.

Just noting we could expand this in the future...

We have some well-defined APIs like IsNaN, IsInfinity, IsFinite, etc. These can all be used to drive other assertions.

Likewise if we know that op2 isn't NaN and isn't zero, then bitwise equality does hold (we take advantage of this in import to optimize min and max for example, when one input is a constant).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a note to #93246 so we don't forget about this.

@AndyAyersMS AndyAyersMS merged commit 8b75cf2 into dotnet:main Nov 18, 2023
127 of 129 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants