aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SimpleRegisterCoalescing.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-02-09 08:37:45 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-02-09 08:37:45 +0000
commite430f21f8a5dccefc73e6d7c34cf1ff1c6e568c8 (patch)
treea350df004d002d03cd139e57ebd30e3f69509c6b /lib/CodeGen/SimpleRegisterCoalescing.cpp
parenteac316468ad31a7bf286528ff9970c5794ba8539 (diff)
downloadexternal_llvm-e430f21f8a5dccefc73e6d7c34cf1ff1c6e568c8.zip
external_llvm-e430f21f8a5dccefc73e6d7c34cf1ff1c6e568c8.tar.gz
external_llvm-e430f21f8a5dccefc73e6d7c34cf1ff1c6e568c8.tar.bz2
Fix another case ShortenDeadCopySrcLiveRange is shortening too much. No test case possible since I don't know what to grep for. :-(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64125 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SimpleRegisterCoalescing.cpp')
-rw-r--r--lib/CodeGen/SimpleRegisterCoalescing.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp
index 7a8ea6f..e5286c2 100644
--- a/lib/CodeGen/SimpleRegisterCoalescing.cpp
+++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp
@@ -861,22 +861,29 @@ SimpleRegisterCoalescing::ShortenDeadCopySrcLiveRange(LiveInterval &li,
// If there is a last use in the same bb, we can't remove the live range.
// Shorten the live interval and return.
- if (TrimLiveIntervalToLastUse(CopyIdx, CopyMI->getParent(), li, LR))
+ MachineBasicBlock *CopyMBB = CopyMI->getParent();
+ if (TrimLiveIntervalToLastUse(CopyIdx, CopyMBB, li, LR))
return false;
+ MachineBasicBlock *StartMBB = li_->getMBBFromIndex(RemoveStart);
+ if (!isSameOrFallThroughBB(StartMBB, CopyMBB, tii_))
+ // If the live range starts in another mbb and the copy mbb is not a fall
+ // through mbb, then we can only cut the range from the beginning of the
+ // copy mbb.
+ RemoveStart = li_->getMBBStartIdx(CopyMBB) + 1;
+
if (LR->valno->def == RemoveStart) {
// If the def MI defines the val# and this copy is the only kill of the
// val#, then propagate the dead marker.
- if (!li.isOnlyLROfValNo(LR)) {
- if (li.isKill(LR->valno, RemoveEnd))
- li.removeKill(LR->valno, RemoveEnd);
- } else {
+ if (li.isOnlyLROfValNo(LR)) {
PropagateDeadness(li, CopyMI, RemoveStart, li_, tri_);
++numDeadValNo;
}
+ if (li.isKill(LR->valno, RemoveEnd))
+ li.removeKill(LR->valno, RemoveEnd);
}
- removeRange(li, RemoveStart, LR->end, li_, tri_);
+ removeRange(li, RemoveStart, RemoveEnd, li_, tri_);
return removeIntervalIfEmpty(li, li_, tri_);
}