[PM] Don't run the machinery of invalidating all the analysis passes
[oota-llvm.git] / lib / Analysis / CGSCCPassManager.cpp
index 4d569a972fe999ab5e3dc786f033297590c6fd26..ad7eea8efca521e756b4116eb29c3235cd1d7c57 100644 (file)
@@ -92,6 +92,10 @@ void CGSCCAnalysisManager::invalidateImpl(void *PassID, LazyCallGraph::SCC &C) {
 
 void CGSCCAnalysisManager::invalidateImpl(LazyCallGraph::SCC &C,
                                           const PreservedAnalyses &PA) {
+  // Short circuit for a common case of all analyses being preserved.
+  if (PA.areAllPreserved())
+    return;
+
   if (DebugPM)
     dbgs() << "Invalidating all non-preserved analyses for SCC: " << C.getName()
            << "\n";