From: Chris Lattner Date: Sun, 29 Feb 2004 22:01:51 +0000 (+0000) Subject: Add an assert X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=92bc3bc11c2d439264b1cf9e7fc5bc79f4215a54;p=oota-llvm.git Add an assert git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12010 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp index 35c64e25484..10c215885f7 100644 --- a/lib/CodeGen/LiveVariables.cpp +++ b/lib/CodeGen/LiveVariables.cpp @@ -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... } } + } } }