Skip to content

[Analysis] Use *Set::insert_range (NFC) #132878

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

Merged
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/Analysis/CGSCCPassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,8 +1071,7 @@ static LazyCallGraph::SCC &updateCGAndAnalysisManagerForPass(

// We added a ref edge earlier for new call edges, promote those to call edges
// alongside PromotedRefTargets.
for (Node *E : NewCallEdges)
PromotedRefTargets.insert(E);
PromotedRefTargets.insert_range(NewCallEdges);

// Now promote ref edges into call edges.
for (Node *CallTarget : PromotedRefTargets) {
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,7 @@ FunctionPropertiesUpdater::FunctionPropertiesUpdater(
// finish().
Successors.erase(&CallSiteBB);

for (const auto *BB : Successors)
LikelyToChangeBBs.insert(BB);
LikelyToChangeBBs.insert_range(Successors);

// Commit the change. While some of the BBs accounted for above may play dual
// role - e.g. caller's entry BB may be the same as the callsite BB - set
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Analysis/InlineCost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2870,8 +2870,7 @@ InlineResult CallAnalyzer::analyze() {

// If we're unable to select a particular successor, just count all of
// them.
for (BasicBlock *Succ : successors(BB))
BBWorklist.insert(Succ);
BBWorklist.insert_range(successors(BB));

onBlockAnalyzed(BB);
}
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Analysis/MemorySSAUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,8 @@ void MemorySSAUpdater::updateForClonedLoop(const LoopBlocksRPO &LoopBlocks,
ArrayRef<BasicBlock *> ExitBlocks,
const ValueToValueMapTy &VMap,
bool IgnoreIncomingWithNoClones) {
SmallSetVector<BasicBlock *, 16> Blocks;
for (BasicBlock *BB : concat<BasicBlock *const>(LoopBlocks, ExitBlocks))
Blocks.insert(BB);
SmallSetVector<BasicBlock *, 16> Blocks(
llvm::from_range, concat<BasicBlock *const>(LoopBlocks, ExitBlocks));

auto IsInClonedRegion = [&](BasicBlock *BB) { return Blocks.contains(BB); };

Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,12 +637,10 @@ static void computeFunctionSummary(
// All new reference edges inserted in two loops below are either
// read or write only. They will be grouped in the end of RefEdges
// vector, so we can use a single integer value to identify them.
for (const auto &VI : LoadRefEdges)
RefEdges.insert(VI);
RefEdges.insert_range(LoadRefEdges);

unsigned FirstWORef = RefEdges.size();
for (const auto &VI : StoreRefEdges)
RefEdges.insert(VI);
RefEdges.insert_range(StoreRefEdges);

Refs = RefEdges.takeVector();
for (; RefCnt < FirstWORef; ++RefCnt)
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Analysis/StackSafetyAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,7 @@ void StackSafetyDataFlowAnalysis<CalleeTy>::updateOneNode(
<< (UpdateToFullSet ? ", full-set" : "") << "] " << &FS
<< "\n");
// Callers of this function may need updating.
for (auto &CallerID : Callers[Callee])
WorkList.insert(CallerID);
WorkList.insert_range(Callers[Callee]);

++FS.UpdateCount;
}
Expand Down
5 changes: 1 addition & 4 deletions llvm/lib/Analysis/SyntheticCountsUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ template <typename CallGraphType>
void SyntheticCountsUtils<CallGraphType>::propagateFromSCC(
const SccTy &SCC, GetProfCountTy GetProfCount, AddCountTy AddCount) {

DenseSet<NodeRef> SCCNodes;
DenseSet<NodeRef> SCCNodes(llvm::from_range, SCC);
SmallVector<std::pair<NodeRef, EdgeRef>, 8> SCCEdges, NonSCCEdges;

for (auto &Node : SCC)
SCCNodes.insert(Node);

// Partition the edges coming out of the SCC into those whose destination is
// in the SCC and the rest.
for (const auto &Node : SCCNodes) {
Expand Down