[llvm-commits] [llvm] r159993 - /llvm/trunk/lib/CodeGen/LiveInterval.cpp

Chandler Carruth chandlerc at gmail.com
Tue Jul 10 08:41:34 PDT 2012


Author: chandlerc
Date: Tue Jul 10 10:41:33 2012
New Revision: 159993

URL: http://llvm.org/viewvc/llvm-project?rev=159993&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/LiveInterval.cpp

Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=159993&r1=159992&r2=159993&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Tue Jul 10 10:41:33 2012
@@ -579,7 +579,8 @@
 
   // 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);





More information about the llvm-commits mailing list