Revert "[FastIsel][X86] Add support for lowering the first 8 floating-point arguments."
[oota-llvm.git] / lib / IR / PassManager.cpp
index 88464e0ef0e5a30d7ad20529d54a43c57549eabc..0defb6ab3e42c1bb22efc5ffc84f13494dae7d82 100644 (file)
@@ -1,4 +1,4 @@
-//===- PassManager.h - Infrastructure for managing & running IR passes ----===//
+//===- PassManager.cpp - Infrastructure for managing & running IR passes --===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
@@ -32,6 +33,8 @@ PreservedAnalyses ModulePassManager::run(Module *M, ModuleAnalysisManager *AM) {
     if (AM)
       AM->invalidate(M, PassPA);
     PA.intersect(std::move(PassPA));
+
+    M->getContext().yield();
   }
 
   if (DebugPM)
@@ -59,7 +62,7 @@ ModuleAnalysisManager::ResultConceptT *
 ModuleAnalysisManager::getCachedResultImpl(void *PassID, Module *M) const {
   ModuleAnalysisResultMapT::const_iterator RI =
       ModuleAnalysisResults.find(PassID);
-  return RI == ModuleAnalysisResults.end() ? 0 : &*RI->second;
+  return RI == ModuleAnalysisResults.end() ? nullptr : &*RI->second;
 }
 
 void ModuleAnalysisManager::invalidateImpl(void *PassID, Module *M) {
@@ -92,6 +95,8 @@ PreservedAnalyses FunctionPassManager::run(Function *F,
     if (AM)
       AM->invalidate(F, PassPA);
     PA.intersect(std::move(PassPA));
+
+    F->getContext().yield();
   }
 
   if (DebugPM)
@@ -135,7 +140,7 @@ FunctionAnalysisManager::ResultConceptT *
 FunctionAnalysisManager::getCachedResultImpl(void *PassID, Function *F) const {
   FunctionAnalysisResultMapT::const_iterator RI =
       FunctionAnalysisResults.find(std::make_pair(PassID, F));
-  return RI == FunctionAnalysisResults.end() ? 0 : &*RI->second->second;
+  return RI == FunctionAnalysisResults.end() ? nullptr : &*RI->second->second;
 }
 
 void FunctionAnalysisManager::invalidateImpl(void *PassID, Function *F) {
@@ -165,20 +170,22 @@ void FunctionAnalysisManager::invalidateImpl(Function *F,
   while (!InvalidatedPassIDs.empty())
     FunctionAnalysisResults.erase(
         std::make_pair(InvalidatedPassIDs.pop_back_val(), F));
+  if (ResultsList.empty())
+    FunctionAnalysisResultLists.erase(F);
 }
 
 char FunctionAnalysisManagerModuleProxy::PassID;
 
 FunctionAnalysisManagerModuleProxy::Result
 FunctionAnalysisManagerModuleProxy::run(Module *M) {
-  assert(FAM.empty() && "Function analyses ran prior to the module proxy!");
-  return Result(FAM);
+  assert(FAM->empty() && "Function analyses ran prior to the module proxy!");
+  return Result(*FAM);
 }
 
 FunctionAnalysisManagerModuleProxy::Result::~Result() {
   // Clear out the analysis manager if we're being destroyed -- it means we
   // didn't even see an invalidate call when we got invalidated.
-  FAM.clear();
+  FAM->clear();
 }
 
 bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
@@ -188,7 +195,7 @@ bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
   // objects in the cache making it impossible to incrementally preserve them.
   // Just clear the entire manager.
   if (!PA.preserved(ID()))
-    FAM.clear();
+    FAM->clear();
 
   // Return false to indicate that this result is still a valid proxy.
   return false;