summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-03-30 20:18:35 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-03-30 20:18:35 +0000
commit48dd5e7d44fe9c1e5fad42a76a80f6fa418a3bc3 (patch)
treedcc93a04bbaddcb90812386585f4e57691824235 /llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
parent9ca63d605c2c6c9bd543ca23dc72c3362289e78d (diff)
downloadbcm5719-llvm-48dd5e7d44fe9c1e5fad42a76a80f6fa418a3bc3.tar.gz
bcm5719-llvm-48dd5e7d44fe9c1e5fad42a76a80f6fa418a3bc3.zip
Bug fix for PR1279. When isDead is propagate by copy coalescing, we keep length
of dead def live interval at 1 to avoid multiple def's targeting the same register. The previous patch missed a case where the source operand is live-in. In that case, remove the whole interval. llvm-svn: 35512
Diffstat (limited to 'llvm/lib/CodeGen/LiveIntervalAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveIntervalAnalysis.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
index ff7b555d563..bc4f6016f36 100644
--- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -915,6 +915,7 @@ bool LiveIntervals::JoinCopy(MachineInstr *CopyMI,
// Check if it is necessary to propagate "isDead" property before intervals
// are joined.
+ MachineBasicBlock *CopyBB = CopyMI->getParent();
MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg);
bool isDead = mopd->isDead();
bool isShorten = false;
@@ -941,9 +942,15 @@ 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;
+ } else {
+ MachineInstr *SrcMI = getInstructionFromIndex(SrcStart);
+ if (SrcMI) {
+ MachineOperand *mops = SrcMI->findRegisterDefOperand(SrcReg);
+ if (mops)
+ // A dead def should have a single cycle interval.
+ ++RemoveStart;
+ }
+ }
}
}
@@ -959,7 +966,6 @@ bool LiveIntervals::JoinCopy(MachineInstr *CopyMI,
LiveVariables::VarInfo& dvi = lv_->getVarInfo(repDstReg);
// Is the value used in the current BB or any immediate successroe BB?
- MachineBasicBlock *CopyBB = CopyMI->getParent();
if (dvi.UsedBlocks[CopyBB->getNumber()])
goto TryJoin;
for (MachineBasicBlock::succ_iterator SI = CopyBB->succ_begin(),
@@ -1018,7 +1024,6 @@ TryJoin:
if (SrcMI) {
MachineOperand *mops = SrcMI->findRegisterDefOperand(SrcReg);
if (mops)
- // FIXME: mops == NULL means SrcMI defines a subregister?
mops->setIsDead();
}
}
OpenPOWER on IntegriCloud