aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-01 09:51:42 +0000
committerChris Lattner <sabre@nondot.org>2004-08-01 09:51:42 +0000
commit4ae131e5da124bb5f7455133fefb1fa3b336192b (patch)
treec0583af45ea03597d977d089e1d4a2522aa6feb7 /lib
parent33c23ddf8a170f9576e4b6de840e8ad1e5fcdfd3 (diff)
downloadexternal_llvm-4ae131e5da124bb5f7455133fefb1fa3b336192b.zip
external_llvm-4ae131e5da124bb5f7455133fefb1fa3b336192b.tar.gz
external_llvm-4ae131e5da124bb5f7455133fefb1fa3b336192b.tar.bz2
Dereferencing end() is bad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/BranchFolding.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 0a6bd39..af2b725 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -96,7 +96,7 @@ static void ReplaceUsesOfBlockWith(MachineBasicBlock *BB,
// If BB falls through into Old, insert an unconditional branch to New.
MachineFunction::iterator BBSucc = BB; ++BBSucc;
- if (&*BBSucc == Old)
+ if (BBSucc != BB->getParent()->end() && &*BBSucc == Old)
TII.insertGoto(*BB, *New);
std::vector<MachineBasicBlock*> Succs(BB->succ_begin(), BB->succ_end());