Skip to content

Conversation

kazutakahirata
Copy link
Contributor

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.

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.
@llvmbot
Copy link
Member

llvmbot commented Sep 24, 2025

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/160445.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/GenericUniformityImpl.h (+1-5)
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)

@kazutakahirata kazutakahirata merged commit 21ce61b into llvm:main Sep 24, 2025
11 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250923_ADT_GenericUniformityImpl branch September 24, 2025 15:44
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
…lvm#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants