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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.

{
return NO_ASSERTION_INDEX;
}

// Check for op1 or op2 to be lcl var and if so, keep it in op1.
if ((op1->gtOper != GT_LCL_VAR) && (op2->gtOper == GT_LCL_VAR))
{
Expand Down
Loading