Skip to content
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

JIT: Fix improperly contained BroadcastScalarToVector(CreateScalar(GT_LONG)) #113994

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

saucecontrol
Copy link
Member

@saucecontrol saucecontrol commented Mar 28, 2025

Fixes #113832 (comment)

This was another case where CreateScalar([GT_LONG]) was improperly assumed to be containable in a broadcast, which in turn allowed the broadcast to be contained in another instruction as an EVEX embedded broadcast. It was assumed that if the CreateScalar contained its operand, it was a memory load, and a broadcast could peek through to the memory operand.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 28, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Mar 28, 2025
@saucecontrol saucecontrol changed the title JIT: Fix improperly contained CreateScalar(GT_LONG) on x86 JIT: Fix improperly contained BroadcastScalarToVector(CreateScalar(GT_LONG)) Mar 28, 2025
@saucecontrol saucecontrol marked this pull request as ready for review March 28, 2025 03:57
@JulieLeeMSFT
Copy link
Member

@BruceForstall, PTAL.

@saucecontrol
Copy link
Member Author

Last commit adds a second fix for this issue. Either works in isolation, but this resolves the broken pattern from two sides.

  1. Since BroadcastScalarToVector attempts to look through its HWIntrinsic operand, we make sure it can see through both CreateScalar and CreateScalarUnsafe for the containment check, where it will see that GT_LONG is not containable as a memory op.
  2. For anything else that attempts to contain a CreateScalar/Unsafe, a contained GT_LONG will not result in the incorrect assumption that the CreateScalar/Unsafe is a memory load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member
Projects
None yet
2 participants