Skip to content

[JITLink][ORC] Clean up unused and assert-only function templates (NFC) - #202973

Merged
vgvassilev merged 1 commit into
llvm:mainfrom
flash1729:wunused-template-jitlink-orc
Jun 29, 2026
Merged

vgvassilev merged 1 commit into
llvm:mainfrom
flash1729:wunused-template-jitlink-orc

Conversation

@flash1729

Copy link
Copy Markdown
Member

These function templates trip -Wunused-template.

In aarch32.cpp, writeRegister has no callers, so it's removed. checkRegister is only used inside assert, so it gets compiled out in release builds (-DNDEBUG) and never instantiates; it's marked [[maybe_unused]]. Same story for stubAndPointerRangesOk in OrcABISupport.cpp, which is only used in asserts.

NFC.

Part of #202945.

These function templates trip `-Wunused-template`.

In `aarch32.cpp`, `writeRegister` has no callers, so it's removed.
`checkRegister` is only used inside `assert`, so it gets compiled out in release
builds (`-DNDEBUG`) and never instantiates; it's marked `[[maybe_unused]]`. Same
story for `stubAndPointerRangesOk` in `OrcABISupport.cpp`, which is only used in
asserts.

NFC.

Part of llvm#202945.
@flash1729

Copy link
Copy Markdown
Member Author

ping @lhames @weliveindetail

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

LGTM. Thanks @flash1729!

@vgvassilev
vgvassilev merged commit d98f750 into llvm:main Jun 29, 2026
9 checks passed
LouisLu060211 pushed a commit to LouisLu060211/llvm-project that referenced this pull request Jun 30, 2026
…C) (llvm#202973)

These function templates trip `-Wunused-template`.

In `aarch32.cpp`, `writeRegister` has no callers, so it's removed.
`checkRegister` is only used inside `assert`, so it gets compiled out in
release builds (`-DNDEBUG`) and never instantiates; it's marked
`[[maybe_unused]]`. Same story for `stubAndPointerRangesOk` in
`OrcABISupport.cpp`, which is only used in asserts.

NFC.

Part of llvm#202945.
maarcosrmz pushed a commit to maarcosrmz/llvm-project that referenced this pull request Jul 1, 2026
…C) (llvm#202973)

These function templates trip `-Wunused-template`.

In `aarch32.cpp`, `writeRegister` has no callers, so it's removed.
`checkRegister` is only used inside `assert`, so it gets compiled out in
release builds (`-DNDEBUG`) and never instantiates; it's marked
`[[maybe_unused]]`. Same story for `stubAndPointerRangesOk` in
`OrcABISupport.cpp`, which is only used in asserts.

NFC.

Part of llvm#202945.
vgvassilev pushed a commit that referenced this pull request Jul 6, 2026
Uncomment `UnusedTemplate` in the `Unused` diagnostic group so
`-Wunused-template` becomes part of `-Wall`.

`-Wunused-template` flags unused function and variable templates with
internal linkage. In a header, such a template gives every translation
unit its own internal-linkage copy, which is a latent ODR violation
(ill-formed, no diagnostic required), so enabling this surfaces a real
class of bugs and keeps the pattern from reappearing.

### Depends on

The in-tree occurrences were cleaned up first in a series of NFC PRs
tracked by #202945. This change only builds clean once those land, so CI
will be red on any area whose cleanup is not yet merged. Remaining
prerequisites:

Approved
- #202969
- #202971
- #202973
- #202974
- #206309
- #206312

Needs to be reviewed 
- #202988
- #206308

Closes #202945

cc @AaronBallman @vgvassilev
gandhi56 pushed a commit that referenced this pull request Jul 9, 2026
Uncomment `UnusedTemplate` in the `Unused` diagnostic group so
`-Wunused-template` becomes part of `-Wall`.

`-Wunused-template` flags unused function and variable templates with
internal linkage. In a header, such a template gives every translation
unit its own internal-linkage copy, which is a latent ODR violation
(ill-formed, no diagnostic required), so enabling this surfaces a real
class of bugs and keeps the pattern from reappearing.

### Depends on

The in-tree occurrences were cleaned up first in a series of NFC PRs
tracked by #202945. This change only builds clean once those land, so CI
will be red on any area whose cleanup is not yet merged. Remaining
prerequisites:

Approved
- #202969
- #202971
- #202973
- #202974
- #206309
- #206312

Needs to be reviewed 
- #202988
- #206308

Closes #202945

cc @AaronBallman @vgvassilev
@flash1729
flash1729 deleted the wunused-template-jitlink-orc branch August 7, 2026 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants