summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/StrongPHIElimination.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-08-06 18:36:17 +0000
committerOwen Anderson <resistor@mac.com>2008-08-06 18:36:17 +0000
commitf9fca2f2dc9295aae43c5304895e8c3deef0e66b (patch)
tree72241d9fc56d8b2e529a9836fe5c55c27086d97b /llvm/lib/CodeGen/StrongPHIElimination.cpp
parent03dddbbed5d3d8a9efec34004f960946f343cebb (diff)
downloadbcm5719-llvm-f9fca2f2dc9295aae43c5304895e8c3deef0e66b.tar.gz
bcm5719-llvm-f9fca2f2dc9295aae43c5304895e8c3deef0e66b.zip
Only trim a live interval if the register is not used after the PHI node.
llvm-svn: 54421
Diffstat (limited to 'llvm/lib/CodeGen/StrongPHIElimination.cpp')
-rw-r--r--llvm/lib/CodeGen/StrongPHIElimination.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/StrongPHIElimination.cpp b/llvm/lib/CodeGen/StrongPHIElimination.cpp
index 545544a3bda..b276e80e92b 100644
--- a/llvm/lib/CodeGen/StrongPHIElimination.cpp
+++ b/llvm/lib/CodeGen/StrongPHIElimination.cpp
@@ -896,13 +896,16 @@ bool StrongPHIElimination::runOnMachineFunction(MachineFunction &Fn) {
}
} 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);
OpenPOWER on IntegriCloud