Skip to content

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

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

Merged
merged 2 commits into from
Mar 31, 2025

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.

@ghost ghost 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.

@BruceForstall
Copy link
Contributor

/azp run runtime-coreclr superpmi-diffs

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@BruceForstall
Copy link
Contributor

/ba-g azure linux 3 timeouts

@BruceForstall BruceForstall merged commit cd115dd into dotnet:main Mar 31, 2025
115 of 117 checks passed
@saucecontrol saucecontrol deleted the fix-112728 branch March 31, 2025 22:09
thaystg pushed a commit to thaystg/runtime that referenced this pull request Apr 1, 2025
…_LONG)) (dotnet#113994)

* fix improperly contained CreateScalar

* add check for BroadcastScalarToVector(CreateScalar())
@github-actions github-actions bot locked and limited conversation to collaborators May 1, 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 community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JIT: Assertion failed (consume == 0) || (ComputeAvailableSrcCount(tree) == consume) during 'Linear scan register alloc'
3 participants