Author: void Date: Tue Dec 11 13:17:04 2007 New Revision: 44873 URL: http://llvm.org/viewvc/llvm-project?rev=44873&view=rev Log: - Update the virtual reg to machine instruction map when hoisting. - Fix subtle bug when creating initially creating this map.
Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=44873&r1=44872&r2=44873&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Dec 11 13:17:04 2007 @@ -215,7 +215,7 @@ const MachineInstr &MI = *II; for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { - const MachineOperand &MO = MI.getOperand(0); + const MachineOperand &MO = MI.getOperand(i); if (MO.isRegister() && MO.isDef() && MRegisterInfo::isVirtualRegister(MO.getReg())) @@ -317,7 +317,17 @@ "The predecessor doesn't feed directly into the loop header!"); // Now move the instructions to the predecessor. - MoveInstToEndOfBlock(MBB, MI.clone()); + MachineInstr *NewMI = MI.clone(); + MoveInstToEndOfBlock(MBB, NewMI); + + // Update VRegDefs. + for (unsigned i = 0, e = NewMI->getNumOperands(); i != e; ++i) { + const MachineOperand &MO = NewMI->getOperand(i); + + if (MO.isRegister() && MO.isDef() && + MRegisterInfo::isVirtualRegister(MO.getReg())) + VRegDefs[MO.getReg()] = NewMI; + } // Hoisting was successful! Remove bothersome instruction now. MI.getParent()->remove(&MI); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits