diff options
author | Owen Anderson <resistor@mac.com> | 2008-08-05 21:18:51 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-08-05 21:18:51 +0000 |
commit | d9b88a85f27573d09ee872268ff940ca557f3b4b (patch) | |
tree | 2a8838ac471c83c22711c738437363f01cddc22e /llvm/lib/CodeGen/StrongPHIElimination.cpp | |
parent | d4ffa4eb573407da39b4d7bf00477b8cf358802b (diff) | |
download | bcm5719-llvm-d9b88a85f27573d09ee872268ff940ca557f3b4b.tar.gz bcm5719-llvm-d9b88a85f27573d09ee872268ff940ca557f3b4b.zip |
Oops, we were already checking for dead phis. Handle this the proper way, then.
llvm-svn: 54371
Diffstat (limited to 'llvm/lib/CodeGen/StrongPHIElimination.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StrongPHIElimination.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/StrongPHIElimination.cpp b/llvm/lib/CodeGen/StrongPHIElimination.cpp index fb625fd0866..545544a3bda 100644 --- a/llvm/lib/CodeGen/StrongPHIElimination.cpp +++ b/llvm/lib/CodeGen/StrongPHIElimination.cpp @@ -884,8 +884,17 @@ bool StrongPHIElimination::runOnMachineFunction(MachineFunction &Fn) { I != E; ) { MachineInstr* PInstr = *(I++); - // Don't do live interval updating for dead PHIs. - if (!PInstr->registerDefIsDead(PInstr->getOperand(0).getReg())) { + // If this is a dead PHI node, then remove it from LiveIntervals. + unsigned DestReg = PInstr->getOperand(0).getReg(); + LiveInterval& PI = LI.getInterval(DestReg); + if (PInstr->registerDefIsDead(DestReg)) { + if (PI.containsOneValue()) { + LI.removeInterval(DestReg); + } else { + unsigned idx = LI.getDefIndex(LI.getInstructionIndex(PInstr)); + PI.removeRange(*PI.getLiveRangeContaining(idx), true); + } + } else { // Trim live intervals of input registers. They are no longer live into // this block. for (unsigned i = 1; i < PInstr->getNumOperands(); i += 2) { @@ -899,26 +908,14 @@ bool StrongPHIElimination::runOnMachineFunction(MachineFunction &Fn) { true); } - // If this is a dead PHI node, then remove it from LiveIntervals. - unsigned DestReg = PInstr->getOperand(0).getReg(); - LiveInterval& PI = LI.getInterval(DestReg); - if (PInstr->registerDefIsDead(DestReg)) { - if (PI.containsOneValue()) { - LI.removeInterval(DestReg); - } else { - unsigned idx = LI.getDefIndex(LI.getInstructionIndex(PInstr)); - PI.removeRange(*PI.getLiveRangeContaining(idx), true); - } - } else { - // If the PHI is not dead, then the valno defined by the PHI - // now has an unknown def. - unsigned idx = LI.getDefIndex(LI.getInstructionIndex(PInstr)); - const LiveRange* PLR = PI.getLiveRangeContaining(idx); - PLR->valno->def = ~0U; - LiveRange R (LI.getMBBStartIdx(PInstr->getParent()), - PLR->start, PLR->valno); - PI.addRange(R); - } + // If the PHI is not dead, then the valno defined by the PHI + // now has an unknown def. + unsigned idx = LI.getDefIndex(LI.getInstructionIndex(PInstr)); + const LiveRange* PLR = PI.getLiveRangeContaining(idx); + PLR->valno->def = ~0U; + LiveRange R (LI.getMBBStartIdx(PInstr->getParent()), + PLR->start, PLR->valno); + PI.addRange(R); } LI.RemoveMachineInstrFromMaps(PInstr); |