Skip to content

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

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
2 changes: 1 addition & 1 deletion llvm/include/llvm/Analysis/IVDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class RecurrenceDescriptor {
Kind(K), FMF(FMF), ExactFPMathInst(ExactFP), RecurrenceType(RT),
IsSigned(Signed), IsOrdered(Ordered),
MinWidthCastToRecurrenceType(MinWidthCastToRecurTy) {
CastInsts.insert(CI.begin(), CI.end());
CastInsts.insert_range(CI);
}

/// This POD struct holds information about a potential recurrence operation.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/MemorySSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,7 @@ void MemorySSA::buildMemorySSA(BatchAAResults &BAA, IterT Blocks) {
// the loop, to limit the scope of the renaming.
SmallVector<BasicBlock *> ExitBlocks;
L->getExitBlocks(ExitBlocks);
Visited.insert(ExitBlocks.begin(), ExitBlocks.end());
Visited.insert_range(ExitBlocks);
renamePass(DT->getNode(L->getLoopPreheader()), LiveOnEntryDef.get(),
Visited);
} else {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Analysis/PhiValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void PhiValues::processPhi(const PHINode *Phi,
if (OpDepthNumber != RootDepthNumber) {
auto It = ReachableMap.find(OpDepthNumber);
if (It != ReachableMap.end())
Reachable.insert(It->second.begin(), It->second.end());
Reachable.insert_range(It->second);
}
} else
Reachable.insert(Op);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ DIE *DwarfCompileUnit::createAndAddScopeChildren(LexicalScope *Scope,
// should be emitted for subprograms in this CU.
if (!includeMinimalInlineScopes() && !Scope->getInlinedAt()) {
auto &LocalDecls = DD->getLocalDeclsForScope(Scope->getScopeNode());
DeferredLocalDecls.insert(LocalDecls.begin(), LocalDecls.end());
DeferredLocalDecls.insert_range(LocalDecls);
}

// Emit inner lexical scopes.
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,7 @@ static void interpretValues(const MachineInstr *CurMI,
getForwardingRegsDefinedByMI(*CurMI, FwdRegDefs);
if (FwdRegDefs.empty()) {
// Any definitions by this instruction will clobber earlier reg movements.
ClobberedRegUnits.insert(NewClobberedRegUnits.begin(),
NewClobberedRegUnits.end());
ClobberedRegUnits.insert_range(NewClobberedRegUnits);
return;
}

Expand Down Expand Up @@ -756,8 +755,7 @@ static void interpretValues(const MachineInstr *CurMI,
ForwardedRegWorklist.erase(ParamFwdReg);

// Any definitions by this instruction will clobber earlier reg movements.
ClobberedRegUnits.insert(NewClobberedRegUnits.begin(),
NewClobberedRegUnits.end());
ClobberedRegUnits.insert_range(NewClobberedRegUnits);

// Now that we are done handling this instruction, add items from the
// temporary worklist to the real one.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/CodeGenPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7577,7 +7577,7 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
FalseBlock = StartBlock;

SmallPtrSet<const Instruction *, 2> INS;
INS.insert(ASI.begin(), ASI.end());
INS.insert_range(ASI);
// Use reverse iterator because later select may use the value of the
// earlier select, and we need to propagate value through earlier select
// to get the PHI operand.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/InlineSpiller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ void HoistSpillHelper::getVisitOrders(
// with BBs containing hoisted spills which will be inserted to
// SpillsToKeep later during hoisting.
SpillsToKeep[MDT[Block]] = Register();
WorkSet.insert(NodesOnPath.begin(), NodesOnPath.end());
WorkSet.insert_range(NodesOnPath);
}
NodesOnPath.clear();
}
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/CodeGen/InterleavedAccessPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ bool InterleavedAccessImpl::lowerInterleavedLoad(
return !Extracts.empty() || BinOpShuffleChanged;
}

DeadInsts.insert(Shuffles.begin(), Shuffles.end());
DeadInsts.insert_range(Shuffles);

DeadInsts.insert(LI);
return true;
Expand Down Expand Up @@ -703,7 +703,7 @@ bool InterleavedAccessImpl::lowerDeinterleaveIntrinsic(
return false;
}

DeadInsts.insert(DeinterleaveDeadInsts.begin(), DeinterleaveDeadInsts.end());
DeadInsts.insert_range(DeinterleaveDeadInsts);
// We now have a target-specific load, so delete the old one.
DeadInsts.insert(cast<Instruction>(LoadedVal));
return true;
Expand Down Expand Up @@ -757,7 +757,7 @@ bool InterleavedAccessImpl::lowerInterleaveIntrinsic(

// We now have a target-specific store, so delete the old one.
DeadInsts.insert(cast<Instruction>(StoredBy));
DeadInsts.insert(InterleaveDeadInsts.begin(), InterleaveDeadInsts.end());
DeadInsts.insert_range(InterleaveDeadInsts);
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ class TransferTracker {

// Move set of active variables from one location to another.
auto MovingVars = ActiveMLocs[Src];
ActiveMLocs[Dst].insert(MovingVars.begin(), MovingVars.end());
ActiveMLocs[Dst].insert_range(MovingVars);
VarLocs[Dst.asU64()] = VarLocs[Src.asU64()];

// For each variable based on Src; create a location at Dst.
Expand Down Expand Up @@ -2581,7 +2581,7 @@ void InstrRefBasedLDV::placeMLocPHIs(
continue;
}

RegUnitsToPHIUp.insert(FoundRegUnits.begin(), FoundRegUnits.end());
RegUnitsToPHIUp.insert_range(FoundRegUnits);
}

// Lambda to fetch PHIs for a given location, and write into the PHIBlocks
Expand Down Expand Up @@ -3087,7 +3087,7 @@ void InstrRefBasedLDV::getBlocksForScope(
// VarLoc LiveDebugValues tracks variable locations that are defined in
// blocks not in scope. This is something we could legitimately ignore, but
// lets allow it for now for the sake of coverage.
BlocksToExplore.insert(AssignBlocks.begin(), AssignBlocks.end());
BlocksToExplore.insert_range(AssignBlocks);

// Storage for artificial blocks we intend to add to BlocksToExplore.
DenseSet<const MachineBasicBlock *> ToAdd;
Expand Down Expand Up @@ -3137,7 +3137,7 @@ void InstrRefBasedLDV::getBlocksForScope(
}
};

BlocksToExplore.insert(ToAdd.begin(), ToAdd.end());
BlocksToExplore.insert_range(ToAdd);
}

void InstrRefBasedLDV::buildVLocValueMap(
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/MachineCopyPropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ class CopyTracker {

auto Dest = TRI.regunits(CopyOperands->Destination->getReg().asMCReg());
auto Src = TRI.regunits(CopyOperands->Source->getReg().asMCReg());
RegUnitsToInvalidate.insert(Dest.begin(), Dest.end());
RegUnitsToInvalidate.insert(Src.begin(), Src.end());
RegUnitsToInvalidate.insert_range(Dest);
RegUnitsToInvalidate.insert_range(Src);
};

for (MCRegUnit Unit : TRI.regunits(Reg)) {
Expand Down
10 changes: 5 additions & 5 deletions llvm/lib/CodeGen/MachinePipeliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2132,7 +2132,7 @@ void SwingSchedulerDAG::groupRemainingNodes(NodeSetType &NodeSets) {
if (!Path.empty())
I.insert(Path.begin(), Path.end());
}
NodesAdded.insert(I.begin(), I.end());
NodesAdded.insert_range(I);
}

// Create a new node set with the connected nodes of any successor of a node
Expand Down Expand Up @@ -2246,12 +2246,12 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
OrderKind Order;
SmallSetVector<SUnit *, 8> N;
if (pred_L(NodeOrder, N, DDG.get()) && llvm::set_is_subset(N, Nodes)) {
R.insert(N.begin(), N.end());
R.insert_range(N);
Order = BottomUp;
LLVM_DEBUG(dbgs() << " Bottom up (preds) ");
} else if (succ_L(NodeOrder, N, DDG.get()) &&
llvm::set_is_subset(N, Nodes)) {
R.insert(N.begin(), N.end());
R.insert_range(N);
Order = TopDown;
LLVM_DEBUG(dbgs() << " Top down (succs) ");
} else if (isIntersect(N, Nodes, R)) {
Expand Down Expand Up @@ -2330,7 +2330,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
LLVM_DEBUG(dbgs() << "\n Switching order to bottom up ");
SmallSetVector<SUnit *, 8> N;
if (pred_L(NodeOrder, N, DDG.get(), &Nodes))
R.insert(N.begin(), N.end());
R.insert_range(N);
} else {
// Choose the node with the maximum depth. If more than one, choose
// the node with the maximum ZeroLatencyDepth. If still more than one,
Expand Down Expand Up @@ -2385,7 +2385,7 @@ void SwingSchedulerDAG::computeNodeOrder(NodeSetType &NodeSets) {
LLVM_DEBUG(dbgs() << "\n Switching order to top down ");
SmallSetVector<SUnit *, 8> N;
if (succ_L(NodeOrder, N, DDG.get(), &Nodes))
R.insert(N.begin(), N.end());
R.insert_range(N);
}
}
LLVM_DEBUG(dbgs() << "\nDone with Nodeset\n");
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MachineVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3286,7 +3286,7 @@ void MachineVerifier::calcRegsPassed() {
VRegs.add(PredInfo.vregsPassed);
}
Info.vregsPassed.reserve(VRegs.size());
Info.vregsPassed.insert(VRegs.begin(), VRegs.end());
Info.vregsPassed.insert_range(VRegs);
}
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/RDFGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ void DataFlowGraph::recordDefsForDF(BlockRefsMap &PhiM,
for (unsigned i = 0; i < IDF.size(); ++i) {
auto F = MDF.find(IDF[i]);
if (F != MDF.end())
IDF.insert(F->second.begin(), F->second.end());
IDF.insert_range(F->second);
}

// Finally, add the set of defs to each block in the iterated dominance
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/RDFLiveness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ void Liveness::computeLiveIns() {
for (unsigned i = 0; i < IDFB.size(); ++i) {
auto F2 = MDF.find(IDFB[i]);
if (F2 != MDF.end())
IDFB.insert(F2->second.begin(), F2->second.end());
IDFB.insert_range(F2->second);
}
// Add B to the IDF(B). This will put B in the IIDF(B).
IDFB.insert(&B);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/TailDuplicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ bool TailDuplicator::tailDuplicate(bool IsSimple, MachineBasicBlock *TailBB,
bool Changed = false;
SmallSetVector<MachineBasicBlock *, 8> Preds;
if (CandidatePtr)
Preds.insert(CandidatePtr->begin(), CandidatePtr->end());
Preds.insert_range(*CandidatePtr);
else
Preds.insert(TailBB->pred_begin(), TailBB->pred_end());

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/LegacyPassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ PMTopLevelManager::setLastUser(ArrayRef<Pass*> AnalysisPasses, Pass *P) {
auto &LastUsedByAP = InversedLastUser[AP];
for (Pass *L : LastUsedByAP)
LastUser[L] = P;
InversedLastUser[P].insert(LastUsedByAP.begin(), LastUsedByAP.end());
InversedLastUser[P].insert_range(LastUsedByAP);
LastUsedByAP.clear();
}
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/Metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ void Instruction::dropUnknownNonDebugMetadata(ArrayRef<unsigned> KnownIDs) {
return; // Nothing to remove!

SmallSet<unsigned, 32> KnownSet;
KnownSet.insert(KnownIDs.begin(), KnownIDs.end());
KnownSet.insert_range(KnownIDs);

// A DIAssignID attachment is debug metadata, don't drop it.
KnownSet.insert(LLVMContext::MD_DIAssignID);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/ReplaceConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ bool convertUsersOfConstantsToInstructions(ArrayRef<Constant *> Consts,
auto NewInsts = expandUser(BI, C);
for (auto *NI : NewInsts)
NI->setDebugLoc(Loc);
InstructionWorklist.insert(NewInsts.begin(), NewInsts.end());
InstructionWorklist.insert_range(NewInsts);
U.set(NewInsts.back());
}
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/IR/SafepointIRVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class CFGDeadness {
// Do not need to mark all in and out edges dead
// because BB is marked dead and this is enough
// to run further.
DeadBlocks.insert(Dom.begin(), Dom.end());
DeadBlocks.insert_range(Dom);

// Figure out the dominance-frontier(D).
for (BasicBlock *B : Dom)
Expand Down Expand Up @@ -750,7 +750,7 @@ void GCPtrTracker::gatherDominatingDefs(const BasicBlock *BB,
auto BBS = getBasicBlockState(DTN->getBlock());
assert(BBS && "immediate dominator cannot be dead for a live block");
const auto &Defs = BBS->Contribution;
Result.insert(Defs.begin(), Defs.end());
Result.insert_range(Defs);
// If this block is 'Cleared', then nothing LiveIn to this block can be
// available after this block completes. Note: This turns out to be
// really important for reducing memory consuption of the initial available
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/TableGen/SetTheory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ struct SequenceOp : public SetTheory::Operator {
Expr->getAsString());
// Try to reevaluate Rec in case it is a set.
if (const RecVec *Result = ST.expand(Rec))
Elts.insert(Result->begin(), Result->end());
Elts.insert_range(*Result);
else
Elts.insert(Rec);

Expand Down Expand Up @@ -283,7 +283,7 @@ void SetTheory::evaluate(const Init *Expr, RecSet &Elts, ArrayRef<SMLoc> Loc) {
// A def in a list can be a just an element, or it may expand.
if (const auto *Def = dyn_cast<DefInit>(Expr)) {
if (const RecVec *Result = expand(Def->getDef()))
return Elts.insert(Result->begin(), Result->end());
return Elts.insert_range(*Result);
Elts.insert(Def->getDef());
return;
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/tools/llvm-exegesis/lib/Clustering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void BenchmarkClustering::clusterizeDbScan(const size_t MinPts) {

// Process P's neighbors.
SetVector<size_t, std::deque<size_t>> ToProcess;
ToProcess.insert(Neighbors.begin(), Neighbors.end());
ToProcess.insert_range(Neighbors);
while (!ToProcess.empty()) {
// Retrieve a point from the set.
const size_t Q = *ToProcess.begin();
Expand All @@ -170,7 +170,7 @@ void BenchmarkClustering::clusterizeDbScan(const size_t MinPts) {
// And extend to the neighbors of Q if the region is dense enough.
rangeQuery(Q, Neighbors);
if (Neighbors.size() + 1 >= MinPts) {
ToProcess.insert(Neighbors.begin(), Neighbors.end());
ToProcess.insert_range(Neighbors);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/tools/llvm-objdump/llvm-objdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3743,7 +3743,7 @@ int llvm_objdump_main(int argc, char **argv, const llvm::ToolContext &) {
return 2;
}

DisasmSymbolSet.insert(DisassembleSymbols.begin(), DisassembleSymbols.end());
DisasmSymbolSet.insert_range(DisassembleSymbols);

llvm::for_each(InputFilenames, dumpInput);

Expand Down
3 changes: 1 addition & 2 deletions llvm/tools/llvm-profgen/ProfiledBinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@ void ProfiledBinary::load() {
loadSymbolsFromDWARF(*cast<ObjectFile>(&ExeBinary));
}

DisassembleFunctionSet.insert(DisassembleFunctions.begin(),
DisassembleFunctions.end());
DisassembleFunctionSet.insert_range(DisassembleFunctions);

if (auto *ELFObj = dyn_cast<ELFObjectFileBase>(Obj)) {
checkPseudoProbe(ELFObj);
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3322,7 +3322,7 @@ void CodeGenDAGPatterns::ParsePatternFragments(bool OutFrags) {
// Copy the args so we can take StringRefs to them.
auto ArgsCopy = Args;
SmallDenseSet<StringRef, 4> OperandsSet;
OperandsSet.insert(ArgsCopy.begin(), ArgsCopy.end());
OperandsSet.insert_range(ArgsCopy);

if (OperandsSet.count(""))
P->error("Cannot have unnamed 'node' values in pattern fragment!");
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/OptionParserEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ static void emitOptionParser(const RecordKeeper &Records, raw_ostream &OS) {

DenseSet<StringRef> PrefixesUnionSet;
for (const auto &[Prefix, _] : Prefixes)
PrefixesUnionSet.insert(Prefix.begin(), Prefix.end());
PrefixesUnionSet.insert_range(Prefix);
SmallVector<StringRef> PrefixesUnion(PrefixesUnionSet.begin(),
PrefixesUnionSet.end());
array_pod_sort(PrefixesUnion.begin(), PrefixesUnion.end());
Expand Down