[llvm-commits] [llvm] r54061 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp

Owen Anderson resistor at mac.com
Fri Jul 25 14:07:13 PDT 2008


Author: resistor
Date: Fri Jul 25 16:07:13 2008
New Revision: 54061

URL: http://llvm.org/viewvc/llvm-project?rev=54061&view=rev
Log:
Properly remap live ranges whose end indices are the end of the function.

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

Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=54061&r1=54060&r2=54061&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Jul 25 16:07:13 2008
@@ -168,8 +168,12 @@
           LI->end = getMBBEndIdx(J->second) + 1;
         } else {
           unsigned idx = index;
-          while (!OldI2MI[index]) ++index;
-          LI->end = mi2iMap_[OldI2MI[index]] + (idx == index ? offset : 0);
+          while (index < OldI2MI.size() && !OldI2MI[index]) ++index;
+          
+          if (index != OldI2MI.size())
+            LI->end = mi2iMap_[OldI2MI[index]] + (idx == index ? offset : 0);
+          else
+            LI->end = InstrSlots::NUM * i2miMap_.size();
         }
         
         // Remap the VNInfo def index, which works the same as the
@@ -208,8 +212,13 @@
           } else {
             unsigned idx = index;
             while (!OldI2MI[index]) ++index;
-            vni->kills[i] = mi2iMap_[OldI2MI[index]] +
-                            (idx == index ? offset : 0);
+            while (index < OldI2MI.size() && !OldI2MI[index]) ++index;
+            
+            if (index != OldI2MI.size())
+              vni->kills[i] = mi2iMap_[OldI2MI[index]] + 
+                              (idx == index ? offset : 0);
+            else
+              vni->kills[i] = InstrSlots::NUM * i2miMap_.size();
           }
         }
       }





More information about the llvm-commits mailing list