summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-03-28 01:30:37 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-03-28 01:30:37 +0000
commitd592a28ca1506f2ccd6384679d87cce4b4fd874a (patch)
treeb4a0f316a09bb67d4a2b62dd0f3e35818fbe7eb7 /lib/CodeGen/LiveIntervalAnalysis.cpp
parent05c55ac0c1508bfa770236cd76e2417a23663390 (diff)
downloadllvm-d592a28ca1506f2ccd6384679d87cce4b4fd874a.tar.gz
llvm-d592a28ca1506f2ccd6384679d87cce4b4fd874a.tar.bz2
llvm-d592a28ca1506f2ccd6384679d87cce4b4fd874a.tar.xz
Fix for PR1279. Dead def has a live interval of length 1. Copy coalescing should
not violate that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index 38ada30ad7..eb3ac31998 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -935,9 +935,9 @@ bool LiveIntervals::JoinCopy(MachineInstr *CopyMI,
// The instruction which defines the src is only truly dead if there are
// no intermediate uses and there isn't a use beyond the copy.
// FIXME: find the last use, mark is kill and shorten the live range.
- if (SrcEnd > getDefIndex(CopyIdx))
+ if (SrcEnd > getDefIndex(CopyIdx)) {
isDead = false;
- else {
+ } else {
MachineOperand *MOU;
MachineInstr *LastUse= lastRegisterUse(repSrcReg, SrcStart, CopyIdx, MOU);
if (LastUse) {
@@ -947,7 +947,9 @@ bool LiveIntervals::JoinCopy(MachineInstr *CopyMI,
isShorten = true;
RemoveStart = getDefIndex(getInstructionIndex(LastUse));
RemoveEnd = SrcEnd;
- }
+ } else if (RemoveStart > 0)
+ // A dead def should have a single cycle interval.
+ ++RemoveStart;
}
}