- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.2k
Clear contained flag from AND->NOT transformation #117801
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
Conversation
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.
Pull Request Overview
This PR fixes a bug in the JIT compiler's constant comparison optimization by clearing the contained flag when transforming AND operations into NOT operations. The issue occurs during the lowering phase when optimizing comparisons like EQ|NE(AND(x, y), y) into EQ|NE(AND(NOT(x), y), 0).
- Adds a call to ClearContained()before creating the NOT node to prevent incorrect code generation
- Fixes three reported issues related to improper handling of contained flags during tree transformations
| Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch | 
| /ba-g "Segmentation fault in clang on osx-x64 Debug CoreCLR_Libraries" | 
Fixes #117795
Fixes #117783
Fixes #116657
Fixes #116674
Introduced in #111933
We had
AND(X, CNS)where we marked X as contained. Then this transformation convertedAND(X, CNS)intoNOT(X)whileXis still marked as contained when the emitter doesn't support containment for this node.