diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-08-05 23:51:28 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-08-05 23:51:28 +0000 |
commit | 01a81b01bc2b837f7111bf733401c57a494ae32d (patch) | |
tree | 534b8e78ed09dae79cf31d78b431525f7e1d6d28 /llvm | |
parent | b4ef4a961db9d4801c12ed943e26890810eb4d6c (diff) | |
download | bcm5719-llvm-01a81b01bc2b837f7111bf733401c57a494ae32d.tar.gz bcm5719-llvm-01a81b01bc2b837f7111bf733401c57a494ae32d.zip |
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.
llvm-svn: 110403
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp index ff591832a39..fd6ffcecd14 100644 --- a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -1726,7 +1726,8 @@ bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) { bool DoDelete = true; assert(MI->isCopyLike() && "Unrecognized copy instruction"); 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 // registers unless the definition is dead. e.g. // %DO<def> = INSERT_SUBREG %D0<undef>, %S0<kill>, 1 @@ -1740,9 +1741,15 @@ bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) { ShortenDeadCopyLiveRange(li, MI); 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); - else { + } else { li_->RemoveMachineInstrFromMaps(MI); mii = mbbi->erase(mii); ++numPeep; |