[llvm-commits] [llvm] r133910 - /llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Jun 27 08:00:36 PDT 2011


Author: stoklund
Date: Mon Jun 27 10:00:36 2011
New Revision: 133910

URL: http://llvm.org/viewvc/llvm-project?rev=133910&view=rev
Log:
Track live-out physical registers in MachineDCE.

Patch by Sanjoy Das!

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

Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=133910&r1=133909&r2=133910&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original)
+++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Mon Jun 27 10:00:36 2011
@@ -110,9 +110,14 @@
           LivePhysRegs.set(Reg);
       }
 
-    // FIXME: Add live-ins from sucessors to LivePhysRegs. Normally, physregs
-    // are not live across blocks, but some targets (x86) can have flags live
-    // out of a block.
+    // Add live-ins from sucessors to LivePhysRegs. Normally, physregs are not
+    // live across blocks, but some targets (x86) can have flags live out of a
+    // block.
+    for (MachineBasicBlock::succ_iterator S = MBB->succ_begin(),
+           E = MBB->succ_end(); S != E; S++)
+      for (MachineBasicBlock::livein_iterator LI = (*S)->livein_begin();
+           LI != (*S)->livein_end(); LI++)
+        LivePhysRegs.set(*LI);
 
     // Now scan the instructions and delete dead ones, tracking physreg
     // liveness as we go.





More information about the llvm-commits mailing list