From 170c41f3d50b7172437d90895a033daeb8d7563a Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Wed, 30 Jun 2010 00:30:36 +0000 Subject: [PATCH] Use skipInstruction() as a simpler way of iterating over instructions using SrcReg git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107234 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SimpleRegisterCoalescing.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index 5f4ef5b3b1c..be2bff3d5c9 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/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) {