[PATCH] D141865: [llvm][GenericUniformity] Hack around strict is_invocable() checks
Krzysztof Drewniak via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 18 10:33:40 PST 2023
krzysz00 updated this revision to Diff 490226.
krzysz00 added a comment.
Herald added a subscriber: hiraditya.
Pull the deleter out of nesting in the hopes that thas + some forward declarations will fix the linker errors
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141865/new/
https://reviews.llvm.org/D141865
Files:
llvm/include/llvm/ADT/GenericUniformityImpl.h
llvm/include/llvm/ADT/GenericUniformityInfo.h
llvm/lib/Analysis/UniformityAnalysis.cpp
llvm/lib/CodeGen/MachineUniformityAnalysis.cpp
Index: llvm/lib/CodeGen/MachineUniformityAnalysis.cpp
===================================================================
--- llvm/lib/CodeGen/MachineUniformityAnalysis.cpp
+++ llvm/lib/CodeGen/MachineUniformityAnalysis.cpp
@@ -113,6 +113,8 @@
// This ensures explicit instantiation of
// GenericUniformityAnalysisImpl::ImplDeleter::operator()
template class llvm::GenericUniformityInfo<MachineSSAContext>;
+template struct llvm::GenericUniformityAnalysisImplDeleter<
+ llvm::GenericUniformityAnalysisImpl<MachineSSAContext>>;
MachineUniformityInfo
llvm::computeMachineUniformityInfo(MachineFunction &F,
Index: llvm/lib/Analysis/UniformityAnalysis.cpp
===================================================================
--- llvm/lib/Analysis/UniformityAnalysis.cpp
+++ llvm/lib/Analysis/UniformityAnalysis.cpp
@@ -87,6 +87,8 @@
// This ensures explicit instantiation of
// GenericUniformityAnalysisImpl::ImplDeleter::operator()
template class llvm::GenericUniformityInfo<SSAContext>;
+template struct llvm::GenericUniformityAnalysisImplDeleter<
+ llvm::GenericUniformityAnalysisImpl<SSAContext>>;
//===----------------------------------------------------------------------===//
// UniformityInfoAnalysis and related pass implementations
Index: llvm/include/llvm/ADT/GenericUniformityInfo.h
===================================================================
--- llvm/include/llvm/ADT/GenericUniformityInfo.h
+++ llvm/include/llvm/ADT/GenericUniformityInfo.h
@@ -24,6 +24,14 @@
class TargetTransformInfo;
template <typename ContextT> class GenericUniformityAnalysisImpl;
+template <typename ImplT> 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 <typename ContextT> class GenericUniformityInfo {
public:
@@ -63,12 +71,9 @@
private:
using ImplT = GenericUniformityAnalysisImpl<ContextT>;
- struct ImplDeleter {
- void operator()(GenericUniformityAnalysisImpl<ContextT> *Impl);
- };
FunctionT *F;
- std::unique_ptr<ImplT, ImplDeleter> DA;
+ std::unique_ptr<ImplT, GenericUniformityAnalysisImplDeleter<ImplT>> DA;
GenericUniformityInfo(const GenericUniformityInfo &) = delete;
GenericUniformityInfo &operator=(const GenericUniformityInfo &) = delete;
Index: llvm/include/llvm/ADT/GenericUniformityImpl.h
===================================================================
--- llvm/include/llvm/ADT/GenericUniformityImpl.h
+++ llvm/include/llvm/ADT/GenericUniformityImpl.h
@@ -467,9 +467,8 @@
ConstValueRefT Val) const;
};
-template <typename ContextT>
-void GenericUniformityInfo<ContextT>::ImplDeleter::operator()(
- GenericUniformityAnalysisImpl<ContextT> *Impl) {
+template <typename ImplT>
+void GenericUniformityAnalysisImplDeleter<ImplT>::operator()(ImplT *Impl) {
delete Impl;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141865.490226.patch
Type: text/x-patch
Size: 3130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230118/ea0292d3/attachment.bin>
More information about the llvm-commits
mailing list