summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineCSE.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2013-12-17 19:29:36 +0000
committerAndrew Trick <atrick@apple.com>2013-12-17 19:29:36 +0000
commitff7e4b11b1df5c7bee430a4a9c3de59ca40fcb80 (patch)
treedd44a5e4414eb3bae6700ebcf4123e98e1781a7f /lib/CodeGen/MachineCSE.cpp
parentde262fecd2f4eeb266b67eaaed783cfc52f88b5f (diff)
downloadllvm-ff7e4b11b1df5c7bee430a4a9c3de59ca40fcb80.tar.gz
llvm-ff7e4b11b1df5c7bee430a4a9c3de59ca40fcb80.tar.bz2
llvm-ff7e4b11b1df5c7bee430a4a9c3de59ca40fcb80.tar.xz
Disabled subregister copy coalescing during MachineCSE.
This effectively backs out r197465 but leaves some of the general fixes in place. Not all targets are ready to handle this feature. To enable it, some infrastructure work is needed to better handle register class constraints. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineCSE.cpp')
-rw-r--r--lib/CodeGen/MachineCSE.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/CodeGen/MachineCSE.cpp b/lib/CodeGen/MachineCSE.cpp
index 80982bca8c..35ba7ff35e 100644
--- a/lib/CodeGen/MachineCSE.cpp
+++ b/lib/CodeGen/MachineCSE.cpp
@@ -133,16 +133,26 @@ bool MachineCSE::PerformTrivialCoalescing(MachineInstr *MI,
continue;
if (DefMI->getOperand(0).getSubReg())
continue;
- unsigned SrcSubReg = DefMI->getOperand(1).getSubReg();
+ // FIXME: We should trivially coalesce subregister copies to expose CSE
+ // opportunities on instructions with truncated operands (see
+ // cse-add-with-overflow.ll). This can be done here as follows:
+ // if (SrcSubReg)
+ // RC = TRI->getMatchingSuperRegClass(MRI->getRegClass(SrcReg), RC,
+ // SrcSubReg);
+ // MO.substVirtReg(SrcReg, SrcSubReg, *TRI);
+ //
+ // The 2-addr pass has been updated to handle coalesced subregs. However,
+ // some machine-specific code still can't handle it.
+ // To handle it properly we also need a way find a constrained subregister
+ // class given a super-reg class and subreg index.
+ if (DefMI->getOperand(1).getSubReg())
+ continue;
const TargetRegisterClass *RC = MRI->getRegClass(Reg);
- if (SrcSubReg)
- RC = TRI->getMatchingSuperRegClass(MRI->getRegClass(SrcReg), RC,
- SrcSubReg);
if (!MRI->constrainRegClass(SrcReg, RC))
continue;
DEBUG(dbgs() << "Coalescing: " << *DefMI);
DEBUG(dbgs() << "*** to: " << *MI);
- MO.substVirtReg(SrcReg, SrcSubReg, *TRI);
+ MO.setReg(SrcReg);
MRI->clearKillFlags(SrcReg);
DefMI->eraseFromParent();
++NumCoalesces;