[PM] Invalidate CallGraphAnalysis because it holds AssertingVH
authorSean Silva <chisophugis@gmail.com>
Mon, 8 Aug 2016 05:38:01 +0000 (05:38 +0000)
committerSean Silva <chisophugis@gmail.com>
Mon, 8 Aug 2016 05:38:01 +0000 (05:38 +0000)
This is essentially PR28400. The fix here is similar to that implemented
in r274656.

llvm-svn: 277980

llvm/lib/Transforms/IPO/FunctionAttrs.cpp

index a68e8d8..e4b86e9 100644 (file)
@@ -1271,6 +1271,11 @@ ReversePostOrderFunctionAttrsPass::run(Module &M, AnalysisManager<Module> &AM) {
   auto &CG = AM.getResult<CallGraphAnalysis>(M);
 
   bool Changed = deduceFunctionAttributeInRPO(M, CG);
+
+  // CallGraphAnalysis holds AssertingVH and must be invalidated eagerly so
+  // that other passes don't delete stuff from under it.
+  AM.invalidate<CallGraphAnalysis>(M);
+
   if (!Changed)
     return PreservedAnalyses::all();
   PreservedAnalyses PA;