Skip to content

Commit 3b5daef

Browse files
committed
[Pass] Provide inlined AnalysisKey in AnalysisInfoMixin
1 parent fcb6b13 commit 3b5daef

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

llvm/include/llvm/IR/PassManager.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,14 @@ struct AnalysisInfoMixin : PassInfoMixin<DerivedT> {
9595
/// This ID is a pointer type that is guaranteed to be 8-byte aligned and thus
9696
/// suitable for use in sets, maps, and other data structures that use the low
9797
/// bits of pointers.
98-
///
99-
/// Note that this requires the derived type provide a static \c AnalysisKey
100-
/// member called \c Key.
101-
///
102-
/// FIXME: The only reason the mixin type itself can't declare the Key value
103-
/// is that some compilers cannot correctly unique a templated static variable
104-
/// so it has the same addresses in each instantiation. The only currently
105-
/// known platform with this limitation is Windows DLL builds, specifically
106-
/// building each part of LLVM as a DLL. If we ever remove that build
107-
/// configuration, this mixin can provide the static key as well.
10898
static AnalysisKey *ID() {
10999
static_assert(std::is_base_of<AnalysisInfoMixin, DerivedT>::value,
110100
"Must pass the derived type as the template argument!");
111-
return &DerivedT::Key;
101+
return &Key;
112102
}
103+
104+
private:
105+
static inline AnalysisKey Key = {};
113106
};
114107

115108
namespace detail {

0 commit comments

Comments
 (0)