aboutsummaryrefslogtreecommitdiffstats
path: root/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
commit9b49120408e6c0e10e18ce38cae7120c954fe708 (patch)
treed34777812b5c07a32e23a33830b7bee53c1318db /lib/CodeGen/StrongPHIElimination.cpp
parent788d04152a132121dfc04e63382c1e87e7b9607f (diff)
downloadexternal_llvm-9b49120408e6c0e10e18ce38cae7120c954fe708.zip
external_llvm-9b49120408e6c0e10e18ce38cae7120c954fe708.tar.gz
external_llvm-9b49120408e6c0e10e18ce38cae7120c954fe708.tar.bz2
Only trim a live interval if the register is not used after the PHI node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54421 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StrongPHIElimination.cpp')
-rw-r--r--lib/CodeGen/StrongPHIElimination.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp
index 545544a..b276e80 100644
--- a/lib/CodeGen/StrongPHIElimination.cpp
+++ b/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);