-
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
Fix incorrect VN when folding GT_NEG(GT_MUL(A, C)) #57651
Conversation
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsFixes #57640 cc @dotnet/jit-contrib @SingleAccretion
|
I guess it has to be back ported to 6.0 branch |
Yep, I'll do it once this makes it through CI |
@@ -13177,6 +13177,7 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac) | |||
GenTree* newOp2 = gtNewIconNode(-constVal, op1op2->TypeGet()); // -C |
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 think we also want to update the VN for the new constant (this is what we do in other places). But since we haven't actually found a bug with it (yet), and the way to do it is kinda verbose right now, and I will be PRing changes that will make it less verbose soon, and the fact that this PR is likely to be backported, I think it is fine to leave this as is.
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.
Right, this ends up as a constant without any VN, but my impression was that we handle this ok downstream.
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 similarly haven't seen places in the optimizer that would trip up on a NoVN
constant tree. I would not be surprised if they exist though, these contracts on what should and should not be maintained are very implicit.
@jakobbotsch can you please do the same with https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/morph.cpp#L11175-L11189 or ideally somehow unify it with NEG(MUL(A,C)) opt |
@EgorBo I don't think those have the problem since they don't return a sub tree. |
ah, right, nvm, in case of |
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
CI failures look like #57620 |
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1144500550 |
Fixes #57640
cc @dotnet/jit-contrib @SingleAccretion