[llvm] [ADT] Use "static inline" to initialize EmptyDivergenceDesc; (NFC) (PR #160445)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 23 22:58:29 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/160445
In C++17, we can initialize a static member variable with "static
inline" as part of the class definition. With this, we can eliminate
the out-of-line static initializer involving boilerplate template
code.
>From d8a6a6f904c324d432b797a36827222075b84226 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 21 Sep 2025 12:32:16 -0700
Subject: [PATCH] [ADT] Use "static inline" to initialize EmptyDivergenceDesc;
(NFC)
In C++17, we can initialize a static member variable with "static
inline" as part of the class definition. With this, we can eliminate
the out-of-line static initializer involving boilerplate template
code.
---
llvm/include/llvm/ADT/GenericUniformityImpl.h | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/llvm/include/llvm/ADT/GenericUniformityImpl.h b/llvm/include/llvm/ADT/GenericUniformityImpl.h
index 3b9b7f2633771..141816c304397 100644
--- a/llvm/include/llvm/ADT/GenericUniformityImpl.h
+++ b/llvm/include/llvm/ADT/GenericUniformityImpl.h
@@ -310,7 +310,7 @@ template <typename ContextT> class GenericSyncDependenceAnalysis {
const DivergenceDescriptor &getJoinBlocks(const BlockT *DivTermBlock);
private:
- static DivergenceDescriptor EmptyDivergenceDesc;
+ static inline DivergenceDescriptor EmptyDivergenceDesc;
ModifiedPO CyclePO;
@@ -741,10 +741,6 @@ template <typename ContextT> class DivergencePropagator {
}
};
-template <typename ContextT>
-typename llvm::GenericSyncDependenceAnalysis<ContextT>::DivergenceDescriptor
- llvm::GenericSyncDependenceAnalysis<ContextT>::EmptyDivergenceDesc;
-
template <typename ContextT>
llvm::GenericSyncDependenceAnalysis<ContextT>::GenericSyncDependenceAnalysis(
const ContextT &Context, const DominatorTreeT &DT, const CycleInfoT &CI)
More information about the llvm-commits
mailing list