Changes in directory llvm/lib/CodeGen:

LiveIntervalAnalysis.cpp updated: 1.230 -> 1.231
---
Log message:

Bug fix for PR1279: http://llvm.org/PR1279 . When isDead is propagate by copy 
coalescing, we keep length
of dead def live interval at 1 to avoid multiple def's targeting the same
register. The previous patch missed a case where the source operand is live-in.
In that case, remove the whole interval.

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

 LiveIntervalAnalysis.cpp |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.230 
llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.231
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.230     Wed Mar 28 03:26:40 2007
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp   Fri Mar 30 15:18:35 2007
@@ -915,6 +915,7 @@
 
   // Check if it is necessary to propagate "isDead" property before intervals
   // are joined.
+  MachineBasicBlock *CopyBB = CopyMI->getParent();
   MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg);
   bool isDead = mopd->isDead();
   bool isShorten = false;
@@ -941,9 +942,15 @@
         isShorten = true;
         RemoveStart = getDefIndex(getInstructionIndex(LastUse));
         RemoveEnd   = SrcEnd;
-      } else if (RemoveStart > 0)
-        // A dead def should have a single cycle interval.
-        ++RemoveStart;
+      } else {
+        MachineInstr *SrcMI = getInstructionFromIndex(SrcStart);
+        if (SrcMI) {
+          MachineOperand *mops = SrcMI->findRegisterDefOperand(SrcReg);
+          if (mops)
+            // A dead def should have a single cycle interval.
+            ++RemoveStart;
+        }
+      }
     }
   }
 
@@ -959,7 +966,6 @@
 
     LiveVariables::VarInfo& dvi = lv_->getVarInfo(repDstReg);
     // Is the value used in the current BB or any immediate successroe BB?
-    MachineBasicBlock *CopyBB = CopyMI->getParent();
     if (dvi.UsedBlocks[CopyBB->getNumber()])
       goto TryJoin;
     for (MachineBasicBlock::succ_iterator SI = CopyBB->succ_begin(),
@@ -1018,7 +1024,6 @@
         if (SrcMI) {
           MachineOperand *mops = SrcMI->findRegisterDefOperand(SrcReg);
           if (mops)
-            // FIXME: mops == NULL means SrcMI defines a subregister?
             mops->setIsDead();
         }
       }



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to