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

Bob Wilson bob.wilson at apple.com
Mon Jun 7 16:48:47 PDT 2010


Author: bwilson
Date: Mon Jun  7 18:48:46 2010
New Revision: 105585

URL: http://llvm.org/viewvc/llvm-project?rev=105585&view=rev
Log:
Fix a mistake in my previous change r105437: don't access operand 2 and assume
that it is an immediate before checking that the instruction is an
EXTRACT_SUBREG.

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=105585&r1=105584&r2=105585&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Jun  7 18:48:46 2010
@@ -1178,17 +1178,16 @@
            UI = MRI->use_nodbg_begin(SrcReg),
            UE = MRI->use_nodbg_end(); UI != UE; ++UI) {
       MachineInstr *UseMI = &*UI;
-      unsigned SubRegIdx = UseMI->getOperand(2).getImm();
       // FIXME: For now require that the destination subregs match the subregs
       // being extracted.
       if (!UseMI->isExtractSubreg() ||
           UseMI->getOperand(0).getReg() != DstReg ||
-          UseMI->getOperand(0).getSubReg() != SubRegIdx ||
+          UseMI->getOperand(0).getSubReg() != UseMI->getOperand(2).getImm() ||
           UseMI->getOperand(1).getSubReg() != 0) {
         CanCoalesce = false;
         break;
       }
-      SubIndices.push_back(SubRegIdx);
+      SubIndices.push_back(UseMI->getOperand(2).getImm());
     }
 
     if (!CanCoalesce || SubIndices.size() < 2)





More information about the llvm-commits mailing list