You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: INSERTPS can mark op2 both contained and reg-optional #130846
In ContainCheckHWIntrinsic, the NI_X86Base_Insert (INSERTPS, FLOAT) case contains op2 when it is a zero vector -- the zero is fully elided and encoded into the INSERTPS zmask bits of the immediate:
TryMakeSrcContainedOrRegOptional then runs unconditionally. For a zero CNS_VEC, IsContainableHWIntrinsicOp returns false but first sets *supportsRegOptional = true (a non-LCL_VAR node is safe to mark reg-optional), so MakeSrcRegOptional is called and op2 ends up both contained and reg-optional -- a violated invariant.
The reg-optional flag is inert at runtime here (a contained zero CNS_VEC produces no operand uses, so no default-build assert fires and codegen is unaffected), but the invariant violation should be fixed by guarding the call on !op2->isContained(), matching the symmetric op1->IsVectorZero() branch just above which contains and never retries.
Confirmed via temporary JIT instrumentation (the "contained + reg-optional" state was observed without the guard).
Note
This issue was authored with the assistance of GitHub Copilot.
Activity
dotnet-policy-service commentedon Jul 16, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
Fix three xarch lowering correctness/invariant issues (dotnet#130843)