diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TailDuplicator.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/Target/AVR/AVRFrameLowering.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Target/MSP430/MSP430FrameLowering.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/TextAPI/TextStub.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 5 | ||||
-rw-r--r-- | llvm/utils/TableGen/CodeGenRegisters.cpp | 6 |
8 files changed, 23 insertions, 28 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index 1638562..2f07c4b 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -1198,14 +1198,13 @@ bool BranchFolder::OptimizeBranches(MachineFunction &MF) { // Renumbering blocks alters EH scope membership, recalculate it. EHScopeMembership = getEHScopeMembership(MF); - for (MachineFunction::iterator I = std::next(MF.begin()), E = MF.end(); - I != E; ) { - MachineBasicBlock *MBB = &*I++; - MadeChange |= OptimizeBlock(MBB); + for (MachineBasicBlock &MBB : + llvm::make_early_inc_range(llvm::drop_begin(MF))) { + MadeChange |= OptimizeBlock(&MBB); // If it is dead, remove it. - if (MBB->pred_empty()) { - RemoveDeadBlock(MBB); + if (MBB.pred_empty()) { + RemoveDeadBlock(&MBB); MadeChange = true; ++NumDeadBlocks; } diff --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp index af735f2..b82eaa5 100644 --- a/llvm/lib/CodeGen/TailDuplicator.cpp +++ b/llvm/lib/CodeGen/TailDuplicator.cpp @@ -279,18 +279,17 @@ bool TailDuplicator::tailDuplicateBlocks() { VerifyPHIs(*MF, true); } - for (MachineFunction::iterator I = ++MF->begin(), E = MF->end(); I != E;) { - MachineBasicBlock *MBB = &*I++; - + for (MachineBasicBlock &MBB : + llvm::make_early_inc_range(llvm::drop_begin(*MF))) { if (NumTails == TailDupLimit) break; - bool IsSimple = isSimpleBB(MBB); + bool IsSimple = isSimpleBB(&MBB); - if (!shouldTailDuplicate(IsSimple, *MBB)) + if (!shouldTailDuplicate(IsSimple, MBB)) continue; - MadeChange |= tailDuplicateAndUpdate(IsSimple, MBB, nullptr); + MadeChange |= tailDuplicateAndUpdate(IsSimple, &MBB, nullptr); } if (PreRegAlloc && TailDupVerify) diff --git a/llvm/lib/Target/AVR/AVRFrameLowering.cpp b/llvm/lib/Target/AVR/AVRFrameLowering.cpp index 9e320ad..a4bde54 100644 --- a/llvm/lib/Target/AVR/AVRFrameLowering.cpp +++ b/llvm/lib/Target/AVR/AVRFrameLowering.cpp @@ -111,9 +111,8 @@ void AVRFrameLowering::emitPrologue(MachineFunction &MF, .setMIFlag(MachineInstr::FrameSetup); // Mark the FramePtr as live-in in every block except the entry. - for (MachineFunction::iterator I = std::next(MF.begin()), E = MF.end(); - I != E; ++I) { - I->addLiveIn(AVR::R29R28); + for (MachineBasicBlock &MBBJ : llvm::drop_begin(MF)) { + MBBJ.addLiveIn(AVR::R29R28); } if (!FrameSize) { diff --git a/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp b/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp index 4be8d07..a83a5d2 100644 --- a/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp +++ b/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp @@ -71,9 +71,8 @@ void MSP430FrameLowering::emitPrologue(MachineFunction &MF, .addReg(MSP430::SP); // Mark the FramePtr as live-in in every block except the entry. - for (MachineFunction::iterator I = std::next(MF.begin()), E = MF.end(); - I != E; ++I) - I->addLiveIn(MSP430::R4); + for (MachineBasicBlock &MBBJ : llvm::drop_begin(MF)) + MBBJ.addLiveIn(MSP430::R4); } else NumBytes = StackSize - MSP430FI->getCalleeSavedFrameSize(); diff --git a/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp b/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp index cc9fa335..83f05e5 100644 --- a/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp +++ b/llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp @@ -566,8 +566,8 @@ void SystemZELFFrameLowering::emitPrologue(MachineFunction &MF, // Mark the FramePtr as live at the beginning of every block except // the entry block. (We'll have marked R11 as live on entry when // saving the GPRs.) - for (auto I = std::next(MF.begin()), E = MF.end(); I != E; ++I) - I->addLiveIn(SystemZ::R11D); + for (MachineBasicBlock &MBBJ : llvm::drop_begin(MF)) + MBBJ.addLiveIn(SystemZ::R11D); } // Skip over the FPR/VR saves. diff --git a/llvm/lib/TextAPI/TextStub.cpp b/llvm/lib/TextAPI/TextStub.cpp index 5d85342..b64f19a 100644 --- a/llvm/lib/TextAPI/TextStub.cpp +++ b/llvm/lib/TextAPI/TextStub.cpp @@ -1121,9 +1121,9 @@ TextAPIReader::get(MemoryBufferRef InputBuffer) { auto File = std::unique_ptr<InterfaceFile>( const_cast<InterfaceFile *>(Files.front())); - for (auto Iter = std::next(Files.begin()); Iter != Files.end(); ++Iter) + for (const InterfaceFile *FI : llvm::drop_begin(Files)) File->addDocument( - std::shared_ptr<InterfaceFile>(const_cast<InterfaceFile *>(*Iter))); + std::shared_ptr<InterfaceFile>(const_cast<InterfaceFile *>(FI))); if (YAMLIn.error()) return make_error<StringError>(Ctx.ErrorMessage, YAMLIn.error()); diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index a6b0fce..be39cb4 100644 --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -1623,11 +1623,10 @@ struct DSEState { // Find the common post-dominator of all killing blocks. BasicBlock *CommonPred = *KillingBlocks.begin(); - for (auto I = std::next(KillingBlocks.begin()), E = KillingBlocks.end(); - I != E; I++) { + for (BasicBlock *BB : llvm::drop_begin(KillingBlocks)) { if (!CommonPred) break; - CommonPred = PDT.findNearestCommonDominator(CommonPred, *I); + CommonPred = PDT.findNearestCommonDominator(CommonPred, BB); } // If CommonPred is in the set of killing blocks, just check if it diff --git a/llvm/utils/TableGen/CodeGenRegisters.cpp b/llvm/utils/TableGen/CodeGenRegisters.cpp index 0392388..d2c8b1d 100644 --- a/llvm/utils/TableGen/CodeGenRegisters.cpp +++ b/llvm/utils/TableGen/CodeGenRegisters.cpp @@ -1624,9 +1624,9 @@ static void computeUberSets(std::vector<UberRegSet> &UberSets, assert(USetID && "register number 0 is invalid"); AllocatableRegs.insert((*Regs.begin())->EnumValue); - for (auto I = std::next(Regs.begin()), E = Regs.end(); I != E; ++I) { - AllocatableRegs.insert((*I)->EnumValue); - UberSetIDs.join(USetID, (*I)->EnumValue); + for (const CodeGenRegister *CGR : llvm::drop_begin(Regs)) { + AllocatableRegs.insert(CGR->EnumValue); + UberSetIDs.join(USetID, CGR->EnumValue); } } // Combine non-allocatable regs. |