[llvm-commits] [llvm] r150108 - /llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Feb 8 14:37:35 PST 2012


Author: stoklund
Date: Wed Feb  8 16:37:35 2012
New Revision: 150108

URL: http://llvm.org/viewvc/llvm-project?rev=150108&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp

Modified: llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp?rev=150108&r1=150107&r2=150108&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineCopyPropagation.cpp Wed Feb  8 16:37:35 2012
@@ -191,8 +191,11 @@
 
     // 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 @@
       }
     }
 
+    // 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];
 





More information about the llvm-commits mailing list