mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 20:26:07 +00:00
Fix a coaelescer bug. If a copy val# is extended to eliminate a non-trivially coalesced copy, and the copy kills its source register. Trim the source register's live range to the last use if possible. This fixes up kill marker to make the scavenger happy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77967 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -123,7 +123,8 @@ bool SimpleRegisterCoalescing::AdjustCopiesBackFrom(LiveInterval &IntA,
|
||||
assert(BValNo->def == CopyIdx && "Copy doesn't define the value?");
|
||||
|
||||
// AValNo is the value number in A that defines the copy, A3 in the example.
|
||||
LiveInterval::iterator ALR = IntA.FindLiveRangeContaining(CopyIdx-1);
|
||||
unsigned CopyUseIdx = li_->getUseIndex(CopyIdx);
|
||||
LiveInterval::iterator ALR = IntA.FindLiveRangeContaining(CopyUseIdx);
|
||||
assert(ALR != IntA.end() && "Live range not found!");
|
||||
VNInfo *AValNo = ALR->valno;
|
||||
// If it's re-defined by an early clobber somewhere in the live range, then
|
||||
@@ -227,6 +228,12 @@ bool SimpleRegisterCoalescing::AdjustCopiesBackFrom(LiveInterval &IntA,
|
||||
IntB.removeKill(ValLR->valno, FillerStart);
|
||||
}
|
||||
|
||||
// If the copy instruction was killing the destination register before the
|
||||
// merge, find the last use and trim the live range. That will also add the
|
||||
// isKill marker.
|
||||
if (CopyMI->killsRegister(IntA.reg))
|
||||
TrimLiveIntervalToLastUse(CopyUseIdx, CopyMI->getParent(), IntA, ALR);
|
||||
|
||||
++numExtends;
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user