Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/LexicalScopes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,8 +1336,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;
}

Expand All @@ -1346,8 +1346,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;
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7547,8 +7547,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});
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,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.
Expand Down