diff options
author | Kazu Hirata <kazu@google.com> | 2021-02-21 19:58:07 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2021-02-21 19:58:07 -0800 |
commit | ffba9e596d09a1d41f83102756e145b59d3f8495 (patch) | |
tree | b5cc2badfc7d3f85ea950a1c1335ab4279ca74be /llvm/lib/CodeGen/WinEHPrepare.cpp | |
parent | 5032b5890bb43895012585bd29ff5c3fbd1a7812 (diff) | |
download | llvm-ffba9e596d09a1d41f83102756e145b59d3f8495.zip llvm-ffba9e596d09a1d41f83102756e145b59d3f8495.tar.gz llvm-ffba9e596d09a1d41f83102756e145b59d3f8495.tar.bz2 |
[CodeGen] Use range-based for loops (NFC)
Diffstat (limited to 'llvm/lib/CodeGen/WinEHPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 36919ca..0e5d5e4 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -1023,11 +1023,10 @@ void WinEHPrepare::removeImplausibleInstructions(Function &F) { void WinEHPrepare::cleanupPreparedFunclets(Function &F) { // Clean-up some of the mess we made by removing useles PHI nodes, trivial // branches, etc. - for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE;) { - BasicBlock *BB = &*FI++; - SimplifyInstructionsInBlock(BB); - ConstantFoldTerminator(BB, /*DeleteDeadConditions=*/true); - MergeBlockIntoPredecessor(BB); + for (BasicBlock &BB : llvm::make_early_inc_range(F)) { + SimplifyInstructionsInBlock(&BB); + ConstantFoldTerminator(&BB, /*DeleteDeadConditions=*/true); + MergeBlockIntoPredecessor(&BB); } // We might have some unreachable blocks after cleaning up some impossible @@ -1107,9 +1106,7 @@ AllocaInst *WinEHPrepare::insertPHILoads(PHINode *PN, Function &F) { // Otherwise, we have a PHI on a terminator EHPad, and we give up and insert // loads of the slot before every use. DenseMap<BasicBlock *, Value *> Loads; - for (Value::use_iterator UI = PN->use_begin(), UE = PN->use_end(); - UI != UE;) { - Use &U = *UI++; + for (Use &U : llvm::make_early_inc_range(PN->uses())) { auto *UsingInst = cast<Instruction>(U.getUser()); if (isa<PHINode>(UsingInst) && UsingInst->getParent()->isEHPad()) { // Use is on an EH pad phi. Leave it alone; we'll insert loads and |