[llvm-commits] [llvm] r48336 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp

Evan Cheng evan.cheng at apple.com
Thu Mar 13 00:56:59 PDT 2008


Author: evancheng
Date: Thu Mar 13 02:56:58 2008
New Revision: 48336

URL: http://llvm.org/viewvc/llvm-project?rev=48336&view=rev
Log:
Don't try to sink 3-address instruction if convertToThreeAddress created more than one instructions.

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

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

==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Thu Mar 13 02:56:58 2008
@@ -291,7 +291,12 @@
               if (MachineInstr *New=TII->convertToThreeAddress(mbbi, mi, *LV)) {
                 DOUT << "2addr: CONVERTING 2-ADDR: " << *mi;
                 DOUT << "2addr:         TO 3-ADDR: " << *New;
-                bool Sunk = Sink3AddrInstruction(mbbi, New, regB, mi);
+                bool Sunk = false;
+                if (New->findRegisterUseOperand(regB, New, TRI))
+                  // FIXME: Temporary workaround. If the new instruction doesn't
+                  // uses regB, convertToThreeAddress must have created more
+                  // then one instruction.
+                  Sunk = Sink3AddrInstruction(mbbi, New, regB, mi);
                 mbbi->erase(mi);                 // Nuke the old inst.
                 if (!Sunk) mi = New;
                 ++NumConvertedTo3Addr;





More information about the llvm-commits mailing list