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
This commit is contained in:
Jim Grosbach 2012-01-31 20:56:55 +00:00
parent c73f42b540
commit 0c3cfefca6

View File

@ -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