mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-22 13:29:44 +00:00
Be more aggressive about removing joined physreg copies.
When a joined COPY changes subreg liveness, we keep it around as a KILL, otherwise it is safe to delete. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110403 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c910c8d2fa
commit
f67202c94d
@ -1726,7 +1726,8 @@ bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
bool DoDelete = true;
|
bool DoDelete = true;
|
||||||
assert(MI->isCopyLike() && "Unrecognized copy instruction");
|
assert(MI->isCopyLike() && "Unrecognized copy instruction");
|
||||||
unsigned SrcReg = MI->getOperand(MI->isSubregToReg() ? 2 : 1).getReg();
|
unsigned SrcReg = MI->getOperand(MI->isSubregToReg() ? 2 : 1).getReg();
|
||||||
if (TargetRegisterInfo::isPhysicalRegister(SrcReg))
|
if (TargetRegisterInfo::isPhysicalRegister(SrcReg) &&
|
||||||
|
MI->getNumOperands() > 2)
|
||||||
// Do not delete extract_subreg, insert_subreg of physical
|
// Do not delete extract_subreg, insert_subreg of physical
|
||||||
// registers unless the definition is dead. e.g.
|
// registers unless the definition is dead. e.g.
|
||||||
// %DO<def> = INSERT_SUBREG %D0<undef>, %S0<kill>, 1
|
// %DO<def> = INSERT_SUBREG %D0<undef>, %S0<kill>, 1
|
||||||
@ -1740,9 +1741,15 @@ bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) {
|
|||||||
ShortenDeadCopyLiveRange(li, MI);
|
ShortenDeadCopyLiveRange(li, MI);
|
||||||
DoDelete = true;
|
DoDelete = true;
|
||||||
}
|
}
|
||||||
if (!DoDelete)
|
if (!DoDelete) {
|
||||||
|
// We need the instruction to adjust liveness, so make it a KILL.
|
||||||
|
if (MI->isSubregToReg()) {
|
||||||
|
MI->RemoveOperand(3);
|
||||||
|
MI->RemoveOperand(1);
|
||||||
|
}
|
||||||
|
MI->setDesc(tii_->get(TargetOpcode::KILL));
|
||||||
mii = llvm::next(mii);
|
mii = llvm::next(mii);
|
||||||
else {
|
} else {
|
||||||
li_->RemoveMachineInstrFromMaps(MI);
|
li_->RemoveMachineInstrFromMaps(MI);
|
||||||
mii = mbbi->erase(mii);
|
mii = mbbi->erase(mii);
|
||||||
++numPeep;
|
++numPeep;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user