Use skipInstruction() as a simpler way of iterating over instructions using SrcReg

llvm-svn: 107234
This commit is contained in:
Jakob Stoklund Olesen 2010-06-30 00:30:36 +00:00
parent 08baf59da1
commit b3b89c3bc0

View File

@ -742,16 +742,8 @@ SimpleRegisterCoalescing::UpdateRegDefsUses(const CoalescerPair &CP) {
unsigned DstReg = CP.getDstReg();
unsigned SubIdx = CP.getSubIdx();
// Collect all the instructions using SrcReg.
SmallPtrSet<MachineInstr*, 32> Instrs;
for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(SrcReg),
E = mri_->reg_end(); I != E; ++I)
Instrs.insert(&*I);
for (SmallPtrSet<MachineInstr*, 32>::const_iterator I = Instrs.begin(),
E = Instrs.end(); I != E; ++I) {
MachineInstr *UseMI = *I;
for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(SrcReg);
MachineInstr *UseMI = I.skipInstruction();) {
// A PhysReg copy that won't be coalesced can perhaps be rematerialized
// instead.
if (DstIsPhys) {