[llvm] r289317 - [PM] Support invalidation of inner analysis managers from a pass over the outer IR unit.
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 13:11:57 PST 2016
On Fri, Dec 9, 2016 at 10:34 PM, Chandler Carruth via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Modified: llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/
> CGSCCPassManager.h?rev=289317&r1=289316&r2=289317&view=diff
> ============================================================
> ==================
> --- llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h (original)
> +++ llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h Sat Dec 10
> 00:34:44 2016
> @@ -145,13 +145,51 @@ struct RequireAnalysisPass<AnalysisT, La
> }
> };
>
> -extern template class InnerAnalysisManagerProxy<CGSCCAnalysisManager,
> Module>;
> /// A proxy from a \c CGSCCAnalysisManager to a \c Module.
> typedef InnerAnalysisManagerProxy<CGSCCAnalysisManager, Module>
> CGSCCAnalysisManagerModuleProxy;
>
> -extern template class OuterAnalysisManagerProxy<ModuleAnalysisManager,
> - LazyCallGraph::SCC>;
> +/// We need a specialized result for the \c CGSCCAnalysisManagerModuleProxy
> so
> +/// it can have access to the call graph in order to walk all the SCCs
> when
> +/// invalidating things.
> +template <> class CGSCCAnalysisManagerModuleProxy::Result {
> +public:
> + explicit Result(CGSCCAnalysisManager &InnerAM, LazyCallGraph &G)
> + : InnerAM(&InnerAM), G(&G) {}
> +
> + /// \brief Accessor for the analysis manager.
> + CGSCCAnalysisManager &getManager() { return *InnerAM; }
> +
> + /// \brief Handler for invalidation of the Module.
> + ///
> + /// If the proxy analysis itself is preserved, then we assume that the
> set of
> + /// SCCs in the Module hasn't changed. Thus any pointers to SCCs in the
> + /// CGSCCAnalysisManager are still valid, and we don't need to call \c
> clear
> + /// on the CGSCCAnalysisManager.
> + ///
> + /// Regardless of whether this analysis is marked as preserved, all of
> the
> + /// analyses in the \c CGSCCAnalysisManager are potentially invalidated
> based
> + /// on the set of preserved analyses.
> + bool invalidate(Module &M, const PreservedAnalyses &PA,
> + ModuleAnalysisManager::Invalidator &Inv);
> +
> +private:
> + CGSCCAnalysisManager *InnerAM;
> + LazyCallGraph *G;
> +};
> +
> +/// Provide a specialized run method for the \c
> CGSCCAnalysisManagerModuleProxy
> +/// so it can pass the lazy call graph to the result.
> +template <>
> +CGSCCAnalysisManagerModuleProxy::Result
> +CGSCCAnalysisManagerModuleProxy::run(Module &M, ModuleAnalysisManager
> &AM);
> +
> +// Ensure the \c CGSCCAnalysisManagerModuleProxy is provided as an extern
> +// template.
> +extern template class InnerAnalysisManagerProxy<CGSCCAnalysisManager,
> Module>;
> +
> +extern template class OuterAnalysisManagerProxy<
> + ModuleAnalysisManager, LazyCallGraph::SCC, LazyCallGraph &>;
>
This introduced an MSVC warning which I think is pretty reasonable:
[402/3123] Building CXX object
lib\Analysis\CMakeFiles\LLVMAnalysis.dir\CGSCCPassManager.cpp.obj
C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\include\llvm/IR/PassManager.h(803):
warning C4661: 'bool
llvm::InnerAnalysisManagerProxy<llvm::FunctionAnalysisManager,llvm::LazyCallGraph::SCC,llvm::LazyCallGraph
&>::Result::invalidate(IRUnitT &,const llvm::PreservedAnalyses
&,llvm::AnalysisManager<IRUnitT,llvm::LazyCallGraph &>::Invalidator &)': no
suitable definition provided for explicit template instantiation request
with
[
IRUnitT=llvm::LazyCallGraph::SCC
]
C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\include\llvm/IR/PassManager.h(798):
note: see declaration of
'llvm::InnerAnalysisManagerProxy<llvm::FunctionAnalysisManager,llvm::LazyCallGraph::SCC,llvm::LazyCallGraph
&>::Result::invalidate'
C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\include\llvm/Analysis/CGSCCPassManager.h(486):
warning C4661: 'bool
llvm::InnerAnalysisManagerProxy<llvm::FunctionAnalysisManager,llvm::LazyCallGraph::SCC,llvm::LazyCallGraph
&>::Result::invalidate(IRUnitT &,const llvm::PreservedAnalyses
&,llvm::AnalysisManager<IRUnitT,llvm::LazyCallGraph &>::Invalidator &)': no
suitable definition provided for explicit template instantiation request
with
[
IRUnitT=llvm::LazyCallGraph::SCC
]
C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\llvm\include\llvm/IR/PassManager.h(798):
note: see declaration of
'llvm::InnerAnalysisManagerProxy<llvm::FunctionAnalysisManager,llvm::LazyCallGraph::SCC,llvm::LazyCallGraph
&>::Result::invalidate'
[403/3123] Building CXX object
lib\Transforms\Vectorize\CMakeFiles\LLVMVectorize.dir\BBVectorize.cpp.obj
I think it's complaining that 'invalidate' is a declaration, and you never
provide a definition for it, only a specialization of it later.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/f75eaf7f/attachment.html>
More information about the llvm-commits
mailing list