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
This commit is contained in:
Chris Lattner 2005-10-20 22:50:10 +00:00
parent 964b6aacb4
commit cef6010c64

View File

@ -218,14 +218,12 @@ 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) {
if (Next != ranges.end() && Next->start == I->end && Next->ValId == ValId) {
I->end = Next->end;
ranges.erase(Next);
}
}
}
/// extendIntervalStartTo - This method is used when we want to extend the range