From: Craig Topper Date: Tue, 1 Dec 2015 06:13:01 +0000 (+0000) Subject: [ARM] Use range-based for loops to avoid the need for calculating an array size that... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=08bbdebfc9c6ec9a83db984d97687414ef9e2989;p=oota-llvm.git [ARM] Use range-based for loops to avoid the need for calculating an array size that I would have otherwise cconverted to array_lengthof. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254381 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMFrameLowering.cpp b/lib/Target/ARM/ARMFrameLowering.cpp index 5b322945631..c5990bb7d1f 100644 --- a/lib/Target/ARM/ARMFrameLowering.cpp +++ b/lib/Target/ARM/ARMFrameLowering.cpp @@ -1889,10 +1889,9 @@ void ARMFrameLowering::adjustForSegmentedStacks( // first in the list. MachineBasicBlock *AddedBlocks[] = {PrevStackMBB, McrMBB, GetMBB, AllocMBB, PostStackMBB}; - const int NbAddedBlocks = sizeof(AddedBlocks) / sizeof(AddedBlocks[0]); - for (int Idx = 0; Idx < NbAddedBlocks; ++Idx) - BeforePrologueRegion.insert(AddedBlocks[Idx]); + for (MachineBasicBlock *B : AddedBlocks) + BeforePrologueRegion.insert(B); for (const auto &LI : PrologueMBB.liveins()) { for (MachineBasicBlock *PredBB : BeforePrologueRegion) @@ -1901,9 +1900,9 @@ void ARMFrameLowering::adjustForSegmentedStacks( // Remove the newly added blocks from the list, since we know // we do not have to do the following updates for them. - for (int Idx = 0; Idx < NbAddedBlocks; ++Idx) { - BeforePrologueRegion.erase(AddedBlocks[Idx]); - MF.insert(PrologueMBB.getIterator(), AddedBlocks[Idx]); + for (MachineBasicBlock *B : AddedBlocks) { + BeforePrologueRegion.erase(B); + MF.insert(PrologueMBB.getIterator(), B); } for (MachineBasicBlock *MBB : BeforePrologueRegion) {