Skip to content

Commit 92f4001

Browse files
authoredJul 3, 2024
[Transforms] Use range-based for loops (NFC) (#97576)
1 parent a379b22 commit 92f4001

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed
 

‎llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -4399,8 +4399,8 @@ Instruction *InstCombinerImpl::visitLandingPadInst(LandingPadInst &LI) {
43994399
if (MakeNewInstruction) {
44004400
LandingPadInst *NLI = LandingPadInst::Create(LI.getType(),
44014401
NewClauses.size());
4402-
for (unsigned i = 0, e = NewClauses.size(); i != e; ++i)
4403-
NLI->addClause(NewClauses[i]);
4402+
for (Constant *C : NewClauses)
4403+
NLI->addClause(C);
44044404
// A landing pad with no clauses must have the cleanup flag set. It is
44054405
// theoretically possible, though highly unlikely, that we eliminated all
44064406
// clauses. If so, force the cleanup flag to true.

‎llvm/lib/Transforms/Utils/SimplifyCFG.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -5339,8 +5339,7 @@ bool SimplifyCFGOpt::simplifyUnreachable(UnreachableInst *UI) {
53395339
std::vector<DominatorTree::UpdateType> Updates;
53405340

53415341
SmallSetVector<BasicBlock *, 8> Preds(pred_begin(BB), pred_end(BB));
5342-
for (unsigned i = 0, e = Preds.size(); i != e; ++i) {
5343-
auto *Predecessor = Preds[i];
5342+
for (BasicBlock *Predecessor : Preds) {
53445343
Instruction *TI = Predecessor->getTerminator();
53455344
IRBuilder<> Builder(TI);
53465345
if (auto *BI = dyn_cast<BranchInst>(TI)) {

0 commit comments

Comments
 (0)