R600/SI: Legalize operands after changing dst reg in FixSGPRCopies
authorTom Stellard <thomas.stellard@amd.com>
Thu, 17 Apr 2014 21:00:01 +0000 (21:00 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Thu, 17 Apr 2014 21:00:01 +0000 (21:00 +0000)
Otherwise we may not legalize some illegal REG_SEQUENCE instructions.

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

lib/Target/R600/SIInstrInfo.cpp

index 3e36f27afbd8f5788088432826ad43699f1803d1..a235255756f3df4d9e41fc761e2b283516b2bb24 100644 (file)
@@ -991,9 +991,8 @@ void SIInstrInfo::moveToVALU(MachineInstr &TopInst) const {
       }
     }
 
-    legalizeOperands(Inst);
-
     // Update the destination register class.
+
     const TargetRegisterClass *NewDstRC = getOpRegClass(*Inst, 0);
 
     switch (Inst->getOpcode()) {
@@ -1019,6 +1018,9 @@ void SIInstrInfo::moveToVALU(MachineInstr &TopInst) const {
     unsigned NewDstReg = MRI.createVirtualRegister(NewDstRC);
     MRI.replaceRegWith(DstReg, NewDstReg);
 
+    // Legalize the operands
+    legalizeOperands(Inst);
+
     for (MachineRegisterInfo::use_iterator I = MRI.use_begin(NewDstReg),
            E = MRI.use_end(); I != E; ++I) {
       MachineInstr &UseMI = *I->getParent();