Fix PR#50
authorChris Lattner <sabre@nondot.org>
Sat, 18 Oct 2003 06:14:59 +0000 (06:14 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 18 Oct 2003 06:14:59 +0000 (06:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9227 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/PromoteMemoryToRegister.cpp

index 1692745efeffd0966f786b301ef44e90abb82e12..0292f9e7705103f286848e12e3c0511953218c97 100644 (file)
@@ -269,12 +269,12 @@ void PromoteMem2Reg::run() {
 
       // At this point, the blocks left in the preds list must have dummy
       // entries inserted into every PHI nodes for the block.
-      for (unsigned i = 0, e = PNs.size(); i != e; ++i) {
-        PHINode *PN = PNs[i];
-        Value *NullVal = Constant::getNullValue(PN->getType());
-        for (unsigned pred = 0, e = Preds.size(); pred != e; ++pred)
-          PN->addIncoming(NullVal, Preds[pred]);
-      }
+      for (unsigned i = 0, e = PNs.size(); i != e; ++i)
+        if (PHINode *PN = PNs[i]) {
+          Value *NullVal = Constant::getNullValue(PN->getType());
+          for (unsigned pred = 0, e = Preds.size(); pred != e; ++pred)
+            PN->addIncoming(NullVal, Preds[pred]);
+        }
     }
   }
 }