aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
commita13f0d3f4159b1f54bcfc733ccd94977b020ea56 (patch)
tree43dd8cb451b3079fdf66a620f8f02d9ae9c25759 /lib
parentfb2cb69dc55c1e1d7754186cd1c8a9d543f54bdd (diff)
downloadexternal_llvm-a13f0d3f4159b1f54bcfc733ccd94977b020ea56.zip
external_llvm-a13f0d3f4159b1f54bcfc733ccd94977b020ea56.tar.gz
external_llvm-a13f0d3f4159b1f54bcfc733ccd94977b020ea56.tar.bz2
Fix bug where we could iterate off the end of a basic block
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6116 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/PHIElimination.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp
index 3353725..e7f4c9f 100644
--- a/lib/CodeGen/PHIElimination.cpp
+++ b/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...