summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
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
commitb7b75e1b68fb51bef72573a253eb4bba69cf1d9b (patch)
treecd72fbf38c35cc5957ee109baece55c9e1d3853e /llvm/lib/CodeGen
parentd4c0ed74e4f3d94e93fde23ccc1ce1b74d60f61f (diff)
downloadbcm5719-llvm-b7b75e1b68fb51bef72573a253eb4bba69cf1d9b.tar.gz
bcm5719-llvm-b7b75e1b68fb51bef72573a253eb4bba69cf1d9b.zip
Fix a conditional so we don't access past the end of the range. Thanks to
Andrew for bringing this to my attn. llvm-svn: 23850
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/LiveInterval.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp
index 50d8a259367..a7f1eb357ee 100644
--- a/llvm/lib/CodeGen/LiveInterval.cpp
+++ b/llvm/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);
}
}
OpenPOWER on IntegriCloud