[llvm] [VPlan] Remove internal linkage from findUserOf templates (NFC) (PR #202974)
Aditya Medhane via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 06:50:53 PDT 2026
https://github.com/flash1729 created https://github.com/llvm/llvm-project/pull/202974
The `findUserOf` function templates are `static` in a header, so every translation unit that includes it gets its own internal-linkage copy. That's a latent ODR hazard, and it trips `-Wunused-template` in TUs that don't instantiate them. Dropping `static` gives them external linkage (templates are implicitly inline, so nothing else changes).
NFC: linkage-only change.
Part of #202945.
>From f3459915129a056754dd5ab6a3fb4842f8a4f24a Mon Sep 17 00:00:00 2001
From: flash1729 <sherlockedaditya at gmail.com>
Date: Wed, 10 Jun 2026 19:19:54 +0530
Subject: [PATCH] [VPlan] Remove internal linkage from findUserOf templates
(NFC)
The `findUserOf` function templates are `static` in a header, so every
translation unit that includes it gets its own internal-linkage copy. That's a
latent ODR hazard, and it trips `-Wunused-template` in TUs that don't
instantiate them. Dropping `static` gives them external linkage (templates are
implicitly inline, so nothing else changes).
NFC: linkage-only change.
Part of #202945.
---
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
index 50a3e8abde71a..902aea0f33a08 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
@@ -1112,18 +1112,18 @@ inline auto m_VPPhi(const Op0_t &Op0, const Op1_t &Op1) {
/// If \p V is used by a recipe matching pattern \p P, return it. Otherwise
/// return nullptr;
template <typename MatchT>
-static VPRecipeBase *findUserOf(VPValue *V, const MatchT &P) {
+VPRecipeBase *findUserOf(VPValue *V, const MatchT &P) {
auto It = find_if(V->users(), match_fn(P));
return It == V->user_end() ? nullptr : cast<VPRecipeBase>(*It);
}
/// If \p V is used by a VPInstruction with \p Opcode, return it. Otherwise
/// return nullptr.
-template <unsigned Opcode> static VPInstruction *findUserOf(VPValue *V) {
+template <unsigned Opcode> VPInstruction *findUserOf(VPValue *V) {
return cast_or_null<VPInstruction>(findUserOf(V, m_VPInstruction<Opcode>()));
}
-template <typename RecipeTy> static RecipeTy *findUserOf(VPValue *V) {
+template <typename RecipeTy> RecipeTy *findUserOf(VPValue *V) {
return cast_or_null<RecipeTy>(findUserOf(V, m_Isa<RecipeTy>()));
}
} // namespace llvm::VPlanPatternMatch
More information about the llvm-commits
mailing list