From b3b89c3bc0e6bce4c1c35f34ae7f85a16ceedd0c Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Wed, 30 Jun 2010 00:30:36 +0000 Subject: Use skipInstruction() as a simpler way of iterating over instructions using SrcReg llvm-svn: 107234 --- llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp index 5f4ef5b3b1c..be2bff3d5c9 100644 --- a/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -742,16 +742,8 @@ SimpleRegisterCoalescing::UpdateRegDefsUses(const CoalescerPair &CP) { unsigned DstReg = CP.getDstReg(); unsigned SubIdx = CP.getSubIdx(); - // Collect all the instructions using SrcReg. - SmallPtrSet Instrs; - for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(SrcReg), - E = mri_->reg_end(); I != E; ++I) - Instrs.insert(&*I); - - for (SmallPtrSet::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) { -- cgit v1.2.3