diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-02-08 22:37:35 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-02-08 22:37:35 +0000 |
commit | 8610a59de134450ae7ef142dab2cbe0f86d615cb (patch) | |
tree | 51bd127be9c5d30bdcf87765a5c217c09ba851fd /llvm/lib/CodeGen/MachineCopyPropagation.cpp | |
parent | 55e7d6aefff0d6a3ceca767ea8b471c6a368d9ff (diff) | |
download | llvm-8610a59de134450ae7ef142dab2cbe0f86d615cb.zip llvm-8610a59de134450ae7ef142dab2cbe0f86d615cb.tar.gz llvm-8610a59de134450ae7ef142dab2cbe0f86d615cb.tar.bz2 |
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.
llvm-svn: 150108
Diffstat (limited to 'llvm/lib/CodeGen/MachineCopyPropagation.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineCopyPropagation.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp index ed3f349..56be93a 100644 --- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp +++ b/llvm/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]; |