[llvm] 92f4001 - [Transforms] Use range-based for loops (NFC) (#97576)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 3 12:53:23 PDT 2024
Author: Kazu Hirata
Date: 2024-07-03T12:53:19-07:00
New Revision: 92f4001906a18fca29929a333e61fdd662a9b0bd
URL: https://github.com/llvm/llvm-project/commit/92f4001906a18fca29929a333e61fdd662a9b0bd
DIFF: https://github.com/llvm/llvm-project/commit/92f4001906a18fca29929a333e61fdd662a9b0bd.diff
LOG: [Transforms] Use range-based for loops (NFC) (#97576)
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index abcd94bea93e3..0d8e7e92c5c8e 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -4399,8 +4399,8 @@ Instruction *InstCombinerImpl::visitLandingPadInst(LandingPadInst &LI) {
if (MakeNewInstruction) {
LandingPadInst *NLI = LandingPadInst::Create(LI.getType(),
NewClauses.size());
- for (unsigned i = 0, e = NewClauses.size(); i != e; ++i)
- NLI->addClause(NewClauses[i]);
+ for (Constant *C : NewClauses)
+ NLI->addClause(C);
// A landing pad with no clauses must have the cleanup flag set. It is
// theoretically possible, though highly unlikely, that we eliminated all
// clauses. If so, force the cleanup flag to true.
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 69daa6352f95e..3fa3c0f1f52b0 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -5339,8 +5339,7 @@ bool SimplifyCFGOpt::simplifyUnreachable(UnreachableInst *UI) {
std::vector<DominatorTree::UpdateType> Updates;
SmallSetVector<BasicBlock *, 8> Preds(pred_begin(BB), pred_end(BB));
- for (unsigned i = 0, e = Preds.size(); i != e; ++i) {
- auto *Predecessor = Preds[i];
+ for (BasicBlock *Predecessor : Preds) {
Instruction *TI = Predecessor->getTerminator();
IRBuilder<> Builder(TI);
if (auto *BI = dyn_cast<BranchInst>(TI)) {
More information about the llvm-commits
mailing list