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

Owen Anderson resistor at mac.com
Wed Jul 30 10:42:48 PDT 2008


Author: resistor
Date: Wed Jul 30 12:42:47 2008
New Revision: 54218

URL: http://llvm.org/viewvc/llvm-project?rev=54218&view=rev
Log:
Value numbers whose def index is a special sentinel value should not be remapped.

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=54218&r1=54217&r2=54218&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Jul 30 12:42:47 2008
@@ -176,19 +176,22 @@
         // Remap the VNInfo def index, which works the same as the
         // start indices above.
         VNInfo* vni = LI->valno;
-        index = vni->def / InstrSlots::NUM;
-        offset = vni->def % InstrSlots::NUM;
-        if (offset == InstrSlots::LOAD) {
-          std::vector<IdxMBBPair>::const_iterator I =
+        
+        // VN's with special sentinel defs don't need to be remapped.
+        if (vni->def != ~0U && vni->def != ~1U) {
+          index = vni->def / InstrSlots::NUM;
+          offset = vni->def % InstrSlots::NUM;
+          if (offset == InstrSlots::LOAD) {
+            std::vector<IdxMBBPair>::const_iterator I =
                   std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), vni->def);
-          // Take the pair containing the index
-          std::vector<IdxMBBPair>::const_iterator J =
+            // Take the pair containing the index
+            std::vector<IdxMBBPair>::const_iterator J =
                     (I == OldI2MBB.end() && OldI2MBB.size()>0) ? (I-1): I;
           
-          vni->def = getMBBStartIdx(J->second);
-          
-        } else {
-          vni->def = mi2iMap_[OldI2MI[index]] + offset;
+            vni->def = getMBBStartIdx(J->second);
+          } else {
+            vni->def = mi2iMap_[OldI2MI[index]] + offset;
+          }
         }
         
         // Remap the VNInfo kill indices, which works the same as
@@ -207,7 +210,6 @@
             vni->kills[i] = getMBBEndIdx(I->second) + 1;
           } else {
             unsigned idx = index;
-            while (!OldI2MI[index]) ++index;
             while (index < OldI2MI.size() && !OldI2MI[index]) ++index;
             
             if (index != OldI2MI.size())





More information about the llvm-commits mailing list