Add an assert
authorChris Lattner <sabre@nondot.org>
Sun, 29 Feb 2004 22:01:51 +0000 (22:01 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 29 Feb 2004 22:01:51 +0000 (22:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12010 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveVariables.cpp

index 35c64e25484fcfb30b8527a6fd09ccda454fddbf..10c215885f7acb918fdbb22a1b221eb6a3255031 100644 (file)
@@ -277,7 +277,9 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
       // 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 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &MF) {
              break;   // Found the PHI entry for this block...
            }
          }
+        }
       }
     }