[llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon May 12 09:27:00 PDT 2003


Changes in directory llvm/lib/CodeGen:

PHIElimination.cpp updated: 1.5 -> 1.6

---
Log message:

Fix bug where we could iterate off the end of a basic block


---
Diffs of the changes:

Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.5 llvm/lib/CodeGen/PHIElimination.cpp:1.6
--- llvm/lib/CodeGen/PHIElimination.cpp:1.5	Sun May 11 23:08:54 2003
+++ llvm/lib/CodeGen/PHIElimination.cpp	Mon May 12 09:26:38 2003
@@ -76,8 +76,9 @@
     // into the phi node destination.
     //
     MachineBasicBlock::iterator AfterPHIsIt = MBB.begin();
-    if (AfterPHIsIt != MBB.end())
-      while ((*AfterPHIsIt)->getOpcode() == TargetInstrInfo::PHI) ++AfterPHIsIt;
+    while (AfterPHIsIt != MBB.end() &&
+           (*AfterPHIsIt)->getOpcode() == TargetInstrInfo::PHI)
+      ++AfterPHIsIt;    // Skip over all of the PHI nodes...
     RegInfo->copyRegToReg(MBB, AfterPHIsIt, DestReg, IncomingReg, RC);
     
     // Update live variable information if there is any...





More information about the llvm-commits mailing list