summaryrefslogtreecommitdiff
path: root/lib/Target/ARM/ARMConstantIslandPass.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-01-31 20:56:55 +0000
committerJim Grosbach <grosbach@apple.com>2012-01-31 20:56:55 +0000
commit0c3cfefca62eeaf1f98a49756e3bcb2c451b3374 (patch)
tree9657711520abf74126a6a4c3feee9721123d6fb1 /lib/Target/ARM/ARMConstantIslandPass.cpp
parentc73f42b54028e0fce3e7159b76cd59e78107023d (diff)
downloadllvm-0c3cfefca62eeaf1f98a49756e3bcb2c451b3374.tar.gz
llvm-0c3cfefca62eeaf1f98a49756e3bcb2c451b3374.tar.bz2
llvm-0c3cfefca62eeaf1f98a49756e3bcb2c451b3374.tar.xz
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/ARM/ARMConstantIslandPass.cpp')
-rw-r--r--lib/Target/ARM/ARMConstantIslandPass.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp
index 1828cbb696..2cdfd1e5bf 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