Move ownership of GCStrategy objects to LLVMContext
[oota-llvm.git] / lib / Analysis / RegionPass.cpp
index 4986fab5ff6b5bb26f4937858f1fe6865b5e41da..6fa7b2e0e30cccb8946afd8455b0700814d405ea 100644 (file)
 //===----------------------------------------------------------------------===//
 #include "llvm/Analysis/RegionPass.h"
 #include "llvm/Analysis/RegionIterator.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Timer.h"
+using namespace llvm;
 
 #define DEBUG_TYPE "regionpassmgr"
-#include "llvm/Support/Debug.h"
-using namespace llvm;
 
 //===----------------------------------------------------------------------===//
 // RGPassManager
@@ -44,14 +44,14 @@ static void addRegionIntoQueue(Region &R, std::deque<Region *> &RQ) {
 
 /// Pass Manager itself does not invalidate any analysis info.
 void RGPassManager::getAnalysisUsage(AnalysisUsage &Info) const {
-  Info.addRequired<RegionInfo>();
+  Info.addRequired<RegionInfoPass>();
   Info.setPreservesAll();
 }
 
 /// run - Execute all of the passes scheduled for execution.  Keep track of
 /// whether any of the passes modifies the function, and if so, return true.
 bool RGPassManager::runOnFunction(Function &F) {
-  RI = &getAnalysis<RegionInfo>();
+  RI = &getAnalysis<RegionInfoPass>().getRegionInfo();
   bool Changed = false;
 
   // Collect inherited analysis from Module level pass manager.
@@ -194,8 +194,12 @@ public:
 
   bool runOnRegion(Region *R, RGPassManager &RGM) override {
     Out << Banner;
-    for (const auto &BB : R->blocks())
-      BB->print(Out);
+    for (const auto &BB : R->blocks()) {
+      if (BB)
+        BB->print(Out);
+      else
+        Out << "Printing <null> Block";
+    }
 
     return false;
   }