StrongPHIElim: Now with even fewer trivial bugs!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45775 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2008-01-09 10:41:39 +00:00
parent 719fef648d
commit 864e3a3762

View File

@ -215,7 +215,9 @@ StrongPHIElimination::computeDomForest(std::set<unsigned>& regs) {
stack.pop_back(); stack.pop_back();
CurrentParent = stack.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); DomForestNode* child = new DomForestNode(*I, CurrentParent);
@ -361,7 +363,7 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
std::set<unsigned> ProcessedNames; std::set<unsigned> ProcessedNames;
MachineBasicBlock::iterator P = MBB->begin(); 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()); LiveVariables::VarInfo& PHIInfo = LV.getVarInfo(P->getOperand(0).getReg());
unsigned DestReg = P->getOperand(0).getReg(); unsigned DestReg = P->getOperand(0).getReg();