[llvm-commits] [llvm] r45775 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Owen Anderson resistor at mac.com
Wed Jan 9 02:41:41 PST 2008


Author: resistor
Date: Wed Jan  9 04:41:39 2008
New Revision: 45775

URL: http://llvm.org/viewvc/llvm-project?rev=45775&view=rev
Log:
StrongPHIElim: Now with even fewer trivial bugs!

Modified:
    llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=45775&r1=45774&r2=45775&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Jan  9 04:41:39 2008
@@ -215,7 +215,9 @@
       stack.pop_back();
       CurrentParent = stack.back();
       
-      parentBlock = LV.getVarInfo(CurrentParent->getReg()).DefInst->getParent();
+      parentBlock = CurrentParent->getReg() ?
+                   LV.getVarInfo(CurrentParent->getReg()).DefInst->getParent() :
+                   0;
     }
     
     DomForestNode* child = new DomForestNode(*I, CurrentParent);
@@ -361,7 +363,7 @@
   std::set<unsigned> ProcessedNames;
   
   MachineBasicBlock::iterator P = MBB->begin();
-  while (P->getOpcode() == TargetInstrInfo::PHI) {
+  while (P != MBB->end() && P->getOpcode() == TargetInstrInfo::PHI) {
     LiveVariables::VarInfo& PHIInfo = LV.getVarInfo(P->getOperand(0).getReg());
 
     unsigned DestReg = P->getOperand(0).getReg();





More information about the llvm-commits mailing list