[llvm-commits] [llvm] r54421 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Owen Anderson resistor at mac.com
Wed Aug 6 11:36:18 PDT 2008


Author: resistor
Date: Wed Aug  6 13:36:17 2008
New Revision: 54421

URL: http://llvm.org/viewvc/llvm-project?rev=54421&view=rev
Log:
Only trim a live interval if the register is not used after the PHI node.

Modified:
    llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=54421&r1=54420&r2=54421&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Aug  6 13:36:17 2008
@@ -896,13 +896,16 @@
       }
     } else {
       // Trim live intervals of input registers.  They are no longer live into
-      // this block.
+      // this block if they died after the PHI.  If they lived after it, don't
+      // trim them because they might have other legitimate uses.
       for (unsigned i = 1; i < PInstr->getNumOperands(); i += 2) {
         unsigned reg = PInstr->getOperand(i).getReg();
         MachineBasicBlock* MBB = PInstr->getOperand(i+1).getMBB();
         LiveInterval& InputI = LI.getInterval(reg);
         if (MBB != PInstr->getParent() &&
-            InputI.liveAt(LI.getMBBStartIdx(PInstr->getParent())))
+            InputI.liveAt(LI.getMBBStartIdx(PInstr->getParent())) &&
+            InputI.expiredAt(LI.getInstructionIndex(PInstr) + 
+                             LiveIntervals::InstrSlots::NUM))
           InputI.removeRange(LI.getMBBStartIdx(PInstr->getParent()),
                              LI.getInstructionIndex(PInstr),
                              true);





More information about the llvm-commits mailing list