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

Chris Lattner lattner at cs.uiuc.edu
Sun Feb 29 16:02:01 PST 2004


Changes in directory llvm/lib/CodeGen:

LiveVariables.cpp updated: 1.27 -> 1.28

---
Log message:

Add an assert


---
Diffs of the changes:  (+4 -1)

Index: llvm/lib/CodeGen/LiveVariables.cpp
diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.27 llvm/lib/CodeGen/LiveVariables.cpp:1.28
--- llvm/lib/CodeGen/LiveVariables.cpp:1.27	Thu Feb 26 16:00:20 2004
+++ llvm/lib/CodeGen/LiveVariables.cpp	Sun Feb 29 16:01:51 2004
@@ -277,7 +277,9 @@
       // PHI nodes are guaranteed to be at the top of the block...
       for (MachineBasicBlock::iterator MI = Succ->begin(), ME = Succ->end();
 	   MI != ME && MI->getOpcode() == TargetInstrInfo::PHI; ++MI) {
-	for (unsigned i = 1; ; i += 2)
+	for (unsigned i = 1; ; i += 2) {
+          assert(MI->getNumOperands() > i+1 &&
+                 "Didn't find an entry for our predecessor??");
 	  if (MI->getOperand(i+1).getMachineBasicBlock() == MBB) {
 	    MachineOperand &MO = MI->getOperand(i);
 	    if (!MO.getVRegValueOrNull()) {
@@ -288,6 +290,7 @@
 	      break;   // Found the PHI entry for this block...
 	    }
 	  }
+        }
       }
     }
     





More information about the llvm-commits mailing list