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

Owen Anderson resistor at mac.com
Fri Jul 25 16:06:59 PDT 2008


Author: resistor
Date: Fri Jul 25 18:06:59 2008
New Revision: 54072

URL: http://llvm.org/viewvc/llvm-project?rev=54072&view=rev
Log:
Revert my previous patch.  In retrospect, this is completely the wrong way to fix this problem.

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=54072&r1=54071&r2=54072&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Jul 25 18:06:59 2008
@@ -126,7 +126,6 @@
     MBB2IdxMap[MBB->getNumber()] = std::make_pair(StartIdx, MIIndex - 1);
     Idx2MBBMap.push_back(std::make_pair(StartIdx, MBB));
   }
-  
   std::sort(Idx2MBBMap.begin(), Idx2MBBMap.end(), Idx2MBBCompare());
   
   if (!OldI2MI.empty())
@@ -140,7 +139,7 @@
         // instruction or its predecessor.
         unsigned index = LI->start / InstrSlots::NUM;
         unsigned offset = LI->start % InstrSlots::NUM;
-        if (offset == InstrSlots::LOAD || LI->valno->def == ~0U) {
+        if (offset == InstrSlots::LOAD) {
           std::vector<IdxMBBPair>::const_iterator I =
                   std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), LI->start);
           // Take the pair containing the index
@@ -158,30 +157,7 @@
         // following instruction.
         index = (LI->end - 1) / InstrSlots::NUM;
         offset  = LI->end % InstrSlots::NUM;
-        if (LI->valno->hasPHIKill && !OldI2MI[index]) {
-          // Special handling for when this was previously killed by a PHI, but
-          // the PHI has now been removed.  We need to trim the live interval
-          // to die at the end of the preceding block.
-          std::vector<IdxMBBPair>::const_iterator I =
-                  std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), LI->end);
-          // Take the pair containing the index
-          std::vector<IdxMBBPair>::const_iterator J =
-                    ((I != OldI2MBB.end() && I->first > index) ||
-                    (I == OldI2MBB.end() && OldI2MBB.size()>0)) ? (I-1): I;
-          
-          MachineBasicBlock* StartMBB = J->second;
-          MachineBasicBlock* CurrMBB = J->second;
-          
-          while (CurrMBB == StartMBB) {
-            while (index > 0 && !OldI2MI[index]) --index;
-            CurrMBB = OldI2MI[index]->getParent();
-            if (!StartMBB) StartMBB = CurrMBB;
-            
-            --index;
-          }
-          
-          LI->end = getMBBEndIdx(CurrMBB) + 1;
-        } else if (offset == InstrSlots::USE) {
+        if (offset == InstrSlots::USE) {
           std::vector<IdxMBBPair>::const_iterator I =
                   std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), LI->end);
           // Take the pair containing the index
@@ -203,23 +179,20 @@
         // Remap the VNInfo def index, which works the same as the
         // start indices above.
         VNInfo* vni = LI->valno;
-        if (vni->def != ~0U) {
-          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 =
-                      ((I != OldI2MBB.end() && I->first > index) ||
-                      (I == OldI2MBB.end() && OldI2MBB.size()>0)) ? (I-1): I;
+        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 =
+                    ((I != OldI2MBB.end() && I->first > index) ||
+                    (I == OldI2MBB.end() && OldI2MBB.size()>0)) ? (I-1): I;
           
-            vni->def = getMBBStartIdx(J->second);
+          vni->def = getMBBStartIdx(J->second);
           
-          } else {
-            vni->def = mi2iMap_[OldI2MI[index]] + offset;
-          }
+        } else {
+          vni->def = mi2iMap_[OldI2MI[index]] + offset;
         }
         
         // Remap the VNInfo kill indices, which works the same as
@@ -227,31 +200,7 @@
         for (size_t i = 0; i < vni->kills.size(); ++i) {
           index = (vni->kills[i]-1) / InstrSlots::NUM;
           offset = vni->kills[i] % InstrSlots::NUM;
-          
-          if (LI->valno->hasPHIKill && !OldI2MI[index]) {
-            // Special handling for when this was previously killed by a PHI,
-            // but the PHI has now been removed.  We need to trim the live
-            // interval to die at the end of the preceding block.
-            std::vector<IdxMBBPair>::const_iterator I =
-                    std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), LI->end);
-            // Take the pair containing the index
-            std::vector<IdxMBBPair>::const_iterator J =
-                      ((I != OldI2MBB.end() && I->first > index) ||
-                      (I == OldI2MBB.end() && OldI2MBB.size()>0)) ? (I-1): I;
-
-            MachineBasicBlock* StartMBB = J->second;
-            MachineBasicBlock* CurrMBB = J->second;
-
-            while (CurrMBB == StartMBB) {
-              while (index > 0 && !OldI2MI[index]) --index;
-              CurrMBB = OldI2MI[index]->getParent();
-              if (!StartMBB) StartMBB = CurrMBB;
-
-              --index;
-            }
-
-            vni->kills[i] = getMBBEndIdx(CurrMBB) + 1;
-          } else if (offset == InstrSlots::USE) {
+          if (offset == InstrSlots::USE) {
             std::vector<IdxMBBPair>::const_iterator I =
              std::lower_bound(OldI2MBB.begin(), OldI2MBB.end(), vni->kills[i]);
             // Take the pair containing the index





More information about the llvm-commits mailing list