Skip to content

Remove unused functions from the xarch emitter#130803

Merged
tannergooding merged 2 commits into
dotnet:mainfrom
tannergooding:tannergooding-jit-remove-dead-xarch-emitter-fns
Jul 18, 2026
Merged

Remove unused functions from the xarch emitter#130803
tannergooding merged 2 commits into
dotnet:mainfrom
tannergooding:tannergooding-jit-remove-dead-xarch-emitter-fns

Conversation

@tannergooding

Copy link
Copy Markdown
Member

Removes 16 functions from the CoreCLR xarch emitter that had zero call sites anywhere in the repo. This is a DEBUG/encoding cleanup only -- no behavioral change.

Each function's declaration in emitxarch.h and definition (with its doc-comment block) in emitxarch.cpp was removed, after re-verifying zero callers via git grep -w <name> -- 'src/coreclr/*'.

Removed:

  • Prefix/encoding helpers: emitExtractRex2Prefix, AddRex2WPrefix, insKMaskBaseSize (all declared but never defined); AddVexPrefixIfNeeded, AddVexPrefixIfNeededAndNotPresent, AddSimdPrefixIfNeededAndNotPresent (unused inline defs)
  • Instruction emitters: emitIns_AI_R, emitIns_I_AI, emitIns_I_AX, emitIns_R_AX, emitIns_AX_R, emitIns_I_ARR, emitIns_I_ARX, emitIns_R_R_AR_I
  • Other: IsAVXOnlyInstruction, emitIns_J_S

Checked for cascaded dead code after removal via a zero-caller scan over all emitxarch.h-declared method names -- no functions became newly dead as a result of these deletions; every helper the removed bodies called remains used elsewhere.

emitIns_IJ was found to be a pre-existing zero-caller function unrelated to this change, so it is intentionally left out of scope here.

Build (build.cmd clr.jit -c checked -a x64) succeeds with 0 warnings / 0 errors, and jit-format produces no changes.

Note

This PR description and the changes were drafted with the assistance of GitHub Copilot.

These functions all had zero call sites anywhere in the repo:

- emitExtractRex2Prefix, AddRex2WPrefix, insKMaskBaseSize (declared, never defined)
- AddVexPrefixIfNeeded, AddVexPrefixIfNeededAndNotPresent, AddSimdPrefixIfNeededAndNotPresent (unused inline prefix helpers)
- emitIns_AI_R, emitIns_I_AI, emitIns_I_AX, emitIns_R_AX, emitIns_AX_R, emitIns_I_ARR, emitIns_I_ARX, emitIns_R_R_AR_I (unused instruction emitters)
- IsAVXOnlyInstruction, emitIns_J_S

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 15, 2026 17:47
@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 Jul 15, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
10 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR removes a set of unused CoreCLR xarch emitter helpers/emitters from src/coreclr/jit/emitxarch.h and emitxarch.cpp, reducing dead code in the JIT emitter without intended behavioral changes.

Changes:

  • Removed unused declarations and inline helpers from emitxarch.h (prefix/encoding helpers and several emitIns_* APIs).
  • Removed corresponding unused method implementations from emitxarch.cpp (including IsAVXOnlyInstruction and several emitIns_* helpers).
  • Verified by repository-wide search that the removed symbols have no remaining references.
Show a summary per file
File Description
src/coreclr/jit/emitxarch.h Deletes unused emitter APIs and inline prefix helpers from the xarch emitter header.
src/coreclr/jit/emitxarch.cpp Deletes unused xarch emitter method implementations corresponding to the removed declarations.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@tannergooding

Copy link
Copy Markdown
Member Author

@dotnet/jit-contrib, @EgorBo

More trivially dead code

Comment thread src/coreclr/jit/emitxarch.h
@tannergooding
tannergooding enabled auto-merge (squash) July 15, 2026 21:00
Copilot AI review requested due to automatic review settings July 15, 2026 23:27
@tannergooding

Copy link
Copy Markdown
Member Author

@EgorBo, needs re-approval due to resolving a merge conflict

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new

@tannergooding

Copy link
Copy Markdown
Member Author

/ba-g unrelated timeouts

@tannergooding
tannergooding merged commit 7b79fe4 into dotnet:main Jul 18, 2026
137 of 140 checks passed
@tannergooding
tannergooding deleted the tannergooding-jit-remove-dead-xarch-emitter-fns branch July 18, 2026 16:43
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 19, 2026
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.

3 participants