summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineCopyPropagation.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2012-02-08 22:37:35 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2012-02-08 22:37:35 +0000
commita8fc171b3f703ad8bda50a22e9227eee0822eeec (patch)
tree06421908b06ec8926ca5d84cebde233e507cb4da /lib/CodeGen/MachineCopyPropagation.cpp
parent54a4ce431ff410a1498b8214c533d61094eff685 (diff)
downloadllvm-a8fc171b3f703ad8bda50a22e9227eee0822eeec.tar.gz
llvm-a8fc171b3f703ad8bda50a22e9227eee0822eeec.tar.bz2
llvm-a8fc171b3f703ad8bda50a22e9227eee0822eeec.tar.xz
Handle register masks in MachineCopyPropagation.
For simplicity, treat calls with register masks as basic block boundaries. This means we can't copy propagate callee-saved registers across calls, but I don't think that is a big deal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150108 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineCopyPropagation.cpp')
-rw-r--r--lib/CodeGen/MachineCopyPropagation.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineCopyPropagation.cpp b/lib/CodeGen/MachineCopyPropagation.cpp
index ed3f3498f5..56be93a95b 100644
--- a/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/lib/CodeGen/MachineCopyPropagation.cpp
@@ -191,8 +191,11 @@ bool MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
// Not a copy.
SmallVector<unsigned, 2> Defs;
+ bool HasRegMask = false;
for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI->getOperand(i);
+ if (MO.isRegMask())
+ HasRegMask = true;
if (!MO.isReg())
continue;
unsigned Reg = MO.getReg();
@@ -220,6 +223,20 @@ bool MachineCopyPropagation::CopyPropagateBlock(MachineBasicBlock &MBB) {
}
}
+ // The instruction has a register mask operand which means that it clobbers
+ // a large set of registers. It is possible to use the register mask to
+ // prune the available copies, but treat it like a basic block boundary for
+ // now.
+ if (HasRegMask) {
+ // FIXME: We could possibly erase some MaybeDeadCopies if their registers
+ // are clobbered by the mask.
+ MaybeDeadCopies.clear();
+ AvailCopyMap.clear();
+ CopyMap.clear();
+ SrcMap.clear();
+ continue;
+ }
+
for (unsigned i = 0, e = Defs.size(); i != e; ++i) {
unsigned Reg = Defs[i];