-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
[llvm] Use *Set::insert_range (NFC) #132325
Conversation
DenseSet, SmallPtrSet, SmallSet, SetVector, and StringSet recently gained C++23-style insert_range. This patch replaces: Dest.insert(Src.begin(), Src.end()); with: Dest.insert_range(Src); This patch does not touch custom begin like succ_begin for now.
@llvm/pr-subscribers-tablegen @llvm/pr-subscribers-llvm-analysis Author: Kazu Hirata (kazutakahirata) ChangesDenseSet, SmallPtrSet, SmallSet, SetVector, and StringSet recently Dest.insert(Src.begin(), Src.end()); with: Dest.insert_range(Src); This patch does not touch custom begin like succ_begin for now. Full diff: https://github.com/llvm/llvm-project/pull/132325.diff 25 Files Affected:
diff --git a/llvm/include/llvm/Analysis/IVDescriptors.h b/llvm/include/llvm/Analysis/IVDescriptors.h
index e8041e22b031c..42bccdc028461 100644
--- a/llvm/include/llvm/Analysis/IVDescriptors.h
+++ b/llvm/include/llvm/Analysis/IVDescriptors.h
@@ -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.
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index 1583e0e31efc1..fe3aea3039a49 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -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 {
diff --git a/llvm/lib/Analysis/PhiValues.cpp b/llvm/lib/Analysis/PhiValues.cpp
index 1e0dac35f9ef3..dad91a91202c5 100644
--- a/llvm/lib/Analysis/PhiValues.cpp
+++ b/llvm/lib/Analysis/PhiValues.cpp
@@ -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);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index dad14b98d2c3d..3939dae81841f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -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.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index b7b083028ef65..a78f606e62b29 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -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;
}
@@ -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.
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index d5fbd4c380746..1a791f086f11a 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -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.
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp
index ec71d504ebab4..920873c739f46 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -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();
}
diff --git a/llvm/lib/CodeGen/InterleavedAccessPass.cpp b/llvm/lib/CodeGen/InterleavedAccessPass.cpp
index 3261f2858b236..9e47510e9cd1a 100644
--- a/llvm/lib/CodeGen/InterleavedAccessPass.cpp
+++ b/llvm/lib/CodeGen/InterleavedAccessPass.cpp
@@ -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;
@@ -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;
@@ -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;
}
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index b9da975698c42..fb688a231f522 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -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.
@@ -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
@@ -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;
@@ -3137,7 +3137,7 @@ void InstrRefBasedLDV::getBlocksForScope(
}
};
- BlocksToExplore.insert(ToAdd.begin(), ToAdd.end());
+ BlocksToExplore.insert_range(ToAdd);
}
void InstrRefBasedLDV::buildVLocValueMap(
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index 5102639a3a30a..ff75b87b23128 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -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)) {
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 19e8b44b69b01..9bd07da1dd42c 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -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
@@ -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)) {
@@ -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,
@@ -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");
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index 735e1f50b0d24..754c265c4c4fb 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -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);
}
}
diff --git a/llvm/lib/CodeGen/RDFGraph.cpp b/llvm/lib/CodeGen/RDFGraph.cpp
index 805b0ee7be0bc..6d836af3ffc5c 100644
--- a/llvm/lib/CodeGen/RDFGraph.cpp
+++ b/llvm/lib/CodeGen/RDFGraph.cpp
@@ -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
diff --git a/llvm/lib/CodeGen/RDFLiveness.cpp b/llvm/lib/CodeGen/RDFLiveness.cpp
index e4e21bb55bd58..3502e4bb393c8 100644
--- a/llvm/lib/CodeGen/RDFLiveness.cpp
+++ b/llvm/lib/CodeGen/RDFLiveness.cpp
@@ -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);
diff --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp
index e08c8b79b3556..4a2d1355485da 100644
--- a/llvm/lib/CodeGen/TailDuplicator.cpp
+++ b/llvm/lib/CodeGen/TailDuplicator.cpp
@@ -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());
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index ce6f6c733f4bc..9ac6e9c1e97e1 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -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();
}
}
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 6fb74943e95c3..f3b0b8622e785 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -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);
diff --git a/llvm/lib/IR/ReplaceConstant.cpp b/llvm/lib/IR/ReplaceConstant.cpp
index c55a80acf0b52..a31cfe6cca3c1 100644
--- a/llvm/lib/IR/ReplaceConstant.cpp
+++ b/llvm/lib/IR/ReplaceConstant.cpp
@@ -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());
}
}
diff --git a/llvm/lib/IR/SafepointIRVerifier.cpp b/llvm/lib/IR/SafepointIRVerifier.cpp
index d32852b796c20..f649f8fb61ad3 100644
--- a/llvm/lib/IR/SafepointIRVerifier.cpp
+++ b/llvm/lib/IR/SafepointIRVerifier.cpp
@@ -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)
@@ -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
diff --git a/llvm/lib/TableGen/SetTheory.cpp b/llvm/lib/TableGen/SetTheory.cpp
index ac7ae2cbaed57..22ebff77037a8 100644
--- a/llvm/lib/TableGen/SetTheory.cpp
+++ b/llvm/lib/TableGen/SetTheory.cpp
@@ -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);
@@ -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;
}
diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
index fc79718fdeb22..8f74dbff7ca3c 100644
--- a/llvm/tools/llvm-exegesis/lib/Clustering.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
@@ -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();
@@ -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);
}
}
}
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index beed2ddcd981d..8b6f58a56f3eb 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -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);
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
index e4fc3816cd0c4..472e49a49cf70 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -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);
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index ed3ec924afd47..7fc37971c3085 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
@@ -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!");
diff --git a/llvm/utils/TableGen/OptionParserEmitter.cpp b/llvm/utils/TableGen/OptionParserEmitter.cpp
index d17cad41e6a7e..b1ca8ded0a4af 100644
--- a/llvm/utils/TableGen/OptionParserEmitter.cpp
+++ b/llvm/utils/TableGen/OptionParserEmitter.cpp
@@ -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());
|
@llvm/pr-subscribers-debuginfo Author: Kazu Hirata (kazutakahirata) ChangesDenseSet, SmallPtrSet, SmallSet, SetVector, and StringSet recently Dest.insert(Src.begin(), Src.end()); with: Dest.insert_range(Src); This patch does not touch custom begin like succ_begin for now. Full diff: https://github.com/llvm/llvm-project/pull/132325.diff 25 Files Affected:
diff --git a/llvm/include/llvm/Analysis/IVDescriptors.h b/llvm/include/llvm/Analysis/IVDescriptors.h
index e8041e22b031c..42bccdc028461 100644
--- a/llvm/include/llvm/Analysis/IVDescriptors.h
+++ b/llvm/include/llvm/Analysis/IVDescriptors.h
@@ -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.
diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp
index 1583e0e31efc1..fe3aea3039a49 100644
--- a/llvm/lib/Analysis/MemorySSA.cpp
+++ b/llvm/lib/Analysis/MemorySSA.cpp
@@ -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 {
diff --git a/llvm/lib/Analysis/PhiValues.cpp b/llvm/lib/Analysis/PhiValues.cpp
index 1e0dac35f9ef3..dad91a91202c5 100644
--- a/llvm/lib/Analysis/PhiValues.cpp
+++ b/llvm/lib/Analysis/PhiValues.cpp
@@ -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);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index dad14b98d2c3d..3939dae81841f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -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.
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index b7b083028ef65..a78f606e62b29 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -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;
}
@@ -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.
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index d5fbd4c380746..1a791f086f11a 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -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.
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp
index ec71d504ebab4..920873c739f46 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -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();
}
diff --git a/llvm/lib/CodeGen/InterleavedAccessPass.cpp b/llvm/lib/CodeGen/InterleavedAccessPass.cpp
index 3261f2858b236..9e47510e9cd1a 100644
--- a/llvm/lib/CodeGen/InterleavedAccessPass.cpp
+++ b/llvm/lib/CodeGen/InterleavedAccessPass.cpp
@@ -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;
@@ -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;
@@ -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;
}
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index b9da975698c42..fb688a231f522 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -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.
@@ -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
@@ -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;
@@ -3137,7 +3137,7 @@ void InstrRefBasedLDV::getBlocksForScope(
}
};
- BlocksToExplore.insert(ToAdd.begin(), ToAdd.end());
+ BlocksToExplore.insert_range(ToAdd);
}
void InstrRefBasedLDV::buildVLocValueMap(
diff --git a/llvm/lib/CodeGen/MachineCopyPropagation.cpp b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
index 5102639a3a30a..ff75b87b23128 100644
--- a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
+++ b/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -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)) {
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 19e8b44b69b01..9bd07da1dd42c 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -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
@@ -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)) {
@@ -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,
@@ -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");
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index 735e1f50b0d24..754c265c4c4fb 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -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);
}
}
diff --git a/llvm/lib/CodeGen/RDFGraph.cpp b/llvm/lib/CodeGen/RDFGraph.cpp
index 805b0ee7be0bc..6d836af3ffc5c 100644
--- a/llvm/lib/CodeGen/RDFGraph.cpp
+++ b/llvm/lib/CodeGen/RDFGraph.cpp
@@ -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
diff --git a/llvm/lib/CodeGen/RDFLiveness.cpp b/llvm/lib/CodeGen/RDFLiveness.cpp
index e4e21bb55bd58..3502e4bb393c8 100644
--- a/llvm/lib/CodeGen/RDFLiveness.cpp
+++ b/llvm/lib/CodeGen/RDFLiveness.cpp
@@ -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);
diff --git a/llvm/lib/CodeGen/TailDuplicator.cpp b/llvm/lib/CodeGen/TailDuplicator.cpp
index e08c8b79b3556..4a2d1355485da 100644
--- a/llvm/lib/CodeGen/TailDuplicator.cpp
+++ b/llvm/lib/CodeGen/TailDuplicator.cpp
@@ -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());
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index ce6f6c733f4bc..9ac6e9c1e97e1 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -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();
}
}
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 6fb74943e95c3..f3b0b8622e785 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -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);
diff --git a/llvm/lib/IR/ReplaceConstant.cpp b/llvm/lib/IR/ReplaceConstant.cpp
index c55a80acf0b52..a31cfe6cca3c1 100644
--- a/llvm/lib/IR/ReplaceConstant.cpp
+++ b/llvm/lib/IR/ReplaceConstant.cpp
@@ -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());
}
}
diff --git a/llvm/lib/IR/SafepointIRVerifier.cpp b/llvm/lib/IR/SafepointIRVerifier.cpp
index d32852b796c20..f649f8fb61ad3 100644
--- a/llvm/lib/IR/SafepointIRVerifier.cpp
+++ b/llvm/lib/IR/SafepointIRVerifier.cpp
@@ -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)
@@ -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
diff --git a/llvm/lib/TableGen/SetTheory.cpp b/llvm/lib/TableGen/SetTheory.cpp
index ac7ae2cbaed57..22ebff77037a8 100644
--- a/llvm/lib/TableGen/SetTheory.cpp
+++ b/llvm/lib/TableGen/SetTheory.cpp
@@ -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);
@@ -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;
}
diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
index fc79718fdeb22..8f74dbff7ca3c 100644
--- a/llvm/tools/llvm-exegesis/lib/Clustering.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
@@ -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();
@@ -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);
}
}
}
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index beed2ddcd981d..8b6f58a56f3eb 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -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);
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
index e4fc3816cd0c4..472e49a49cf70 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -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);
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index ed3ec924afd47..7fc37971c3085 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
@@ -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!");
diff --git a/llvm/utils/TableGen/OptionParserEmitter.cpp b/llvm/utils/TableGen/OptionParserEmitter.cpp
index d17cad41e6a7e..b1ca8ded0a4af 100644
--- a/llvm/utils/TableGen/OptionParserEmitter.cpp
+++ b/llvm/utils/TableGen/OptionParserEmitter.cpp
@@ -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());
|
DenseSet, SmallPtrSet, SmallSet, SetVector, and StringSet recently
gained C++23-style insert_range. This patch replaces:
Dest.insert(Src.begin(), Src.end());
with:
Dest.insert_range(Src);
This patch does not touch custom begin like succ_begin for now.