-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Check for non-valid compare chains (#76566) #76662
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue Detailsnull
|
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.
Can we rename isContainedAndNotIntOrIImmed() => isContainedPartOfCompareChain()
or isPartOfCompareChain
and make it check this condition instead?
Agreed it's a horrible name. But, when isolated, the function isn't really connected to compare chains, which is why it ended up as it did. I've switched it to isContainedCompareChainSegment(), and tidied up IsValidCompareChain() a little. |
CI build errors all seem to be network issues |
Will rerun CI. |
I ran spmidiff across the coreclr testsuite. There was a single function that differed with this patch. Before:
With patch:
IR:
Code is fine in both. But slightly longer with my patch. Change is due to the check in Lowering::OptimizeConstCompare(). The code says if this is a Contained Compare Chain Segment then don't do the OptimizeConstCompare optimisations. With my patch, it correctly determines 817 isn't a Compare Chain and then proceeds to optimise away the Without my patch it incorrectly decides 817 is a Compare Chain and returns without removing the I'm thinking if the check in OptimizeConstCompare() should be reverted back to checking for isContainedAndNotIntOrIImmed(). |
I would keep the code as is, I think this tiny regression is not something to worry about since we were just getting it right by chance. If we want to fix this, we should make the make the AND optimization aware of this interaction with the other optimization. |
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.
Thanks!
Small change to not fall over when finding contained nodes that aren't a valid compare chain.