[llvm-commits] [llvm] r66192 - /llvm/branches/Apple/Dib/lib/CodeGen/LiveIntervalAnalysis.cpp

Bill Wendling isanbard at gmail.com
Thu Mar 5 12:43:13 PST 2009


Author: void
Date: Thu Mar  5 14:43:12 2009
New Revision: 66192

URL: http://llvm.org/viewvc/llvm-project?rev=66192&view=rev
Log:
--- Merging (from foreign repository) r66129 into '.':
U    lib/CodeGen/LiveIntervalAnalysis.cpp

Fix how livein live intervals are handled. Previously it could end at MBB
start. Sorry, no small test case possible.

Modified:
    llvm/branches/Apple/Dib/lib/CodeGen/LiveIntervalAnalysis.cpp

Modified: llvm/branches/Apple/Dib/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=66192&r1=66191&r2=66192&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Mar  5 14:43:12 2009
@@ -684,11 +684,13 @@
          getInstructionFromIndex(baseIndex) == 0)
     baseIndex += InstrSlots::NUM;
   unsigned end = baseIndex;
+  bool SeenDefUse = false;
   
   while (mi != MBB->end()) {
     if (mi->killsRegister(interval.reg, tri_)) {
       DOUT << " killed";
       end = getUseIndex(baseIndex) + 1;
+      SeenDefUse = true;
       goto exit;
     } else if (mi->modifiesRegister(interval.reg, tri_)) {
       // Another instruction redefines the register before it is ever read.
@@ -697,19 +699,22 @@
       // [defSlot(def), defSlot(def)+1)
       DOUT << " dead";
       end = getDefIndex(start) + 1;
+      SeenDefUse = true;
       goto exit;
     }
 
     baseIndex += InstrSlots::NUM;
-    while (baseIndex / InstrSlots::NUM < i2miMap_.size() && 
-           getInstructionFromIndex(baseIndex) == 0)
-      baseIndex += InstrSlots::NUM;
     ++mi;
+    if (mi != MBB->end()) {
+      while (baseIndex / InstrSlots::NUM < i2miMap_.size() && 
+             getInstructionFromIndex(baseIndex) == 0)
+        baseIndex += InstrSlots::NUM;
+    }
   }
 
 exit:
   // Live-in register might not be used at all.
-  if (end == MIIdx) {
+  if (!SeenDefUse) {
     if (isAlias) {
       DOUT << " dead";
       end = getDefIndex(MIIdx) + 1;





More information about the llvm-commits mailing list