Skip to content

Commit 54d836a

Browse files
[llvm] Use *Set::insert_range (NFC) (#138237)
1 parent 9e2684e commit 54d836a

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

llvm/lib/CodeGen/LexicalScopes.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,7 @@ void LexicalScopes::getMachineBasicBlocks(
287287
return;
288288

289289
if (Scope == CurrentFnLexicalScope) {
290-
for (const auto &MBB : *MF)
291-
MBBs.insert(&MBB);
290+
MBBs.insert_range(llvm::make_pointer_range(*MF));
292291
return;
293292
}
294293

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,8 +1330,8 @@ RISCVVLOptimizer::checkUsers(const MachineInstr &MI) const {
13301330
UserMI.getOperand(0).getSubReg() == RISCV::NoSubRegister &&
13311331
UserMI.getOperand(1).getSubReg() == RISCV::NoSubRegister) {
13321332
LLVM_DEBUG(dbgs() << " Peeking through uses of COPY\n");
1333-
for (auto &CopyUse : MRI->use_operands(UserMI.getOperand(0).getReg()))
1334-
Worklist.insert(&CopyUse);
1333+
Worklist.insert_range(llvm::make_pointer_range(
1334+
MRI->use_operands(UserMI.getOperand(0).getReg())));
13351335
continue;
13361336
}
13371337

@@ -1340,8 +1340,8 @@ RISCVVLOptimizer::checkUsers(const MachineInstr &MI) const {
13401340
if (!PHISeen.insert(&UserMI).second)
13411341
continue;
13421342
LLVM_DEBUG(dbgs() << " Peeking through uses of PHI\n");
1343-
for (auto &PhiUse : MRI->use_operands(UserMI.getOperand(0).getReg()))
1344-
Worklist.insert(&PhiUse);
1343+
Worklist.insert_range(llvm::make_pointer_range(
1344+
MRI->use_operands(UserMI.getOperand(0).getReg())));
13451345
continue;
13461346
}
13471347

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,7 @@ static void followUsesInContext(AAType &AA, Attributor &A,
626626
if (const Instruction *UserI = dyn_cast<Instruction>(U->getUser())) {
627627
bool Found = Explorer.findInContextOf(UserI, EIt, EEnd);
628628
if (Found && AA.followUseInMBEC(A, U, UserI, State))
629-
for (const Use &Us : UserI->uses())
630-
Uses.insert(&Us);
629+
Uses.insert_range(llvm::make_pointer_range(UserI->uses()));
631630
}
632631
}
633632
}

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7557,8 +7557,7 @@ bool SimplifyCFGOpt::simplifyDuplicateSwitchArms(SwitchInst *SI,
75577557
if (Seen.insert(BB).second) {
75587558
// Keep track of which PHIs we need as keys in PhiPredIVs below.
75597559
for (BasicBlock *Succ : BI->successors())
7560-
for (PHINode &Phi : Succ->phis())
7561-
Phis.insert(&Phi);
7560+
Phis.insert_range(llvm::make_pointer_range(Succ->phis()));
75627561
// Add the successor only if not previously visited.
75637562
Cases.emplace_back(SwitchSuccWrapper{BB, &PhiPredIVs});
75647563
}

llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ opportunities(Function &F,
150150
// Regardless whether referenced, add the function arguments as
151151
// replacement possibility with the goal of reducing the number of (used)
152152
// function arguments, possibly created by the operands-to-args.
153-
for (Argument &Arg : F.args())
154-
ReferencedVals.insert(&Arg);
153+
ReferencedVals.insert_range(llvm::make_pointer_range(F.args()));
155154

156155
// After all candidates have been added, it doesn't need to be a set
157156
// anymore.

0 commit comments

Comments
 (0)