aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2021-09-16 08:46:26 -0700
committerKazu Hirata <kazu@google.com>2021-09-16 08:46:26 -0700
commitcfc74024195e3be44d023a505d80b7e19f4041fc (patch)
treecb50d7311939e6493372ded80ac939b560b4a570 /llvm/lib/CodeGen/BranchFolding.cpp
parentffa5c3a555a8d5d9931d1ae6d6c9e873ff8c5510 (diff)
downloadllvm-cfc74024195e3be44d023a505d80b7e19f4041fc.zip
llvm-cfc74024195e3be44d023a505d80b7e19f4041fc.tar.gz
llvm-cfc74024195e3be44d023a505d80b7e19f4041fc.tar.bz2
[llvm] Use drop_begin (NFC)
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp11
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;
}