Fix a mistake in my previous change r105437: don't access operand 2 and assume
authorBob Wilson <bob.wilson@apple.com>
Mon, 7 Jun 2010 23:48:46 +0000 (23:48 +0000)
committerBob Wilson <bob.wilson@apple.com>
Mon, 7 Jun 2010 23:48:46 +0000 (23:48 +0000)
that it is an immediate before checking that the instruction is an
EXTRACT_SUBREG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105585 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TwoAddressInstructionPass.cpp

index 14c05feec3929a8c3668f9efdbd74e6cf29e9e5c..16588bf3a7a2de9af137de7b8fd12b1df879bd9c 100644 (file)
@@ -1178,17 +1178,16 @@ TwoAddressInstructionPass::CoalesceExtSubRegs(SmallVector<unsigned,4> &Srcs,
            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)