Don't dereference MBB->end().
authorOwen Anderson <resistor@mac.com>
Tue, 1 Apr 2008 18:05:08 +0000 (18:05 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 1 Apr 2008 18:05:08 +0000 (18:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49043 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/StrongPHIElimination.cpp

index 0c785367168c270f338656c9b69607749cd4ec9e..f89d9f2f2e88abe055efe56bd997e4e2ded57eea 100644 (file)
@@ -408,7 +408,7 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
   
   // Iterate over all the PHI nodes in this block
   MachineBasicBlock::iterator P = MBB->begin();
-  while (P->getOpcode() == TargetInstrInfo::PHI) {
+  while (P != MBB->end() && P->getOpcode() == TargetInstrInfo::PHI) {
     unsigned DestReg = P->getOperand(0).getReg();
 
     // Don't both doing PHI elimination for dead PHI's.