summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-10-20 22:50:10 +0000
committerChris Lattner <sabre@nondot.org>2005-10-20 22:50:10 +0000
commitcef6010c64bc56fa2a8f1e7e9e28b8821adeceac (patch)
treedbdbd47dd30e996c66cf5e7b7dc937c02f0479d0 /lib/CodeGen/LiveInterval.cpp
parent964b6aacb465f6d95de09d64e40623ae4c57e07e (diff)
downloadllvm-cef6010c64bc56fa2a8f1e7e9e28b8821adeceac.tar.gz
llvm-cef6010c64bc56fa2a8f1e7e9e28b8821adeceac.tar.bz2
llvm-cef6010c64bc56fa2a8f1e7e9e28b8821adeceac.tar.xz
Fix a conditional so we don't access past the end of the range. Thanks to
Andrew for bringing this to my attn. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23850 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r--lib/CodeGen/LiveInterval.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp
index 50d8a25936..a7f1eb357e 100644
--- a/lib/CodeGen/LiveInterval.cpp
+++ b/lib/CodeGen/LiveInterval.cpp
@@ -218,12 +218,10 @@ void LiveInterval::extendIntervalEndTo(Ranges::iterator I, unsigned NewEnd) {
// If the newly formed range now touches the range after it and if they have
// the same value number, merge the two ranges into one range.
- if (I != ranges.end()) {
- Ranges::iterator Next = next(I);
- if (Next->start == I->end && Next->ValId == ValId) {
- I->end = Next->end;
- ranges.erase(Next);
- }
+ Ranges::iterator Next = next(I);
+ if (Next != ranges.end() && Next->start == I->end && Next->ValId == ValId) {
+ I->end = Next->end;
+ ranges.erase(Next);
}
}