diff --git a/llvm/include/llvm/ADT/GenericUniformityImpl.h b/llvm/include/llvm/ADT/GenericUniformityImpl.h --- a/llvm/include/llvm/ADT/GenericUniformityImpl.h +++ b/llvm/include/llvm/ADT/GenericUniformityImpl.h @@ -467,9 +467,8 @@ ConstValueRefT Val) const; }; -template -void GenericUniformityInfo::ImplDeleter::operator()( - GenericUniformityAnalysisImpl *Impl) { +template +void GenericUniformityAnalysisImplDeleter::operator()(ImplT *Impl) { delete Impl; } diff --git a/llvm/include/llvm/ADT/GenericUniformityInfo.h b/llvm/include/llvm/ADT/GenericUniformityInfo.h --- a/llvm/include/llvm/ADT/GenericUniformityInfo.h +++ b/llvm/include/llvm/ADT/GenericUniformityInfo.h @@ -24,6 +24,14 @@ class TargetTransformInfo; template class GenericUniformityAnalysisImpl; +template struct GenericUniformityAnalysisImplDeleter { + // Ugly hack around the fact that recent (> 15.0) clang will run into an + // is_invocable() check in some GNU libc++'s unique_ptr implementation + // and reject this deleter if you just make it callable with an ImplT *, + // whether or not the type of ImplT is spelled out. + using pointer = ImplT *; + void operator()(ImplT *Impl); +}; template class GenericUniformityInfo { public: @@ -63,12 +71,9 @@ private: using ImplT = GenericUniformityAnalysisImpl; - struct ImplDeleter { - void operator()(GenericUniformityAnalysisImpl *Impl); - }; FunctionT *F; - std::unique_ptr DA; + std::unique_ptr> DA; GenericUniformityInfo(const GenericUniformityInfo &) = delete; GenericUniformityInfo &operator=(const GenericUniformityInfo &) = delete; diff --git a/llvm/lib/Analysis/UniformityAnalysis.cpp b/llvm/lib/Analysis/UniformityAnalysis.cpp --- a/llvm/lib/Analysis/UniformityAnalysis.cpp +++ b/llvm/lib/Analysis/UniformityAnalysis.cpp @@ -87,6 +87,8 @@ // This ensures explicit instantiation of // GenericUniformityAnalysisImpl::ImplDeleter::operator() template class llvm::GenericUniformityInfo; +template struct llvm::GenericUniformityAnalysisImplDeleter< + llvm::GenericUniformityAnalysisImpl>; //===----------------------------------------------------------------------===// // UniformityInfoAnalysis and related pass implementations diff --git a/llvm/lib/CodeGen/MachineUniformityAnalysis.cpp b/llvm/lib/CodeGen/MachineUniformityAnalysis.cpp --- a/llvm/lib/CodeGen/MachineUniformityAnalysis.cpp +++ b/llvm/lib/CodeGen/MachineUniformityAnalysis.cpp @@ -113,6 +113,8 @@ // This ensures explicit instantiation of // GenericUniformityAnalysisImpl::ImplDeleter::operator() template class llvm::GenericUniformityInfo; +template struct llvm::GenericUniformityAnalysisImplDeleter< + llvm::GenericUniformityAnalysisImpl>; MachineUniformityInfo llvm::computeMachineUniformityInfo(MachineFunction &F,