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: TryLowerAndOpToExtractLowestSetBit checks the wrong node for GTF_SET_FLAGS #130845
TryLowerAndOpToExtractLowestSetBit rewrites X & (-X) into ExtractLowestSetBit (BLSI). Before doing so it must bail if a downstream consumer relies on the CPU flags produced by the node being removed, because AND and BLSI set the flags differently.
The guard tests opNode (the surviving leaf operand) instead of andNode (the GT_AND root that is actually removed and replaced):
opNode is a dead/irrelevant check here; the flags that matter belong to andNode. The sibling helper TryLowerAndOpToResetLowestSetBit correctly checks its removed root node. The guard should test andNode instead.
This is latent by lowering order today -- the AND's GTF_SET_FLAGS is only set later, when the consuming compare-to-zero is lowered -- but the check is still wrong and should be made consistent with the sibling helpers.
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)