[llvm-commits] CVS: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Oct 5 00:35:02 PDT 2003


Changes in directory llvm/lib/Transforms/Utils:

PromoteMemoryToRegister.cpp updated: 1.50 -> 1.51

---
Log message:

The first PHI node may be null, scan for the first non-null one


---
Diffs of the changes:

Index: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
diff -u llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.50 llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.51
--- llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:1.50	Sat Oct  4 23:33:22 2003
+++ llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp	Sun Oct  5 00:34:39 2003
@@ -158,7 +158,10 @@
     // Only do work here if there the PHI nodes are missing incoming values.  We
     // know that all PHI nodes that were inserted in a block will have the same
     // number of incoming values, so we can just check any PHI node.
-    PHINode *FirstPHI = PNs[0];
+    PHINode *FirstPHI;
+    for (unsigned i = 0; (FirstPHI = PNs[i]) == 0; ++i)
+      /*empty*/;
+
     if (Preds.size() != FirstPHI->getNumIncomingValues()) {
       // Ok, now we know that all of the PHI nodes are missing entries for some
       // basic blocks.  Start by sorting the incoming predecessors for efficient





More information about the llvm-commits mailing list