From: Jim Grosbach Date: Tue, 31 Jan 2012 20:56:55 +0000 (+0000) Subject: Refactor loop for better readability. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0c3cfefca62eeaf1f98a49756e3bcb2c451b3374;p=oota-llvm.git Refactor loop for better readability. Excellent suggestion from Ben Kramer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149417 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp index 1828cbb696b..2cdfd1e5bfa 100644 --- a/lib/Target/ARM/ARMConstantIslandPass.cpp +++ b/lib/Target/ARM/ARMConstantIslandPass.cpp @@ -829,12 +829,11 @@ unsigned ARMConstantIslands::GetOffsetOf(MachineInstr *MI) const { unsigned Offset = BBInfo[MBB->getNumber()].Offset; // Sum instructions before MI in MBB. - for (MachineBasicBlock::iterator I = MBB->begin(); ; ++I) { + for (MachineBasicBlock::iterator I = MBB->begin(); &*I != MI; ++I) { assert(I != MBB->end() && "Didn't find MI in its own basic block?"); - if (&*I == MI) return Offset; Offset += TII->GetInstSizeInBytes(I); } - // Unreachable. + return Offset; } /// CompareMBBNumbers - Little predicate function to sort the WaterList by MBB