diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-01-31 20:56:55 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-01-31 20:56:55 +0000 |
commit | 0c3cfefca62eeaf1f98a49756e3bcb2c451b3374 (patch) | |
tree | 9657711520abf74126a6a4c3feee9721123d6fb1 /lib/Target | |
parent | c73f42b54028e0fce3e7159b76cd59e78107023d (diff) | |
download | external_llvm-0c3cfefca62eeaf1f98a49756e3bcb2c451b3374.zip external_llvm-0c3cfefca62eeaf1f98a49756e3bcb2c451b3374.tar.gz external_llvm-0c3cfefca62eeaf1f98a49756e3bcb2c451b3374.tar.bz2 |
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
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/ARM/ARMConstantIslandPass.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp index 1828cbb..2cdfd1e 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 |