[llvm-commits] [llvm] r55434 - in /llvm/trunk/lib/CodeGen: MachineInstr.cpp TwoAddressInstructionPass.cpp

Evan Cheng evan.cheng at apple.com
Wed Aug 27 13:58:54 PDT 2008


Author: evancheng
Date: Wed Aug 27 15:58:54 2008
New Revision: 55434

URL: http://llvm.org/viewvc/llvm-project?rev=55434&view=rev
Log:
Move the check whether it's worth remating to caller.

Modified:
    llvm/trunk/lib/CodeGen/MachineInstr.cpp
    llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp

Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=55434&r1=55433&r2=55434&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Aug 27 15:58:54 2008
@@ -714,8 +714,6 @@
 /// isSafeToReMat - Return true if it's safe to rematerialize the specified
 /// instruction which defined the specified register instead of copying it.
 bool MachineInstr::isSafeToReMat(const TargetInstrInfo *TII, unsigned DstReg) {
-  if (!TID->isAsCheapAsAMove())
-    return false;
   bool SawStore = false;
   if (!isSafeToMove(TII, SawStore))
     return false;
@@ -726,7 +724,7 @@
     // FIXME: For now, do not remat any instruction with register operands.
     // Later on, we can loosen the restriction is the register operands have
     // not been modified between the def and use. Note, this is different from
-    // MachineSink because the code in no longer in two-address form (at least
+    // MachineSink because the code is no longer in two-address form (at least
     // partially).
     if (MO.isUse())
       return false;

Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=55434&r1=55433&r2=55434&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Aug 27 15:58:54 2008
@@ -403,6 +403,7 @@
           // If it's safe and profitable, remat the definition instead of
           // copying it.
           if (DefMI &&
+              DefMI->getDesc().isAsCheapAsAMove() &&
               DefMI->isSafeToReMat(TII, regB) &&
               isProfitableToReMat(regB, rc, mi, DefMI, mbbi, Dist,DistanceMap)){
             DEBUG(cerr << "2addr: REMATTING : " << *DefMI << "\n");





More information about the llvm-commits mailing list