Skip to content

Conversation

@tannergooding
Copy link
Member

This resolves #117378

@tannergooding tannergooding added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 7, 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.

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 refactors the JIT’s unary mask folding to preserve the original second operand and adds a regression test reproducing the issue (fixes #117378).

  • Adjust gtFoldExprHWIntrinsic to use effectiveOper and avoid mutating op2 directly.
  • Add a new JIT regression test project and C# test to trigger the assertion.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/coreclr/jit/gentree.cpp Refactored mask-folding logic to handle GT_NOT without modifying op2
src/tests/JIT/Regression/JitBlue/Runtime_117377/Runtime_117377.csproj Added new test project
src/tests/JIT/Regression/JitBlue/Runtime_117377/Runtime_117377.cs Added generated test case calling the problematic intrinsic code
Comments suppressed due to low confidence (2)

src/tests/JIT/Regression/JitBlue/Runtime_117377/Runtime_117377.csproj:3

  • The project file is missing a element, so it won’t build. Add something like net8.0 inside the PropertyGroup to match other JIT tests.
    <Optimize>True</Optimize>

src/tests/JIT/Regression/JitBlue/Runtime_117377/Runtime_117377.cs:32

  • To ensure this method isn’t inlined (and thus triggers the intended JIT folding path), add [MethodImpl(MethodImplOptions.NoInlining)] above M4. Remember to import System.Runtime.CompilerServices.
        public byte M4()

Copy link
Contributor

@amanasifkhalid amanasifkhalid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@tannergooding
Copy link
Member Author

/ba-g unrelated timeouts/failures

@tannergooding tannergooding merged commit b02b5a0 into dotnet:main Jul 8, 2025
111 of 116 checks passed
@tannergooding tannergooding deleted the fix-117377 branch July 8, 2025 02:41
@github-actions github-actions bot locked and limited conversation to collaborators Aug 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: Assertion failed 'unreached' during 'Morph - Global'

2 participants