Skip to content

JIT: Remove VNFOA_Commutative from value numbering attribute table#126895

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/delete-vnfoa-commutative
Closed

JIT: Remove VNFOA_Commutative from value numbering attribute table#126895
Copilot wants to merge 1 commit intomainfrom
copilot/delete-vnfoa-commutative

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

Delete VNFOA_Commutative from the VNFOpAttrib enum and from the valuenumfuncs.h table. Instead, VNFuncIsCommutative now lists commutative functions explicitly.

Changes

valuenumfuncs.h

  • Remove the commute (3rd) parameter from all ValueNumFuncDef macro invocations, changing from 4-arg to 3-arg: ValueNumFuncDef(name, arity, knownNonNull)
  • Updated the header comment to reflect the new macro signature
  • Removed ((flag) & HW_Flag_Commutative) >> 0 from the HARDWARE_INTRINSIC macro expansions

valuenum.h

  • Removed VNFOA_Commutative from the VNFOpAttrib enum and its associated shift constant and static_assert
  • Compacted the bit layout (arity now starts at bit 1, KnownNonNull at bit 4)
  • Removed commute parameter from GetOpAttribsForGenTree and GetOpAttribsForFunc declarations
  • Moved VNFuncIsCommutative from inline in the header to an out-of-line implementation in the .cpp (needed because HWIntrinsicInfo is not available in the header)

valuenum.cpp

  • New explicit VNFuncIsCommutative implementation that:
    • genTreeOps (< VNF_Boundary): delegates to GenTree::OperIsCommutative — covers GT_ADD, GT_MUL, GT_OR, GT_XOR, GT_AND, etc.
    • VNF overflow functions: explicit switch for VNF_ADD_OVF, VNF_MUL_OVF, VNF_ADD_UN_OVF, VNF_MUL_UN_OVF
    • RISCV64 intrinsics: VNF_MinInt, VNF_MaxInt, VNF_MinInt_UN, VNF_MaxInt_UN
    • HW intrinsics: delegates to HWIntrinsicInfo::IsCommutative
  • Updated GetOpAttribsForGenTree and GetOpAttribsForFunc to remove commute parameter
  • Updated all ValueNumFuncDef macro expansions in initialization/validation code
  • Removed the HW intrinsic commutative loop from ValidateValueNumStoreStatics

Missed commutativity check

VNF_OR/VNF_AND/VNF_XOR don't exist as VNF-range functions — these are genTreeOps (GT_OR, GT_AND, GT_XOR) handled by GenTree::OperIsCommutative. No previously-commutative functions are lost.

…ative list functions explicitly

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/c8b3fe1c-795e-4621-9863-dcb83f9ab22c

Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 14, 2026 18:27
Copilot AI requested a review from EgorBo April 14, 2026 18:33
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 14, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants