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

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Sep 27 14:06:00 PDT 2012


Author: stoklund
Date: Thu Sep 27 16:05:59 2012
New Revision: 164793

URL: http://llvm.org/viewvc/llvm-project?rev=164793&view=rev
Log:
Don't dereference begin() on an empty vector.

The fix is obvious and the only test case I have is horrible, so I am
not including it. The problem shows up when self-hosting clang on i386
with -new-coalescer enabled.

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=164793&r1=164792&r2=164793&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Thu Sep 27 16:05:59 2012
@@ -427,7 +427,7 @@
 
   // If we have to apply a mapping to our base interval assignment, rewrite it
   // now.
-  if (MustMapCurValNos) {
+  if (MustMapCurValNos && !empty()) {
     // Map the first live range.
 
     iterator OutIt = begin();





More information about the llvm-commits mailing list