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

Alkis Evlogimenos alkis at cs.uiuc.edu
Tue Jan 13 16:27:02 PST 2004


Changes in directory llvm/lib/CodeGen:

LiveIntervals.cpp updated: 1.23 -> 1.24

---
Log message:

Fix miscomputation of live intervals. The catch is that registers can
be dead at the defining instruction but can only be killed in
subsequent ones.


---
Diffs of the changes:  (+17 -0)

Index: llvm/lib/CodeGen/LiveIntervals.cpp
diff -u llvm/lib/CodeGen/LiveIntervals.cpp:1.23 llvm/lib/CodeGen/LiveIntervals.cpp:1.24
--- llvm/lib/CodeGen/LiveIntervals.cpp:1.23	Tue Jan 13 16:10:43 2004
+++ llvm/lib/CodeGen/LiveIntervals.cpp	Tue Jan 13 16:26:14 2004
@@ -196,6 +196,21 @@
     unsigned start = getInstructionIndex(*mi);
     unsigned end = start;
 
+    // register can be dead by the instruction defining it but it can
+    // only be killed by subsequent instructions
+
+    for (LiveVariables::killed_iterator
+             ki = lv_->dead_begin(*mi),
+             ke = lv_->dead_end(*mi);
+         ki != ke; ++ki) {
+        if (reg == ki->second) {
+            end = getInstructionIndex(ki->first) + 1;
+            DEBUG(std::cerr << " dead\n");
+            goto exit;
+        }
+    }
+    ++mi;
+
     for (MachineBasicBlock::iterator e = mbb->end(); mi != e; ++mi) {
         for (LiveVariables::killed_iterator
                  ki = lv_->dead_begin(*mi),
@@ -203,6 +218,7 @@
              ki != ke; ++ki) {
             if (reg == ki->second) {
                 end = getInstructionIndex(ki->first) + 1;
+                DEBUG(std::cerr << " dead\n");
                 goto exit;
             }
         }
@@ -213,6 +229,7 @@
              ki != ke; ++ki) {
             if (reg == ki->second) {
                 end = getInstructionIndex(ki->first) + 1;
+                DEBUG(std::cerr << " killed\n");
                 goto exit;
             }
         }





More information about the llvm-commits mailing list