[llvm-commits] [llvm] r150634 - /llvm/trunk/lib/CodeGen/BranchFolding.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Feb 15 15:42:54 PST 2012


Author: stoklund
Date: Wed Feb 15 17:42:54 2012
New Revision: 150634

URL: http://llvm.org/viewvc/llvm-project?rev=150634&view=rev
Log:
Handle register masks in branch folding.

Don't attempt to move instructions with regmask operands. They are most
likely calls anyway.

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

Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=150634&r1=150633&r2=150634&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Wed Feb 15 17:42:54 2012
@@ -1477,6 +1477,9 @@
   bool IsDef = false;
   for (unsigned i = 0, e = PI->getNumOperands(); !IsDef && i != e; ++i) {
     const MachineOperand &MO = PI->getOperand(i);
+    // If PI has a regmask operand, it is probably a call. Separate away.
+    if (MO.isRegMask())
+      return Loc;
     if (!MO.isReg() || MO.isUse())
       continue;
     unsigned Reg = MO.getReg();
@@ -1589,6 +1592,11 @@
     bool IsSafe = true;
     for (unsigned i = 0, e = TIB->getNumOperands(); i != e; ++i) {
       MachineOperand &MO = TIB->getOperand(i);
+      // Don't attempt to hoist instructions with register masks.
+      if (MO.isRegMask()) {
+        IsSafe = false;
+        break;
+      }
       if (!MO.isReg())
         continue;
       unsigned Reg = MO.getReg();





More information about the llvm-commits mailing list