[llvm] Use *Set::insert_range (NFC) (#138237)

This commit is contained in:
Kazu Hirata
2025-06-02 19:48:13 -07:00
committed by GitHub
parent 9e2684e4cf
commit 54d836a080
5 changed files with 8 additions and 12 deletions

View File

@@ -287,8 +287,7 @@ void LexicalScopes::getMachineBasicBlocks(
return;
if (Scope == CurrentFnLexicalScope) {
for (const auto &MBB : *MF)
MBBs.insert(&MBB);
MBBs.insert_range(llvm::make_pointer_range(*MF));
return;
}

View File

@@ -1330,8 +1330,8 @@ RISCVVLOptimizer::checkUsers(const MachineInstr &MI) const {
UserMI.getOperand(0).getSubReg() == RISCV::NoSubRegister &&
UserMI.getOperand(1).getSubReg() == RISCV::NoSubRegister) {
LLVM_DEBUG(dbgs() << " Peeking through uses of COPY\n");
for (auto &CopyUse : MRI->use_operands(UserMI.getOperand(0).getReg()))
Worklist.insert(&CopyUse);
Worklist.insert_range(llvm::make_pointer_range(
MRI->use_operands(UserMI.getOperand(0).getReg())));
continue;
}
@@ -1340,8 +1340,8 @@ RISCVVLOptimizer::checkUsers(const MachineInstr &MI) const {
if (!PHISeen.insert(&UserMI).second)
continue;
LLVM_DEBUG(dbgs() << " Peeking through uses of PHI\n");
for (auto &PhiUse : MRI->use_operands(UserMI.getOperand(0).getReg()))
Worklist.insert(&PhiUse);
Worklist.insert_range(llvm::make_pointer_range(
MRI->use_operands(UserMI.getOperand(0).getReg())));
continue;
}

View File

@@ -626,8 +626,7 @@ static void followUsesInContext(AAType &AA, Attributor &A,
if (const Instruction *UserI = dyn_cast<Instruction>(U->getUser())) {
bool Found = Explorer.findInContextOf(UserI, EIt, EEnd);
if (Found && AA.followUseInMBEC(A, U, UserI, State))
for (const Use &Us : UserI->uses())
Uses.insert(&Us);
Uses.insert_range(llvm::make_pointer_range(UserI->uses()));
}
}
}

View File

@@ -7557,8 +7557,7 @@ bool SimplifyCFGOpt::simplifyDuplicateSwitchArms(SwitchInst *SI,
if (Seen.insert(BB).second) {
// Keep track of which PHIs we need as keys in PhiPredIVs below.
for (BasicBlock *Succ : BI->successors())
for (PHINode &Phi : Succ->phis())
Phis.insert(&Phi);
Phis.insert_range(llvm::make_pointer_range(Succ->phis()));
// Add the successor only if not previously visited.
Cases.emplace_back(SwitchSuccWrapper{BB, &PhiPredIVs});
}

View File

@@ -150,8 +150,7 @@ opportunities(Function &F,
// Regardless whether referenced, add the function arguments as
// replacement possibility with the goal of reducing the number of (used)
// function arguments, possibly created by the operands-to-args.
for (Argument &Arg : F.args())
ReferencedVals.insert(&Arg);
ReferencedVals.insert_range(llvm::make_pointer_range(F.args()));
// After all candidates have been added, it doesn't need to be a set
// anymore.