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

Evan Cheng evan.cheng at apple.com
Fri Mar 2 18:18:17 PST 2007



Changes in directory llvm/lib/CodeGen:

LiveIntervalAnalysis.cpp updated: 1.219 -> 1.220
---
Log message:

Watch out for cases like this:

entry (0x8b056f0, LLVM BB @0x8b01b30, ID#0):
Live Ins: %r0 %r1 %r2 %r3
        %reg1032 = tMOVrr %r3<kill>
        %reg1033 = tMOVri8 1
        %reg1034 = tMOVri8 0
        tCMPi8 %reg1029<kill>, 0
        tBcc mbb<entry,0x8b06a10>, 0
    Successors according to CFG: 0x8b06980 0x8b06a10

entry (0x8b06980, LLVM BB @0x8b01b30, ID#12):
    Predecessors according to CFG: 0x8b056f0
        %reg1036 = tMOVrr %reg1034<kill>
    Successors according to CFG: 0x8b06a10

entry (0x8b06a10, LLVM BB @0x8b01b30, ID#13):
    Predecessors according to CFG: 0x8b056f0 0x8b06980
        %reg1024<dead> = tMOVrr %reg1030<kill>
        ...

reg1030 and r1 have already been joined. When reg1024 and reg1030 are joined,
r1 live range from function entry to the tMOVrr instruction are dead. Eliminate
r1 from the livein set of the entry BB, not the BB where the copy is.

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

 LiveIntervalAnalysis.cpp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)


Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.219 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.220
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.219	Fri Mar  2 04:41:15 2007
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp	Fri Mar  2 20:18:00 2007
@@ -938,11 +938,12 @@
   if (JoinIntervals(DestInt, SrcInt)) {
     if (isDead) {
       // Result of the copy is dead. Propagate this property.
-      if (SrcStart == 0 && MRegisterInfo::isPhysicalRegister(repSrcReg)) {
-        // Live-in to the function but dead. Remove it from MBB live-in set.
+      if (SrcStart == 0) {
+        assert(MRegisterInfo::isPhysicalRegister(repSrcReg) &&
+               "Live-in must be a physical register!");
+        // Live-in to the function but dead. Remove it from entry live-in set.
         // JoinIntervals may end up swapping the two intervals.
-        MachineBasicBlock *MBB = CopyMI->getParent();
-        MBB->removeLiveIn(repSrcReg);
+        mf_->begin()->removeLiveIn(repSrcReg);
       } else {
         MachineInstr *SrcMI = getInstructionFromIndex(SrcStart);
         if (SrcMI) {






More information about the llvm-commits mailing list