[llvm] r254381 - [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
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 30 22:13:02 PST 2015
Author: ctopper
Date: Tue Dec 1 00:13:01 2015
New Revision: 254381
URL: http://llvm.org/viewvc/llvm-project?rev=254381&view=rev
Log:
[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
Modified:
llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp?rev=254381&r1=254380&r2=254381&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Tue Dec 1 00:13:01 2015
@@ -1889,10 +1889,9 @@ void ARMFrameLowering::adjustForSegmente
// 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::adjustForSegmente
// 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) {
More information about the llvm-commits
mailing list