1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

StrongPHIElim: Now with even fewer trivial bugs!

llvm-svn: 45775
This commit is contained in:
Owen Anderson 2008-01-09 10:41:39 +00:00
parent c937ae34a5
commit 9555739636

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();