<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Dec 9, 2016 at 10:34 PM, Chandler Carruth via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Modified: llvm/trunk/include/llvm/<wbr>Analysis/CGSCCPassManager.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CGSCCPassManager.h?rev=289317&r1=289316&r2=289317&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/Analysis/<wbr>CGSCCPassManager.h?rev=289317&<wbr>r1=289316&r2=289317&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/<wbr>Analysis/CGSCCPassManager.h (original)<br>
+++ llvm/trunk/include/llvm/<wbr>Analysis/CGSCCPassManager.h Sat Dec 10 00:34:44 2016<br>
@@ -145,13 +145,51 @@ struct RequireAnalysisPass<AnalysisT, La<br>
   }<br>
 };<br>
<br>
-extern template class InnerAnalysisManagerProxy<<wbr>CGSCCAnalysisManager, Module>;<br>
 /// A proxy from a \c CGSCCAnalysisManager to a \c Module.<br>
 typedef InnerAnalysisManagerProxy<<wbr>CGSCCAnalysisManager, Module><br>
     CGSCCAnalysisManagerModuleProx<wbr>y;<br>
<br>
-extern template class OuterAnalysisManagerProxy<<wbr>ModuleAnalysisManager,<br>
-                                                LazyCallGraph::SCC>;<br>
+/// We need a specialized result for the \c CGSCCAnalysisManagerModuleProx<wbr>y so<br>
+/// it can have access to the call graph in order to walk all the SCCs when<br>
+/// invalidating things.<br>
+template <> class CGSCCAnalysisManagerModuleProx<wbr>y::Result {<br>
+public:<br>
+  explicit Result(CGSCCAnalysisManager &InnerAM, LazyCallGraph &G)<br>
+      : InnerAM(&InnerAM), G(&G) {}<br>
+<br>
+  /// \brief Accessor for the analysis manager.<br>
+  CGSCCAnalysisManager &getManager() { return *InnerAM; }<br>
+<br>
+  /// \brief Handler for invalidation of the Module.<br>
+  ///<br>
+  /// If the proxy analysis itself is preserved, then we assume that the set of<br>
+  /// SCCs in the Module hasn't changed. Thus any pointers to SCCs in the<br>
+  /// CGSCCAnalysisManager are still valid, and we don't need to call \c clear<br>
+  /// on the CGSCCAnalysisManager.<br>
+  ///<br>
+  /// Regardless of whether this analysis is marked as preserved, all of the<br>
+  /// analyses in the \c CGSCCAnalysisManager are potentially invalidated based<br>
+  /// on the set of preserved analyses.<br>
+  bool invalidate(Module &M, const PreservedAnalyses &PA,<br>
+                  ModuleAnalysisManager::<wbr>Invalidator &Inv);<br>
+<br>
+private:<br>
+  CGSCCAnalysisManager *InnerAM;<br>
+  LazyCallGraph *G;<br>
+};<br>
+<br>
+/// Provide a specialized run method for the \c CGSCCAnalysisManagerModuleProx<wbr>y<br>
+/// so it can pass the lazy call graph to the result.<br>
+template <><br>
+<wbr>CGSCCAnalysisManagerModuleProx<wbr>y::Result<br>
+<wbr>CGSCCAnalysisManagerModuleProx<wbr>y::run(Module &M, ModuleAnalysisManager &AM);<br>
+<br>
+// Ensure the \c CGSCCAnalysisManagerModuleProx<wbr>y is provided as an extern<br>
+// template.<br>
+extern template class InnerAnalysisManagerProxy<<wbr>CGSCCAnalysisManager, Module>;<br>
+<br>
+extern template class OuterAnalysisManagerProxy<<br>
+    ModuleAnalysisManager, LazyCallGraph::SCC, LazyCallGraph &>;<br></blockquote><div><br></div><div>This introduced an MSVC warning which I think is pretty reasonable:</div><div>[402/3123] Building CXX object lib\Analysis\CMakeFiles\LLVMAnalysis.dir\CGSCCPassManager.cpp.obj</div><div>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</div><div>        with</div><div>        [</div><div>            IRUnitT=llvm::LazyCallGraph::SCC</div><div>        ]</div><div>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'</div><div>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</div><div>        with</div><div>        [</div><div>            IRUnitT=llvm::LazyCallGraph::SCC</div><div>        ]</div><div>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'</div><div>[403/3123] Building CXX object lib\Transforms\Vectorize\CMakeFiles\LLVMVectorize.dir\BBVectorize.cpp.obj </div><div><br></div><div>I think it's complaining that 'invalidate' is a declaration, and you never provide a definition for it, only a specialization of it later.</div></div></div></div>