diff options
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 11 |
1 files changed, 5 insertions, 6 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; } |