-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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: Add morphing to LE_UN/GT_UN(expr, uint.MaxValue) (dotnet#76525) #113037
base: main
Are you sure you want to change the base?
Conversation
Add morphing for comparison between uint.MaxValue and a ulong value.
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.
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
@dotnet-policy-service agree company="Microsoft" |
@@ -8067,6 +8067,8 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac, bool* optA | |||
{ | |||
tree = fgOptimizeRelationalComparisonWithConst(tree->AsOp()); | |||
oper = tree->OperGet(); | |||
op1 = tree->gtGetOp1(); | |||
op2 = tree->gtGetOp2(); |
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 asserts below this change check exactly that - is it needed?
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.
Yes. The morphing added in this commit is changing gtOp1, so we need to reload ops here just like for fgOptimizeRelationalComparisonWithCasts
.
runtime/src/coreclr/jit/morph.cpp
Line 9390 in 63a3a5f
cmp->gtOp1 = shiftNode; |
Before this commit, fgOptimizeRelationalComparisonWithConst
doesn't update op1 and op2, so there are pair of asserts to check it. Is it better to remove these asserts to clarify this?
assert(op1 == tree->AsOp()->gtGetOp1());
assert(op2 == tree->AsOp()->gtGetOp2());
Seems like CI failed with
|
GenTreeOp* shiftNode = gtNewOperNode(GT_RSZ, TYP_LONG, op1, icon32); | ||
shiftNode->SetMorphed(this); | ||
|
||
cmp->gtOp1 = shiftNode; |
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.
EQ/NE(RSZ(expr, 32), 0).
I don't see where that 0
is set here, what is cmp->gtOp2
at this point?
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.
I believe this line sets op2 to 0. All other morphing done in fgOptimizeRelationalComparisonWithConst
also don't set 0 explicitly.
runtime/src/coreclr/jit/morph.cpp
Line 9400 in 63a3a5f
op2->SetIntegralValue(0); |
Add morphing for comparison between uint.MaxValue and a ulong value.
Contribute to: #76525