[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Aug 31 21:02:59 PDT 2006



Changes in directory llvm/lib/CodeGen:

LiveIntervalAnalysis.cpp updated: 1.176 -> 1.177
---
Log message:

Iterative coallescing doesn't buy us anything (we get identical results on
crafty with and without it).  Removing it speeds up live intervals 6%.


---
Diffs of the changes:  (+4 -24)

 LiveIntervalAnalysis.cpp |   28 ++++------------------------
 1 files changed, 4 insertions(+), 24 deletions(-)


Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.176 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.177
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.176	Thu Aug 31 01:48:26 2006
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp	Thu Aug 31 23:02:42 2006
@@ -1066,8 +1066,7 @@
 }
 
 
-void LiveIntervals::CopyCoallesceInMBB(MachineBasicBlock *MBB,
-                                       std::vector<CopyRec> &TryAgain) {
+void LiveIntervals::CopyCoallesceInMBB(MachineBasicBlock *MBB) {
   DEBUG(std::cerr << ((Value*)MBB->getBasicBlock())->getName() << ":\n");
   
   for (MachineBasicBlock::iterator MII = MBB->begin(), E = MBB->end();
@@ -1078,8 +1077,7 @@
     unsigned SrcReg, DstReg;
     if (!tii_->isMoveInstr(*Inst, SrcReg, DstReg)) continue;
     
-    if (!JoinCopy(Inst, SrcReg, DstReg))
-      TryAgain.push_back(getCopyRec(Inst, SrcReg, DstReg));
+    JoinCopy(Inst, SrcReg, DstReg);
   }
 }
 
@@ -1087,14 +1085,12 @@
 void LiveIntervals::joinIntervals() {
   DEBUG(std::cerr << "********** JOINING INTERVALS ***********\n");
 
-  std::vector<CopyRec> TryAgainList;
-  
   const LoopInfo &LI = getAnalysis<LoopInfo>();
   if (LI.begin() == LI.end()) {
     // If there are no loops in the function, join intervals in function order.
     for (MachineFunction::iterator I = mf_->begin(), E = mf_->end();
          I != E; ++I)
-      CopyCoallesceInMBB(I, TryAgainList);
+      CopyCoallesceInMBB(I);
   } else {
     // Otherwise, join intervals in inner loops before other intervals.
     // Unfortunately we can't just iterate over loop hierarchy here because
@@ -1109,23 +1105,7 @@
 
     // Finally, join intervals in loop nest order.
     for (unsigned i = 0, e = MBBs.size(); i != e; ++i)
-      CopyCoallesceInMBB(MBBs[i].second, TryAgainList);
-  }
-
-  // Joining intervals can allow other intervals to be joined.  Iteratively join
-  // until we make no progress.
-  bool ProgressMade = true;
-  while (ProgressMade) {
-    ProgressMade = false;
-    
-    for (unsigned i = 0, e = TryAgainList.size(); i != e; ++i) {
-      CopyRec &TheCopy = TryAgainList[i];
-      if (TheCopy.MI &&
-          JoinCopy(TheCopy.MI, TheCopy.SrcReg, TheCopy.DstReg)) {
-        TheCopy.MI = 0;   // Mark this one as done.
-        ProgressMade = true;
-      }
-    }
+      CopyCoallesceInMBB(MBBs[i].second);
   }
   
   DEBUG(std::cerr << "*** Register mapping ***\n");






More information about the llvm-commits mailing list