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

Evan Cheng evan.cheng at apple.com
Wed Nov 15 12:54:26 PST 2006



Changes in directory llvm/lib/CodeGen:

LiveIntervalAnalysis.cpp updated: 1.194 -> 1.195
---
Log message:

A register def can be partially dead when the whole register has use(s) but a subreg does not.

---
Diffs of the changes:  (+8 -1)

 LiveIntervalAnalysis.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.194 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.195
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.194	Fri Nov 10 02:38:19 2006
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp	Wed Nov 15 14:54:11 2006
@@ -575,7 +575,6 @@
   // A physical register cannot be live across basic block, so its
   // lifetime must end somewhere in its defining basic block.
   DEBUG(std::cerr << "\t\tregister: "; printRegName(interval.reg));
-  typedef LiveVariables::killed_iterator KillIter;
 
   unsigned baseIndex = MIIdx;
   unsigned start = getDefIndex(baseIndex);
@@ -599,6 +598,14 @@
       DEBUG(std::cerr << " killed");
       end = getUseIndex(baseIndex) + 1;
       goto exit;
+    } else if (lv_->ModifiesRegister(mi, interval.reg)) {
+      // Another instruction redefines the register before it is ever read.
+      // Then the register is essentially dead at the instruction that defines
+      // it. Hence its interval is:
+      // [defSlot(def), defSlot(def)+1)
+      DEBUG(std::cerr << " dead");
+      end = getDefIndex(start) + 1;
+      goto exit;
     }
   }
   






More information about the llvm-commits mailing list