summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/PHIElimination.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-12 14:26:38 +0000
committerChris Lattner <sabre@nondot.org>2003-05-12 14:26:38 +0000
commit2e50ac75a0220a77961a709eadef545f4fea9fcc (patch)
tree6c8606937d22fa0c554e75826009c8a0a950eb14 /llvm/lib/CodeGen/PHIElimination.cpp
parent584bae47337d4c85c611b4496545b636148134d3 (diff)
downloadbcm5719-llvm-2e50ac75a0220a77961a709eadef545f4fea9fcc.tar.gz
bcm5719-llvm-2e50ac75a0220a77961a709eadef545f4fea9fcc.zip
Fix bug where we could iterate off the end of a basic block
llvm-svn: 6116
Diffstat (limited to 'llvm/lib/CodeGen/PHIElimination.cpp')
-rw-r--r--llvm/lib/CodeGen/PHIElimination.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp
index 33537259fb7..e7f4c9f5411 100644
--- a/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/llvm/lib/CodeGen/PHIElimination.cpp
@@ -76,8 +76,9 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) {
// into the phi node destination.
//
MachineBasicBlock::iterator AfterPHIsIt = MBB.begin();
- if (AfterPHIsIt != MBB.end())
- while ((*AfterPHIsIt)->getOpcode() == TargetInstrInfo::PHI) ++AfterPHIsIt;
+ while (AfterPHIsIt != MBB.end() &&
+ (*AfterPHIsIt)->getOpcode() == TargetInstrInfo::PHI)
+ ++AfterPHIsIt; // Skip over all of the PHI nodes...
RegInfo->copyRegToReg(MBB, AfterPHIsIt, DestReg, IncomingReg, RC);
// Update live variable information if there is any...
OpenPOWER on IntegriCloud