Skip to content

[DRAFT][PROTO] Push constants right more frequently#127688

Closed
tannergooding wants to merge 1 commit intodotnet:mainfrom
tannergooding:push-cns-right
Closed

[DRAFT][PROTO] Push constants right more frequently#127688
tannergooding wants to merge 1 commit intodotnet:mainfrom
tannergooding:push-cns-right

Conversation

@tannergooding
Copy link
Copy Markdown
Member

Just a prototype to see what potential optimizations might be missing here...

Copilot AI review requested due to automatic review settings May 2, 2026 22:53
@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 May 2, 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.

@tannergooding tannergooding changed the title Push constants right more frequently [DRAFT][PROTO] Push constants right more frequently May 2, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This draft prototype moves fgPushConstantsRight into gtFoldExpr so constant-right canonicalization happens earlier during JIT folding, rather than only later in morph/optimization. In the CoreCLR JIT, that broadens when compare/commutative trees get rewritten and affects a very hot path.

Changes:

  • Adds an early fgPushConstantsRight call in Compiler::gtFoldExpr.
  • Applies the rewrite to commutative ops and compare ops before the existing tier0/minopts bailout.
  • Intends to expose more folding opportunities by normalizing operand order sooner.

Comment thread src/coreclr/jit/gentree.cpp Outdated
Comment thread src/coreclr/jit/gentree.cpp Outdated
Comment thread src/coreclr/jit/gentree.cpp Outdated
Copilot AI review requested due to automatic review settings May 3, 2026 02:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread src/coreclr/jit/gentree.cpp
Comment thread src/coreclr/jit/gentree.cpp
@tannergooding
Copy link
Copy Markdown
Member Author

Very minimal diffs, basically just a couple minor optimizations for adc

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