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

Alkis Evlogimenos alkis at niobe.cs.uiuc.edu
Thu Feb 5 14:46:01 PST 2004


Changes in directory llvm/lib/CodeGen:

LiveIntervals.cpp updated: 1.44 -> 1.45

---
Log message:

We don't need to scan the blocks that we are live-in on every
access. Rather we only have to do it on the creation of the interval.


---
Diffs of the changes:  (+13 -12)

Index: llvm/lib/CodeGen/LiveIntervals.cpp
diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.44 llvm/lib/CodeGen/LiveIntervals.cpp:1.45
--- llvm/lib/CodeGen/LiveIntervals.cpp:1.44	Mon Feb  2 14:29:57 2004
+++ llvm/lib/CodeGen/LiveIntervals.cpp	Thu Feb  5 14:45:40 2004
@@ -162,21 +162,22 @@
         // update interval index for this register
         r2iMap_.insert(r2iit, std::make_pair(reg, --intervals_.end()));
         interval = &intervals_.back();
-    }
-    else {
-        interval = &*r2iit->second;
-    }
 
-    // iterate over all of the blocks that the variable is completely
-    // live in, adding them to the live interval
-    for (unsigned i = 0, e = vi.AliveBlocks.size(); i != e; ++i) {
-        if (vi.AliveBlocks[i]) {
-            MachineBasicBlock* mbb = lv_->getIndexMachineBasicBlock(i);
-            if (!mbb->empty()) {
-                interval->addRange(getInstructionIndex(mbb->front()),
-                                   getInstructionIndex(mbb->back()) + 1);
+        // iterate over all of the blocks that the variable is
+        // completely live in, adding them to the live
+        // interval. obviously we only need to do this once.
+        for (unsigned i = 0, e = vi.AliveBlocks.size(); i != e; ++i) {
+            if (vi.AliveBlocks[i]) {
+                MachineBasicBlock* mbb = lv_->getIndexMachineBasicBlock(i);
+                if (!mbb->empty()) {
+                    interval->addRange(getInstructionIndex(mbb->front()),
+                                       getInstructionIndex(mbb->back()) + 1);
+                }
             }
         }
+    }
+    else {
+        interval = &*r2iit->second;
     }
 
     bool killedInDefiningBasicBlock = false;





More information about the llvm-commits mailing list