aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/DeadMachineInstructionElim.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2011-06-27 15:00:36 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2011-06-27 15:00:36 +0000
commitf27229ee5ad121247b9c79e7605b19fccf781d8d (patch)
treee4b7f04724efab4f2ad8dd48c30b07993ce2cb28 /lib/CodeGen/DeadMachineInstructionElim.cpp
parent9174d5c7383490d79b6a483d73cded54e32275d6 (diff)
downloadexternal_llvm-f27229ee5ad121247b9c79e7605b19fccf781d8d.zip
external_llvm-f27229ee5ad121247b9c79e7605b19fccf781d8d.tar.gz
external_llvm-f27229ee5ad121247b9c79e7605b19fccf781d8d.tar.bz2
Track live-out physical registers in MachineDCE.
Patch by Sanjoy Das! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133910 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/DeadMachineInstructionElim.cpp')
-rw-r--r--lib/CodeGen/DeadMachineInstructionElim.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/DeadMachineInstructionElim.cpp b/lib/CodeGen/DeadMachineInstructionElim.cpp
index fdc1d91..6de6c0c 100644
--- a/lib/CodeGen/DeadMachineInstructionElim.cpp
+++ b/lib/CodeGen/DeadMachineInstructionElim.cpp
@@ -110,9 +110,14 @@ bool DeadMachineInstructionElim::runOnMachineFunction(MachineFunction &MF) {
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.