Handle functions with multiple exit blocks properly.
authorOwen Anderson <resistor@mac.com>
Mon, 11 Jun 2007 16:25:17 +0000 (16:25 +0000)
committerOwen Anderson <resistor@mac.com>
Mon, 11 Jun 2007 16:25:17 +0000 (16:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37539 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVNPRE.cpp

index 6a36ea3d0104f3c070129b7a79ed8d4e0a7b3f1a..c43603e6ddc65d6bdf50cec66347a75a5626a3c6 100644 (file)
@@ -526,6 +526,9 @@ bool GVNPRE::runOnFunction(Function &F) {
          df_begin(PDT.getRootNode()), E = df_end(PDT.getRootNode());
          PDI != E; ++PDI) {
       BasicBlock* BB = PDI->getBlock();
+      if (BB == 0)
+        continue;
+      
       DOUT << "Block: " << BB->getName() << "\n";
       DOUT << "TMP_GEN: ";
       dump(generatedTemporaries[BB]);
@@ -635,6 +638,9 @@ bool GVNPRE::runOnFunction(Function &F) {
          E = df_end(DT.getRootNode()); DI != E; ++DI) {
       BasicBlock* BB = DI->getBlock();
       
+      if (BB == 0)
+        continue;
+      
       std::set<Value*, ExprLT>& new_set = new_sets[BB];
       std::set<Value*, ExprLT>& availOut = availableOut[BB];
       std::set<Value*, ExprLT>& anticIn = anticipatedIn[BB];