aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-01-09 10:41:39 +0000
committerOwen Anderson <resistor@mac.com>2008-01-09 10:41:39 +0000
commit864e3a3762b2155b21c09273128dd2565df00d71 (patch)
tree2c667355b1db3c19d5bcf05dc8a362bd6fed1f26
parent719fef648d8ed584fdd2b3e7c967cf0fe8c7925b (diff)
downloadexternal_llvm-864e3a3762b2155b21c09273128dd2565df00d71.zip
external_llvm-864e3a3762b2155b21c09273128dd2565df00d71.tar.gz
external_llvm-864e3a3762b2155b21c09273128dd2565df00d71.tar.bz2
StrongPHIElim: Now with even fewer trivial bugs!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45775 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/StrongPHIElimination.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp
index aa25dfe..efe8381 100644
--- a/lib/CodeGen/StrongPHIElimination.cpp
+++ b/lib/CodeGen/StrongPHIElimination.cpp
@@ -215,7 +215,9 @@ StrongPHIElimination::computeDomForest(std::set<unsigned>& regs) {
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 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
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();