summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveInterval.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-07-10 15:41:33 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-07-10 15:41:33 +0000
commit1b8da1d8f14f91b88ff99d3bd5ec4d904cdf21b7 (patch)
tree8afb2489a89358840df1abc2b00a455631923d01 /lib/CodeGen/LiveInterval.cpp
parent2dd83eb1ab3b7d7cdef2e244317caefd78be8a45 (diff)
downloadllvm-1b8da1d8f14f91b88ff99d3bd5ec4d904cdf21b7.tar.gz
llvm-1b8da1d8f14f91b88ff99d3bd5ec4d904cdf21b7.tar.bz2
llvm-1b8da1d8f14f91b88ff99d3bd5ec4d904cdf21b7.tar.xz
Fix a bug where I didn't test for an empty range before inspecting the
back of it. I don't have anything even remotely close to a test case for this. It only broke two build bots, both of them doing bootstrap builds, one of them a dragonegg bootstrap. It doesn't break for me when I bootstrap either. It doesn't reproduce every time or on many machines during the bootstrap. Many thanks to Duncan Sands who got the exact command (and stage of the bootstrap) which failed on the dragonegg bootstrap and managed to get it to trigger under valgrind with debug symbols. The fix was then found by inspection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159993 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r--lib/CodeGen/LiveInterval.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp
index 2dfd714e9e..9342439cc3 100644
--- a/lib/CodeGen/LiveInterval.cpp
+++ b/lib/CodeGen/LiveInterval.cpp
@@ -579,7 +579,8 @@ void LiveInterval::mergeIntervalRanges(const LiveInterval &RHS,
// And finally insert any trailing end of RHS (if we have one).
for (; RI != RE; ++RI)
- if (ranges.back().valno == LHSValNo && RI->start <= ranges.back().end) {
+ if (!ranges.empty() &&
+ ranges.back().valno == LHSValNo && RI->start <= ranges.back().end) {
ranges.back().end = std::max(ranges.back().end, RI->end);
} else {
ranges.push_back(*RI);