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

Chris Lattner lattner at cs.uiuc.edu
Thu Jul 22 22:27:54 PDT 2004



Changes in directory llvm/lib/CodeGen:

PHIElimination.cpp updated: 1.31 -> 1.32

---
Log message:

Update live intervals more accurately for PHI elim.  This slightly reduces
the live intervals for some registers.


---
Diffs of the changes:  (+6 -10)

Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.31 llvm/lib/CodeGen/PHIElimination.cpp:1.32
--- llvm/lib/CodeGen/PHIElimination.cpp:1.31	Thu Jul 22 18:05:12 2004
+++ llvm/lib/CodeGen/PHIElimination.cpp	Fri Jul 23 00:27:43 2004
@@ -131,18 +131,9 @@
       std::pair<LiveVariables::killed_iterator, LiveVariables::killed_iterator> 
         RKs = LV->killed_range(MPhi);
       std::vector<std::pair<MachineInstr*, unsigned> > Range;
-      if (RKs.first != RKs.second) {
-        // Copy the range into a vector...
-        Range.assign(RKs.first, RKs.second);
-
-        // Delete the range...
+      if (RKs.first != RKs.second) // Delete the range.
         LV->removeVirtualRegistersKilled(RKs.first, RKs.second);
 
-        // Add all of the kills back, which will update the appropriate info...
-        for (unsigned i = 0, e = Range.size(); i != e; ++i)
-          LV->addVirtualRegisterKilled(Range[i].second, PHICopy);
-      }
-
       RKs = LV->dead_range(MPhi);
       if (RKs.first != RKs.second) {
         // Works as above...
@@ -252,6 +243,11 @@
           if (!ValueIsLive) {
             MachineBasicBlock::iterator Prev = prior(I);
             LV->addVirtualRegisterKilled(SrcReg, Prev);
+
+            // This vreg no longer lives all of the way through opBlock.
+            unsigned opBlockNum = opBlock.getNumber();
+            if (opBlockNum < InRegVI.AliveBlocks.size())
+              InRegVI.AliveBlocks[opBlockNum] = false;
           }
         }
       }





More information about the llvm-commits mailing list