Skip to content

Conversation

@EgorBo
Copy link
Member

@EgorBo EgorBo commented Jul 18, 2025

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 converted AND(X, CNS) into NOT(X) while X is still marked as contained when the emitter doesn't support containment for this node.

Copilot AI review requested due to automatic review settings July 18, 2025 03:15
Copy link
Contributor

Copilot AI left a 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

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 18, 2025
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@EgorBo EgorBo enabled auto-merge (squash) July 18, 2025 06:38
@EgorBo
Copy link
Member Author

EgorBo commented Jul 18, 2025

/ba-g "Segmentation fault in clang on osx-x64 Debug CoreCLR_Libraries"

@EgorBo EgorBo merged commit 1d6452a into dotnet:main Jul 18, 2025
113 of 116 checks passed
@EgorBo EgorBo deleted the remove-contained-flag branch July 18, 2025 06:39
khushal1996 pushed a commit to khushal1996/runtime that referenced this pull request Jul 21, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.