-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
[Transforms] Use *Set::insert_range (NFC) #132056
[Transforms] Use *Set::insert_range (NFC) #132056
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-vectorizers @llvm/pr-subscribers-llvm-transforms 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. Patch is 31.78 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/132056.diff 29 Files Affected:
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index c29a5e53b82ea..9ab0ff58bb5ba 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -583,9 +583,9 @@ static bool getPotentialCopiesOfMemoryValue(
UsedAssumedInformation = true;
A.recordDependence(*PI, QueryingAA, DepClassTy::OPTIONAL);
}
- PotentialCopies.insert(NewCopies.begin(), NewCopies.end());
+ PotentialCopies.insert_range(NewCopies);
if (PotentialValueOrigins)
- PotentialValueOrigins->insert(NewCopyOrigins.begin(), NewCopyOrigins.end());
+ PotentialValueOrigins->insert_range(NewCopyOrigins);
return true;
}
@@ -2123,7 +2123,7 @@ void Attributor::runTillFixpoint() {
SmallVector<AbstractAttribute *, 32> ChangedAAs;
SetVector<AbstractAttribute *> Worklist, InvalidAAs;
- Worklist.insert(DG.SyntheticRoot.begin(), DG.SyntheticRoot.end());
+ Worklist.insert_range(DG.SyntheticRoot);
do {
// Remember the size to determine new attributes.
@@ -2200,9 +2200,8 @@ void Attributor::runTillFixpoint() {
// Reset the work list and repopulate with the changed abstract attributes.
// Note that dependent ones are added above.
Worklist.clear();
- Worklist.insert(ChangedAAs.begin(), ChangedAAs.end());
- Worklist.insert(QueryAAsAwaitingUpdate.begin(),
- QueryAAsAwaitingUpdate.end());
+ Worklist.insert_range(ChangedAAs);
+ Worklist.insert_range(QueryAAsAwaitingUpdate);
QueryAAsAwaitingUpdate.clear();
} while (!Worklist.empty() && (IterationCounter++ < MaxIterations));
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 4b7902ff502d3..cb794adaba79a 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -3735,7 +3735,7 @@ struct AAIntraFnReachabilityFunction final
}
}
- DeadEdges.insert(LocalDeadEdges.begin(), LocalDeadEdges.end());
+ DeadEdges.insert_range(LocalDeadEdges);
return rememberResult(A, RQITy::Reachable::No, RQI, UsedExclusionSet,
IsTemporaryRQI);
}
@@ -12221,8 +12221,7 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo {
} else if (A.isClosedWorldModule()) {
ArrayRef<Function *> IndirectlyCallableFunctions =
A.getInfoCache().getIndirectlyCallableFunctions(A);
- PotentialCallees.insert(IndirectlyCallableFunctions.begin(),
- IndirectlyCallableFunctions.end());
+ PotentialCallees.insert_range(IndirectlyCallableFunctions);
}
if (PotentialCallees.empty())
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 29a1283d9ab21..4a36f49bcbf4b 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -1239,7 +1239,7 @@ void llvm::ComputeCrossModuleImport(
else
++EI;
}
- ELI.second.insert(NewExports.begin(), NewExports.end());
+ ELI.second.insert_range(NewExports);
}
assert(checkVariableImport(Index, ImportLists, ExportLists));
diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
index 250c0443cb4af..45fb1f5212b70 100644
--- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
@@ -73,7 +73,7 @@ void GlobalDCEPass::ComputeDependencies(Value *V,
for (User *CEUser : CE->users())
ComputeDependencies(CEUser, LocalDeps);
}
- Deps.insert(LocalDeps.begin(), LocalDeps.end());
+ Deps.insert_range(LocalDeps);
}
}
diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
index 4ac004b51dd42..4b3f0e23903aa 100644
--- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
+++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
@@ -733,7 +733,7 @@ bool HotColdSplitting::outlineColdRegions(Function &F, bool HasProfileSummary) {
none_of(SubRegion, [&](BasicBlock *Block) {
return ColdBlocks.contains(Block);
})) {
- ColdBlocks.insert(SubRegion.begin(), SubRegion.end());
+ ColdBlocks.insert_range(SubRegion);
LLVM_DEBUG({
for (auto *Block : SubRegion)
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index dee2a1b676cd8..f5ae204426170 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -360,8 +360,7 @@ class CallsiteContextGraph {
? CallerEdges
: std::vector<std::shared_ptr<ContextEdge>>());
for (const auto &Edge : Edges)
- ContextIds.insert(Edge->getContextIds().begin(),
- Edge->getContextIds().end());
+ ContextIds.insert_range(Edge->getContextIds());
return ContextIds;
}
@@ -1372,7 +1371,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
for (auto Id : ContextIds)
if (auto NewId = OldToNewContextIds.find(Id);
NewId != OldToNewContextIds.end())
- NewIds.insert(NewId->second.begin(), NewId->second.end());
+ NewIds.insert_range(NewId->second);
return NewIds;
};
@@ -1389,7 +1388,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
// Only need to recursively iterate to NextNode via this caller edge if
// it resulted in any added ids to NextNode.
if (!NewIdsToAdd.empty()) {
- Edge->getContextIds().insert(NewIdsToAdd.begin(), NewIdsToAdd.end());
+ Edge->getContextIds().insert_range(NewIdsToAdd);
UpdateCallers(NextNode, Visited, UpdateCallers);
}
}
@@ -2534,8 +2533,7 @@ bool CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::calleesMatch(
// If there is already an edge between these nodes, simply update it and
// return.
if (CurEdge) {
- CurEdge->ContextIds.insert(Edge->ContextIds.begin(),
- Edge->ContextIds.end());
+ CurEdge->ContextIds.insert_range(Edge->ContextIds);
CurEdge->AllocTypes |= Edge->AllocTypes;
return;
}
@@ -3281,8 +3279,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
if (ExistingEdgeToNewCallee) {
// Since we already have an edge to NewCallee, simply move the ids
// onto it, and remove the existing Edge.
- ExistingEdgeToNewCallee->getContextIds().insert(ContextIdsToMove.begin(),
- ContextIdsToMove.end());
+ ExistingEdgeToNewCallee->getContextIds().insert_range(ContextIdsToMove);
ExistingEdgeToNewCallee->AllocTypes |= Edge->AllocTypes;
assert(Edge->ContextIds == ContextIdsToMove);
removeEdgeFromGraph(Edge.get());
@@ -3302,8 +3299,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
if (ExistingEdgeToNewCallee) {
// Since we already have an edge to NewCallee, simply move the ids
// onto it.
- ExistingEdgeToNewCallee->getContextIds().insert(ContextIdsToMove.begin(),
- ContextIdsToMove.end());
+ ExistingEdgeToNewCallee->getContextIds().insert_range(ContextIdsToMove);
ExistingEdgeToNewCallee->AllocTypes |= CallerEdgeAllocType;
} else {
// Otherwise, create a new edge to NewCallee for the ids being moved.
@@ -3350,8 +3346,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
// removed none type edges after creating the clone. If we can't find
// a corresponding edge there, fall through to the cloning below.
if (auto *NewCalleeEdge = NewCallee->findEdgeFromCallee(CalleeToUse)) {
- NewCalleeEdge->getContextIds().insert(EdgeContextIdsToMove.begin(),
- EdgeContextIdsToMove.end());
+ NewCalleeEdge->getContextIds().insert_range(EdgeContextIdsToMove);
NewCalleeEdge->AllocTypes |= computeAllocType(EdgeContextIdsToMove);
continue;
}
@@ -3402,8 +3397,8 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
if (ExistingEdgeToNewCaller) {
// Since we already have an edge to NewCaller, simply move the ids
// onto it, and remove the existing Edge.
- ExistingEdgeToNewCaller->getContextIds().insert(
- Edge->getContextIds().begin(), Edge->getContextIds().end());
+ ExistingEdgeToNewCaller->getContextIds().insert_range(
+ Edge->getContextIds());
ExistingEdgeToNewCaller->AllocTypes |= Edge->AllocTypes;
Edge->ContextIds.clear();
Edge->AllocTypes = (uint8_t)AllocationType::None;
@@ -3465,8 +3460,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
// edge, this may not hold true when recursive handling enabled.
assert(IsNewNode || ExistingCallerEdge || AllowRecursiveCallsites);
if (ExistingCallerEdge) {
- ExistingCallerEdge->getContextIds().insert(EdgeContextIdsToMove.begin(),
- EdgeContextIdsToMove.end());
+ ExistingCallerEdge->getContextIds().insert_range(EdgeContextIdsToMove);
ExistingCallerEdge->AllocTypes |=
computeAllocType(EdgeContextIdsToMove);
continue;
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index c463cda68d4b5..924db314674d5 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -321,7 +321,7 @@ bool MergeFunctionsPass::runOnModule(Module &M) {
SmallVector<GlobalValue *, 4> UsedV;
collectUsedGlobalVariables(M, UsedV, /*CompilerUsed=*/false);
collectUsedGlobalVariables(M, UsedV, /*CompilerUsed=*/true);
- MF.getUsed().insert(UsedV.begin(), UsedV.end());
+ MF.getUsed().insert_range(UsedV);
return MF.run(M);
}
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index 95c42f2b9bd45..29bf214a5c9e7 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -675,7 +675,7 @@ struct BooleanStateWithSetVector : public BooleanState {
/// "Clamp" this state with \p RHS.
BooleanStateWithSetVector &operator^=(const BooleanStateWithSetVector &RHS) {
BooleanState::operator^=(RHS);
- Set.insert(RHS.Set.begin(), RHS.Set.end());
+ Set.insert_range(RHS.Set);
return *this;
}
diff --git a/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp b/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
index a614e2d169534..e15aa0472088c 100644
--- a/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
@@ -199,8 +199,7 @@ void SampleProfileProber::computeBlocksToIgnore(
computeEHOnlyBlocks(*F, BlocksAndCallsToIgnore);
findUnreachableBlocks(BlocksAndCallsToIgnore);
- BlocksToIgnore.insert(BlocksAndCallsToIgnore.begin(),
- BlocksAndCallsToIgnore.end());
+ BlocksToIgnore.insert_range(BlocksAndCallsToIgnore);
// Handle the call-to-invoke conversion case: make sure that the probe id and
// callsite id are consistent before and after the block split. For block
diff --git a/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp b/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp
index 0e49984c6ee33..c068d70b3a458 100644
--- a/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp
+++ b/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp
@@ -239,10 +239,10 @@ void BlockCoverageInference::getReachableAvoiding(const BasicBlock &Start,
Visited.insert(&Avoid);
if (IsForward) {
auto Range = depth_first_ext(&Start, Visited);
- Reachable.insert(Range.begin(), Range.end());
+ Reachable.insert_range(Range);
} else {
auto Range = inverse_depth_first_ext(&Start, Visited);
- Reachable.insert(Range.begin(), Range.end());
+ Reachable.insert_range(Range);
}
}
diff --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
index 5d5cbf93c870d..0b35ff82478e3 100644
--- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
@@ -562,7 +562,7 @@ checkHoistValue(Value *V, Instruction *InsertPoint, DominatorTree &DT,
if (AllOpsHoisted) {
CHR_DEBUG(dbgs() << "checkHoistValue " << *I << "\n");
if (HoistStops)
- HoistStops->insert(OpsHoistStops.begin(), OpsHoistStops.end());
+ HoistStops->insert_range(OpsHoistStops);
Visited[I] = true;
return true;
}
@@ -1176,8 +1176,7 @@ SmallVector<CHRScope *, 8> CHR::splitScope(
// point. Union the bases.
PrevSplitFromOuter = false;
PrevConditionValues = *OuterConditionValues;
- PrevConditionValues.insert(ConditionValues.begin(),
- ConditionValues.end());
+ PrevConditionValues.insert_range(ConditionValues);
PrevInsertPoint = OuterInsertPoint;
}
} else {
@@ -1209,7 +1208,7 @@ SmallVector<CHRScope *, 8> CHR::splitScope(
});
} else {
// Not splitting. Union the bases. Keep the hoist point.
- PrevConditionValues.insert(ConditionValues.begin(), ConditionValues.end());
+ PrevConditionValues.insert_range(ConditionValues);
}
}
}
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
index 66a9f7c43d3fe..c5932f0d65ee1 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
@@ -440,7 +440,7 @@ bool SanitizerBinaryMetadata::runOn(Instruction &I, MetadataInfoSet &MIS,
// Attach MD_pcsections to instruction.
if (!InstMetadata.empty()) {
- MIS.insert(InstMetadata.begin(), InstMetadata.end());
+ MIS.insert_range(InstMetadata);
SmallVector<MDBuilder::PCSection, 1> Sections;
for (const auto &MI : InstMetadata)
Sections.push_back({getSectionName(MI->SectionSuffix), {}});
diff --git a/llvm/lib/Transforms/ObjCARC/PtrState.cpp b/llvm/lib/Transforms/ObjCARC/PtrState.cpp
index e9b2dbeb62e60..3af238996fa76 100644
--- a/llvm/lib/Transforms/ObjCARC/PtrState.cpp
+++ b/llvm/lib/Transforms/ObjCARC/PtrState.cpp
@@ -107,7 +107,7 @@ bool RRInfo::Merge(const RRInfo &Other) {
CFGHazardAfflicted |= Other.CFGHazardAfflicted;
// Merge the call sets.
- Calls.insert(Other.Calls.begin(), Other.Calls.end());
+ Calls.insert_range(Other.Calls);
// Merge the insert point sets. If there are any differences,
// that makes this a partial merge.
diff --git a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
index 8cc8e713941b1..40c4c15b7120b 100644
--- a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -248,7 +248,7 @@ static void findBestInsertionSet(DominatorTree &DT, BlockFrequencyInfo &BFI,
continue;
// Add nodes on the Path into Candidates.
- Candidates.insert(Path.begin(), Path.end());
+ Candidates.insert_range(Path);
}
// Sort the nodes in Candidates in top-down order and save the nodes
@@ -283,7 +283,7 @@ static void findBestInsertionSet(DominatorTree &DT, BlockFrequencyInfo &BFI,
(InsertPtsFreq == BFI.getBlockFreq(Node) && InsertPts.size() > 1))
BBs.insert(Entry);
else
- BBs.insert(InsertPts.begin(), InsertPts.end());
+ BBs.insert_range(InsertPts);
break;
}
@@ -304,7 +304,7 @@ static void findBestInsertionSet(DominatorTree &DT, BlockFrequencyInfo &BFI,
ParentInsertPts.insert(Node);
ParentPtsFreq += BFI.getBlockFreq(Node);
} else {
- ParentInsertPts.insert(InsertPts.begin(), InsertPts.end());
+ ParentInsertPts.insert_range(InsertPts);
ParentPtsFreq += InsertPtsFreq;
}
}
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 85fcdd95f5d87..b41899a2dff66 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -3194,7 +3194,7 @@ void GVNPass::addDeadBlock(BasicBlock *BB) {
// All blocks dominated by D are dead.
SmallVector<BasicBlock *, 8> Dom;
DT->getDescendants(D, Dom);
- DeadBlocks.insert(Dom.begin(), Dom.end());
+ DeadBlocks.insert_range(Dom);
// Figure out the dominance-frontier(D).
for (BasicBlock *B : Dom) {
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 5b180c2390bfa..5d9a5f90af186 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -663,7 +663,7 @@ GVNSink::analyzeInstructionForSinking(LockstepReverseIterator<false> &LRI,
// values.
PHIContents.clear();
for (auto &PHI : NeededPHIs)
- PHIContents.insert(PHI.getValues().begin(), PHI.getValues().end());
+ PHIContents.insert_range(PHI.getValues());
}
// Is this instruction required by a later PHI that doesn't match this PHI?
@@ -705,7 +705,7 @@ GVNSink::analyzeInstructionForSinking(LockstepReverseIterator<false> &LRI,
NeededPHIs.reserve(NeededPHIs.size());
NeededPHIs.insert(PHI);
- PHIContents.insert(PHI.getValues().begin(), PHI.getValues().end());
+ PHIContents.insert_range(PHI.getValues());
}
if (isMemoryInst(NewInsts[0]))
diff --git a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp
index 92fd269f7557e..efbd1b89aca8f 100644
--- a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp
@@ -143,7 +143,7 @@ class InstPartition {
/// Moves this partition into \p Other. This partition becomes empty
/// after this.
void moveTo(InstPartition &Other) {
- Other.Set.insert(Set.begin(), Set.end());
+ Other.Set.insert_range(Set);
Set.clear();
Other.DepCycle |= DepCycle;
}
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 2462ec33e0c20..8dc7f325f6262 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -719,7 +719,7 @@ bool LoopIdiomRecognize::processLoopStores(SmallVectorImpl<StoreInst *> &SL,
MaybeAlign(HeadStore->getAlign()), StoredVal,
HeadStore, AdjacentStores, StoreEv, BECount,
IsNegStride)) {
- TransformedStores.insert(AdjacentStores.begin(), AdjacentStores.end());
+ TransformedStores.insert_range(AdjacentStores);
Changed = true;
}
}
diff --git a/llvm/lib/Transforms/Scalar/LoopSink.cpp b/llvm/lib/Transforms/Scalar/LoopSink.cpp
index 7f0c974ac4c5a..b9fde4c6a3b76 100644
--- a/llvm/lib/Transforms/Scalar/LoopSink.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSink.cpp
@@ -120,7 +120,7 @@ findBBsToSinkInto(const Loop &L, const SmallPtrSetImpl<BasicBlock *> &UseBBs,
if (UseBBs.size() == 0)
return BBsToSinkInto;
- BBsToSinkInto.insert(UseBBs.begin(), UseBBs.end());
+ BBsToSinkInto.insert_range(UseBBs);
SmallPtrSet<BasicBlock *, 2> BBsDominatedByColdestBB;
// For every iteration:
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 2c3d64b0e07d9..ed3709b74d60f 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1738,7 +1738,7 @@ bool LSRUse::InsertFormula(const Formula &F, const Loop &L) {
Formulae.push_back(F);
// Record registers now being used by this use.
- Regs.insert(F.BaseRegs.begin(), F.BaseRegs.end());
+ Regs.insert_range(F.BaseRegs);
if (F.ScaledReg)
Regs.insert(F.ScaledReg);
@@ -1759,7 +1759,7 @@ void LSRUse::RecomputeRegs(size_t LUIdx, RegUseTracker &RegUses) {
Regs.clear();
for (const Formula &F : Formulae) {
if (F.ScaledReg) Regs.insert(F.ScaledReg);
- Regs.insert(F.BaseRegs.begin(), F.BaseRegs.end());
+ Regs.insert_range(F.BaseRegs);
}
// Update the RegTracker.
...
[truncated]
|
@llvm/pr-subscribers-lto 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. Patch is 31.78 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/132056.diff 29 Files Affected:
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index c29a5e53b82ea..9ab0ff58bb5ba 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -583,9 +583,9 @@ static bool getPotentialCopiesOfMemoryValue(
UsedAssumedInformation = true;
A.recordDependence(*PI, QueryingAA, DepClassTy::OPTIONAL);
}
- PotentialCopies.insert(NewCopies.begin(), NewCopies.end());
+ PotentialCopies.insert_range(NewCopies);
if (PotentialValueOrigins)
- PotentialValueOrigins->insert(NewCopyOrigins.begin(), NewCopyOrigins.end());
+ PotentialValueOrigins->insert_range(NewCopyOrigins);
return true;
}
@@ -2123,7 +2123,7 @@ void Attributor::runTillFixpoint() {
SmallVector<AbstractAttribute *, 32> ChangedAAs;
SetVector<AbstractAttribute *> Worklist, InvalidAAs;
- Worklist.insert(DG.SyntheticRoot.begin(), DG.SyntheticRoot.end());
+ Worklist.insert_range(DG.SyntheticRoot);
do {
// Remember the size to determine new attributes.
@@ -2200,9 +2200,8 @@ void Attributor::runTillFixpoint() {
// Reset the work list and repopulate with the changed abstract attributes.
// Note that dependent ones are added above.
Worklist.clear();
- Worklist.insert(ChangedAAs.begin(), ChangedAAs.end());
- Worklist.insert(QueryAAsAwaitingUpdate.begin(),
- QueryAAsAwaitingUpdate.end());
+ Worklist.insert_range(ChangedAAs);
+ Worklist.insert_range(QueryAAsAwaitingUpdate);
QueryAAsAwaitingUpdate.clear();
} while (!Worklist.empty() && (IterationCounter++ < MaxIterations));
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 4b7902ff502d3..cb794adaba79a 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -3735,7 +3735,7 @@ struct AAIntraFnReachabilityFunction final
}
}
- DeadEdges.insert(LocalDeadEdges.begin(), LocalDeadEdges.end());
+ DeadEdges.insert_range(LocalDeadEdges);
return rememberResult(A, RQITy::Reachable::No, RQI, UsedExclusionSet,
IsTemporaryRQI);
}
@@ -12221,8 +12221,7 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo {
} else if (A.isClosedWorldModule()) {
ArrayRef<Function *> IndirectlyCallableFunctions =
A.getInfoCache().getIndirectlyCallableFunctions(A);
- PotentialCallees.insert(IndirectlyCallableFunctions.begin(),
- IndirectlyCallableFunctions.end());
+ PotentialCallees.insert_range(IndirectlyCallableFunctions);
}
if (PotentialCallees.empty())
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 29a1283d9ab21..4a36f49bcbf4b 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -1239,7 +1239,7 @@ void llvm::ComputeCrossModuleImport(
else
++EI;
}
- ELI.second.insert(NewExports.begin(), NewExports.end());
+ ELI.second.insert_range(NewExports);
}
assert(checkVariableImport(Index, ImportLists, ExportLists));
diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
index 250c0443cb4af..45fb1f5212b70 100644
--- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
@@ -73,7 +73,7 @@ void GlobalDCEPass::ComputeDependencies(Value *V,
for (User *CEUser : CE->users())
ComputeDependencies(CEUser, LocalDeps);
}
- Deps.insert(LocalDeps.begin(), LocalDeps.end());
+ Deps.insert_range(LocalDeps);
}
}
diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
index 4ac004b51dd42..4b3f0e23903aa 100644
--- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
+++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
@@ -733,7 +733,7 @@ bool HotColdSplitting::outlineColdRegions(Function &F, bool HasProfileSummary) {
none_of(SubRegion, [&](BasicBlock *Block) {
return ColdBlocks.contains(Block);
})) {
- ColdBlocks.insert(SubRegion.begin(), SubRegion.end());
+ ColdBlocks.insert_range(SubRegion);
LLVM_DEBUG({
for (auto *Block : SubRegion)
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index dee2a1b676cd8..f5ae204426170 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -360,8 +360,7 @@ class CallsiteContextGraph {
? CallerEdges
: std::vector<std::shared_ptr<ContextEdge>>());
for (const auto &Edge : Edges)
- ContextIds.insert(Edge->getContextIds().begin(),
- Edge->getContextIds().end());
+ ContextIds.insert_range(Edge->getContextIds());
return ContextIds;
}
@@ -1372,7 +1371,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
for (auto Id : ContextIds)
if (auto NewId = OldToNewContextIds.find(Id);
NewId != OldToNewContextIds.end())
- NewIds.insert(NewId->second.begin(), NewId->second.end());
+ NewIds.insert_range(NewId->second);
return NewIds;
};
@@ -1389,7 +1388,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
// Only need to recursively iterate to NextNode via this caller edge if
// it resulted in any added ids to NextNode.
if (!NewIdsToAdd.empty()) {
- Edge->getContextIds().insert(NewIdsToAdd.begin(), NewIdsToAdd.end());
+ Edge->getContextIds().insert_range(NewIdsToAdd);
UpdateCallers(NextNode, Visited, UpdateCallers);
}
}
@@ -2534,8 +2533,7 @@ bool CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::calleesMatch(
// If there is already an edge between these nodes, simply update it and
// return.
if (CurEdge) {
- CurEdge->ContextIds.insert(Edge->ContextIds.begin(),
- Edge->ContextIds.end());
+ CurEdge->ContextIds.insert_range(Edge->ContextIds);
CurEdge->AllocTypes |= Edge->AllocTypes;
return;
}
@@ -3281,8 +3279,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
if (ExistingEdgeToNewCallee) {
// Since we already have an edge to NewCallee, simply move the ids
// onto it, and remove the existing Edge.
- ExistingEdgeToNewCallee->getContextIds().insert(ContextIdsToMove.begin(),
- ContextIdsToMove.end());
+ ExistingEdgeToNewCallee->getContextIds().insert_range(ContextIdsToMove);
ExistingEdgeToNewCallee->AllocTypes |= Edge->AllocTypes;
assert(Edge->ContextIds == ContextIdsToMove);
removeEdgeFromGraph(Edge.get());
@@ -3302,8 +3299,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
if (ExistingEdgeToNewCallee) {
// Since we already have an edge to NewCallee, simply move the ids
// onto it.
- ExistingEdgeToNewCallee->getContextIds().insert(ContextIdsToMove.begin(),
- ContextIdsToMove.end());
+ ExistingEdgeToNewCallee->getContextIds().insert_range(ContextIdsToMove);
ExistingEdgeToNewCallee->AllocTypes |= CallerEdgeAllocType;
} else {
// Otherwise, create a new edge to NewCallee for the ids being moved.
@@ -3350,8 +3346,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
// removed none type edges after creating the clone. If we can't find
// a corresponding edge there, fall through to the cloning below.
if (auto *NewCalleeEdge = NewCallee->findEdgeFromCallee(CalleeToUse)) {
- NewCalleeEdge->getContextIds().insert(EdgeContextIdsToMove.begin(),
- EdgeContextIdsToMove.end());
+ NewCalleeEdge->getContextIds().insert_range(EdgeContextIdsToMove);
NewCalleeEdge->AllocTypes |= computeAllocType(EdgeContextIdsToMove);
continue;
}
@@ -3402,8 +3397,8 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
if (ExistingEdgeToNewCaller) {
// Since we already have an edge to NewCaller, simply move the ids
// onto it, and remove the existing Edge.
- ExistingEdgeToNewCaller->getContextIds().insert(
- Edge->getContextIds().begin(), Edge->getContextIds().end());
+ ExistingEdgeToNewCaller->getContextIds().insert_range(
+ Edge->getContextIds());
ExistingEdgeToNewCaller->AllocTypes |= Edge->AllocTypes;
Edge->ContextIds.clear();
Edge->AllocTypes = (uint8_t)AllocationType::None;
@@ -3465,8 +3460,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
// edge, this may not hold true when recursive handling enabled.
assert(IsNewNode || ExistingCallerEdge || AllowRecursiveCallsites);
if (ExistingCallerEdge) {
- ExistingCallerEdge->getContextIds().insert(EdgeContextIdsToMove.begin(),
- EdgeContextIdsToMove.end());
+ ExistingCallerEdge->getContextIds().insert_range(EdgeContextIdsToMove);
ExistingCallerEdge->AllocTypes |=
computeAllocType(EdgeContextIdsToMove);
continue;
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index c463cda68d4b5..924db314674d5 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -321,7 +321,7 @@ bool MergeFunctionsPass::runOnModule(Module &M) {
SmallVector<GlobalValue *, 4> UsedV;
collectUsedGlobalVariables(M, UsedV, /*CompilerUsed=*/false);
collectUsedGlobalVariables(M, UsedV, /*CompilerUsed=*/true);
- MF.getUsed().insert(UsedV.begin(), UsedV.end());
+ MF.getUsed().insert_range(UsedV);
return MF.run(M);
}
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index 95c42f2b9bd45..29bf214a5c9e7 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -675,7 +675,7 @@ struct BooleanStateWithSetVector : public BooleanState {
/// "Clamp" this state with \p RHS.
BooleanStateWithSetVector &operator^=(const BooleanStateWithSetVector &RHS) {
BooleanState::operator^=(RHS);
- Set.insert(RHS.Set.begin(), RHS.Set.end());
+ Set.insert_range(RHS.Set);
return *this;
}
diff --git a/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp b/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
index a614e2d169534..e15aa0472088c 100644
--- a/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
@@ -199,8 +199,7 @@ void SampleProfileProber::computeBlocksToIgnore(
computeEHOnlyBlocks(*F, BlocksAndCallsToIgnore);
findUnreachableBlocks(BlocksAndCallsToIgnore);
- BlocksToIgnore.insert(BlocksAndCallsToIgnore.begin(),
- BlocksAndCallsToIgnore.end());
+ BlocksToIgnore.insert_range(BlocksAndCallsToIgnore);
// Handle the call-to-invoke conversion case: make sure that the probe id and
// callsite id are consistent before and after the block split. For block
diff --git a/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp b/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp
index 0e49984c6ee33..c068d70b3a458 100644
--- a/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp
+++ b/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp
@@ -239,10 +239,10 @@ void BlockCoverageInference::getReachableAvoiding(const BasicBlock &Start,
Visited.insert(&Avoid);
if (IsForward) {
auto Range = depth_first_ext(&Start, Visited);
- Reachable.insert(Range.begin(), Range.end());
+ Reachable.insert_range(Range);
} else {
auto Range = inverse_depth_first_ext(&Start, Visited);
- Reachable.insert(Range.begin(), Range.end());
+ Reachable.insert_range(Range);
}
}
diff --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
index 5d5cbf93c870d..0b35ff82478e3 100644
--- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
@@ -562,7 +562,7 @@ checkHoistValue(Value *V, Instruction *InsertPoint, DominatorTree &DT,
if (AllOpsHoisted) {
CHR_DEBUG(dbgs() << "checkHoistValue " << *I << "\n");
if (HoistStops)
- HoistStops->insert(OpsHoistStops.begin(), OpsHoistStops.end());
+ HoistStops->insert_range(OpsHoistStops);
Visited[I] = true;
return true;
}
@@ -1176,8 +1176,7 @@ SmallVector<CHRScope *, 8> CHR::splitScope(
// point. Union the bases.
PrevSplitFromOuter = false;
PrevConditionValues = *OuterConditionValues;
- PrevConditionValues.insert(ConditionValues.begin(),
- ConditionValues.end());
+ PrevConditionValues.insert_range(ConditionValues);
PrevInsertPoint = OuterInsertPoint;
}
} else {
@@ -1209,7 +1208,7 @@ SmallVector<CHRScope *, 8> CHR::splitScope(
});
} else {
// Not splitting. Union the bases. Keep the hoist point.
- PrevConditionValues.insert(ConditionValues.begin(), ConditionValues.end());
+ PrevConditionValues.insert_range(ConditionValues);
}
}
}
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
index 66a9f7c43d3fe..c5932f0d65ee1 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
@@ -440,7 +440,7 @@ bool SanitizerBinaryMetadata::runOn(Instruction &I, MetadataInfoSet &MIS,
// Attach MD_pcsections to instruction.
if (!InstMetadata.empty()) {
- MIS.insert(InstMetadata.begin(), InstMetadata.end());
+ MIS.insert_range(InstMetadata);
SmallVector<MDBuilder::PCSection, 1> Sections;
for (const auto &MI : InstMetadata)
Sections.push_back({getSectionName(MI->SectionSuffix), {}});
diff --git a/llvm/lib/Transforms/ObjCARC/PtrState.cpp b/llvm/lib/Transforms/ObjCARC/PtrState.cpp
index e9b2dbeb62e60..3af238996fa76 100644
--- a/llvm/lib/Transforms/ObjCARC/PtrState.cpp
+++ b/llvm/lib/Transforms/ObjCARC/PtrState.cpp
@@ -107,7 +107,7 @@ bool RRInfo::Merge(const RRInfo &Other) {
CFGHazardAfflicted |= Other.CFGHazardAfflicted;
// Merge the call sets.
- Calls.insert(Other.Calls.begin(), Other.Calls.end());
+ Calls.insert_range(Other.Calls);
// Merge the insert point sets. If there are any differences,
// that makes this a partial merge.
diff --git a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
index 8cc8e713941b1..40c4c15b7120b 100644
--- a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -248,7 +248,7 @@ static void findBestInsertionSet(DominatorTree &DT, BlockFrequencyInfo &BFI,
continue;
// Add nodes on the Path into Candidates.
- Candidates.insert(Path.begin(), Path.end());
+ Candidates.insert_range(Path);
}
// Sort the nodes in Candidates in top-down order and save the nodes
@@ -283,7 +283,7 @@ static void findBestInsertionSet(DominatorTree &DT, BlockFrequencyInfo &BFI,
(InsertPtsFreq == BFI.getBlockFreq(Node) && InsertPts.size() > 1))
BBs.insert(Entry);
else
- BBs.insert(InsertPts.begin(), InsertPts.end());
+ BBs.insert_range(InsertPts);
break;
}
@@ -304,7 +304,7 @@ static void findBestInsertionSet(DominatorTree &DT, BlockFrequencyInfo &BFI,
ParentInsertPts.insert(Node);
ParentPtsFreq += BFI.getBlockFreq(Node);
} else {
- ParentInsertPts.insert(InsertPts.begin(), InsertPts.end());
+ ParentInsertPts.insert_range(InsertPts);
ParentPtsFreq += InsertPtsFreq;
}
}
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 85fcdd95f5d87..b41899a2dff66 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -3194,7 +3194,7 @@ void GVNPass::addDeadBlock(BasicBlock *BB) {
// All blocks dominated by D are dead.
SmallVector<BasicBlock *, 8> Dom;
DT->getDescendants(D, Dom);
- DeadBlocks.insert(Dom.begin(), Dom.end());
+ DeadBlocks.insert_range(Dom);
// Figure out the dominance-frontier(D).
for (BasicBlock *B : Dom) {
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 5b180c2390bfa..5d9a5f90af186 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -663,7 +663,7 @@ GVNSink::analyzeInstructionForSinking(LockstepReverseIterator<false> &LRI,
// values.
PHIContents.clear();
for (auto &PHI : NeededPHIs)
- PHIContents.insert(PHI.getValues().begin(), PHI.getValues().end());
+ PHIContents.insert_range(PHI.getValues());
}
// Is this instruction required by a later PHI that doesn't match this PHI?
@@ -705,7 +705,7 @@ GVNSink::analyzeInstructionForSinking(LockstepReverseIterator<false> &LRI,
NeededPHIs.reserve(NeededPHIs.size());
NeededPHIs.insert(PHI);
- PHIContents.insert(PHI.getValues().begin(), PHI.getValues().end());
+ PHIContents.insert_range(PHI.getValues());
}
if (isMemoryInst(NewInsts[0]))
diff --git a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp
index 92fd269f7557e..efbd1b89aca8f 100644
--- a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp
@@ -143,7 +143,7 @@ class InstPartition {
/// Moves this partition into \p Other. This partition becomes empty
/// after this.
void moveTo(InstPartition &Other) {
- Other.Set.insert(Set.begin(), Set.end());
+ Other.Set.insert_range(Set);
Set.clear();
Other.DepCycle |= DepCycle;
}
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 2462ec33e0c20..8dc7f325f6262 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -719,7 +719,7 @@ bool LoopIdiomRecognize::processLoopStores(SmallVectorImpl<StoreInst *> &SL,
MaybeAlign(HeadStore->getAlign()), StoredVal,
HeadStore, AdjacentStores, StoreEv, BECount,
IsNegStride)) {
- TransformedStores.insert(AdjacentStores.begin(), AdjacentStores.end());
+ TransformedStores.insert_range(AdjacentStores);
Changed = true;
}
}
diff --git a/llvm/lib/Transforms/Scalar/LoopSink.cpp b/llvm/lib/Transforms/Scalar/LoopSink.cpp
index 7f0c974ac4c5a..b9fde4c6a3b76 100644
--- a/llvm/lib/Transforms/Scalar/LoopSink.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSink.cpp
@@ -120,7 +120,7 @@ findBBsToSinkInto(const Loop &L, const SmallPtrSetImpl<BasicBlock *> &UseBBs,
if (UseBBs.size() == 0)
return BBsToSinkInto;
- BBsToSinkInto.insert(UseBBs.begin(), UseBBs.end());
+ BBsToSinkInto.insert_range(UseBBs);
SmallPtrSet<BasicBlock *, 2> BBsDominatedByColdestBB;
// For every iteration:
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 2c3d64b0e07d9..ed3709b74d60f 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1738,7 +1738,7 @@ bool LSRUse::InsertFormula(const Formula &F, const Loop &L) {
Formulae.push_back(F);
// Record registers now being used by this use.
- Regs.insert(F.BaseRegs.begin(), F.BaseRegs.end());
+ Regs.insert_range(F.BaseRegs);
if (F.ScaledReg)
Regs.insert(F.ScaledReg);
@@ -1759,7 +1759,7 @@ void LSRUse::RecomputeRegs(size_t LUIdx, RegUseTracker &RegUses) {
Regs.clear();
for (const Formula &F : Formulae) {
if (F.ScaledReg) Regs.insert(F.ScaledReg);
- Regs.insert(F.BaseRegs.begin(), F.BaseRegs.end());
+ Regs.insert_range(F.BaseRegs);
}
// Update the RegTracker.
...
[truncated]
|
@llvm/pr-subscribers-compiler-rt-sanitizer 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. Patch is 31.78 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/132056.diff 29 Files Affected:
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index c29a5e53b82ea..9ab0ff58bb5ba 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -583,9 +583,9 @@ static bool getPotentialCopiesOfMemoryValue(
UsedAssumedInformation = true;
A.recordDependence(*PI, QueryingAA, DepClassTy::OPTIONAL);
}
- PotentialCopies.insert(NewCopies.begin(), NewCopies.end());
+ PotentialCopies.insert_range(NewCopies);
if (PotentialValueOrigins)
- PotentialValueOrigins->insert(NewCopyOrigins.begin(), NewCopyOrigins.end());
+ PotentialValueOrigins->insert_range(NewCopyOrigins);
return true;
}
@@ -2123,7 +2123,7 @@ void Attributor::runTillFixpoint() {
SmallVector<AbstractAttribute *, 32> ChangedAAs;
SetVector<AbstractAttribute *> Worklist, InvalidAAs;
- Worklist.insert(DG.SyntheticRoot.begin(), DG.SyntheticRoot.end());
+ Worklist.insert_range(DG.SyntheticRoot);
do {
// Remember the size to determine new attributes.
@@ -2200,9 +2200,8 @@ void Attributor::runTillFixpoint() {
// Reset the work list and repopulate with the changed abstract attributes.
// Note that dependent ones are added above.
Worklist.clear();
- Worklist.insert(ChangedAAs.begin(), ChangedAAs.end());
- Worklist.insert(QueryAAsAwaitingUpdate.begin(),
- QueryAAsAwaitingUpdate.end());
+ Worklist.insert_range(ChangedAAs);
+ Worklist.insert_range(QueryAAsAwaitingUpdate);
QueryAAsAwaitingUpdate.clear();
} while (!Worklist.empty() && (IterationCounter++ < MaxIterations));
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 4b7902ff502d3..cb794adaba79a 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -3735,7 +3735,7 @@ struct AAIntraFnReachabilityFunction final
}
}
- DeadEdges.insert(LocalDeadEdges.begin(), LocalDeadEdges.end());
+ DeadEdges.insert_range(LocalDeadEdges);
return rememberResult(A, RQITy::Reachable::No, RQI, UsedExclusionSet,
IsTemporaryRQI);
}
@@ -12221,8 +12221,7 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo {
} else if (A.isClosedWorldModule()) {
ArrayRef<Function *> IndirectlyCallableFunctions =
A.getInfoCache().getIndirectlyCallableFunctions(A);
- PotentialCallees.insert(IndirectlyCallableFunctions.begin(),
- IndirectlyCallableFunctions.end());
+ PotentialCallees.insert_range(IndirectlyCallableFunctions);
}
if (PotentialCallees.empty())
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp
index 29a1283d9ab21..4a36f49bcbf4b 100644
--- a/llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -1239,7 +1239,7 @@ void llvm::ComputeCrossModuleImport(
else
++EI;
}
- ELI.second.insert(NewExports.begin(), NewExports.end());
+ ELI.second.insert_range(NewExports);
}
assert(checkVariableImport(Index, ImportLists, ExportLists));
diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
index 250c0443cb4af..45fb1f5212b70 100644
--- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
@@ -73,7 +73,7 @@ void GlobalDCEPass::ComputeDependencies(Value *V,
for (User *CEUser : CE->users())
ComputeDependencies(CEUser, LocalDeps);
}
- Deps.insert(LocalDeps.begin(), LocalDeps.end());
+ Deps.insert_range(LocalDeps);
}
}
diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
index 4ac004b51dd42..4b3f0e23903aa 100644
--- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
+++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp
@@ -733,7 +733,7 @@ bool HotColdSplitting::outlineColdRegions(Function &F, bool HasProfileSummary) {
none_of(SubRegion, [&](BasicBlock *Block) {
return ColdBlocks.contains(Block);
})) {
- ColdBlocks.insert(SubRegion.begin(), SubRegion.end());
+ ColdBlocks.insert_range(SubRegion);
LLVM_DEBUG({
for (auto *Block : SubRegion)
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index dee2a1b676cd8..f5ae204426170 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -360,8 +360,7 @@ class CallsiteContextGraph {
? CallerEdges
: std::vector<std::shared_ptr<ContextEdge>>());
for (const auto &Edge : Edges)
- ContextIds.insert(Edge->getContextIds().begin(),
- Edge->getContextIds().end());
+ ContextIds.insert_range(Edge->getContextIds());
return ContextIds;
}
@@ -1372,7 +1371,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
for (auto Id : ContextIds)
if (auto NewId = OldToNewContextIds.find(Id);
NewId != OldToNewContextIds.end())
- NewIds.insert(NewId->second.begin(), NewId->second.end());
+ NewIds.insert_range(NewId->second);
return NewIds;
};
@@ -1389,7 +1388,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
// Only need to recursively iterate to NextNode via this caller edge if
// it resulted in any added ids to NextNode.
if (!NewIdsToAdd.empty()) {
- Edge->getContextIds().insert(NewIdsToAdd.begin(), NewIdsToAdd.end());
+ Edge->getContextIds().insert_range(NewIdsToAdd);
UpdateCallers(NextNode, Visited, UpdateCallers);
}
}
@@ -2534,8 +2533,7 @@ bool CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::calleesMatch(
// If there is already an edge between these nodes, simply update it and
// return.
if (CurEdge) {
- CurEdge->ContextIds.insert(Edge->ContextIds.begin(),
- Edge->ContextIds.end());
+ CurEdge->ContextIds.insert_range(Edge->ContextIds);
CurEdge->AllocTypes |= Edge->AllocTypes;
return;
}
@@ -3281,8 +3279,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
if (ExistingEdgeToNewCallee) {
// Since we already have an edge to NewCallee, simply move the ids
// onto it, and remove the existing Edge.
- ExistingEdgeToNewCallee->getContextIds().insert(ContextIdsToMove.begin(),
- ContextIdsToMove.end());
+ ExistingEdgeToNewCallee->getContextIds().insert_range(ContextIdsToMove);
ExistingEdgeToNewCallee->AllocTypes |= Edge->AllocTypes;
assert(Edge->ContextIds == ContextIdsToMove);
removeEdgeFromGraph(Edge.get());
@@ -3302,8 +3299,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
if (ExistingEdgeToNewCallee) {
// Since we already have an edge to NewCallee, simply move the ids
// onto it.
- ExistingEdgeToNewCallee->getContextIds().insert(ContextIdsToMove.begin(),
- ContextIdsToMove.end());
+ ExistingEdgeToNewCallee->getContextIds().insert_range(ContextIdsToMove);
ExistingEdgeToNewCallee->AllocTypes |= CallerEdgeAllocType;
} else {
// Otherwise, create a new edge to NewCallee for the ids being moved.
@@ -3350,8 +3346,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
// removed none type edges after creating the clone. If we can't find
// a corresponding edge there, fall through to the cloning below.
if (auto *NewCalleeEdge = NewCallee->findEdgeFromCallee(CalleeToUse)) {
- NewCalleeEdge->getContextIds().insert(EdgeContextIdsToMove.begin(),
- EdgeContextIdsToMove.end());
+ NewCalleeEdge->getContextIds().insert_range(EdgeContextIdsToMove);
NewCalleeEdge->AllocTypes |= computeAllocType(EdgeContextIdsToMove);
continue;
}
@@ -3402,8 +3397,8 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
if (ExistingEdgeToNewCaller) {
// Since we already have an edge to NewCaller, simply move the ids
// onto it, and remove the existing Edge.
- ExistingEdgeToNewCaller->getContextIds().insert(
- Edge->getContextIds().begin(), Edge->getContextIds().end());
+ ExistingEdgeToNewCaller->getContextIds().insert_range(
+ Edge->getContextIds());
ExistingEdgeToNewCaller->AllocTypes |= Edge->AllocTypes;
Edge->ContextIds.clear();
Edge->AllocTypes = (uint8_t)AllocationType::None;
@@ -3465,8 +3460,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
// edge, this may not hold true when recursive handling enabled.
assert(IsNewNode || ExistingCallerEdge || AllowRecursiveCallsites);
if (ExistingCallerEdge) {
- ExistingCallerEdge->getContextIds().insert(EdgeContextIdsToMove.begin(),
- EdgeContextIdsToMove.end());
+ ExistingCallerEdge->getContextIds().insert_range(EdgeContextIdsToMove);
ExistingCallerEdge->AllocTypes |=
computeAllocType(EdgeContextIdsToMove);
continue;
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index c463cda68d4b5..924db314674d5 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -321,7 +321,7 @@ bool MergeFunctionsPass::runOnModule(Module &M) {
SmallVector<GlobalValue *, 4> UsedV;
collectUsedGlobalVariables(M, UsedV, /*CompilerUsed=*/false);
collectUsedGlobalVariables(M, UsedV, /*CompilerUsed=*/true);
- MF.getUsed().insert(UsedV.begin(), UsedV.end());
+ MF.getUsed().insert_range(UsedV);
return MF.run(M);
}
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index 95c42f2b9bd45..29bf214a5c9e7 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -675,7 +675,7 @@ struct BooleanStateWithSetVector : public BooleanState {
/// "Clamp" this state with \p RHS.
BooleanStateWithSetVector &operator^=(const BooleanStateWithSetVector &RHS) {
BooleanState::operator^=(RHS);
- Set.insert(RHS.Set.begin(), RHS.Set.end());
+ Set.insert_range(RHS.Set);
return *this;
}
diff --git a/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp b/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
index a614e2d169534..e15aa0472088c 100644
--- a/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
@@ -199,8 +199,7 @@ void SampleProfileProber::computeBlocksToIgnore(
computeEHOnlyBlocks(*F, BlocksAndCallsToIgnore);
findUnreachableBlocks(BlocksAndCallsToIgnore);
- BlocksToIgnore.insert(BlocksAndCallsToIgnore.begin(),
- BlocksAndCallsToIgnore.end());
+ BlocksToIgnore.insert_range(BlocksAndCallsToIgnore);
// Handle the call-to-invoke conversion case: make sure that the probe id and
// callsite id are consistent before and after the block split. For block
diff --git a/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp b/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp
index 0e49984c6ee33..c068d70b3a458 100644
--- a/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp
+++ b/llvm/lib/Transforms/Instrumentation/BlockCoverageInference.cpp
@@ -239,10 +239,10 @@ void BlockCoverageInference::getReachableAvoiding(const BasicBlock &Start,
Visited.insert(&Avoid);
if (IsForward) {
auto Range = depth_first_ext(&Start, Visited);
- Reachable.insert(Range.begin(), Range.end());
+ Reachable.insert_range(Range);
} else {
auto Range = inverse_depth_first_ext(&Start, Visited);
- Reachable.insert(Range.begin(), Range.end());
+ Reachable.insert_range(Range);
}
}
diff --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
index 5d5cbf93c870d..0b35ff82478e3 100644
--- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
@@ -562,7 +562,7 @@ checkHoistValue(Value *V, Instruction *InsertPoint, DominatorTree &DT,
if (AllOpsHoisted) {
CHR_DEBUG(dbgs() << "checkHoistValue " << *I << "\n");
if (HoistStops)
- HoistStops->insert(OpsHoistStops.begin(), OpsHoistStops.end());
+ HoistStops->insert_range(OpsHoistStops);
Visited[I] = true;
return true;
}
@@ -1176,8 +1176,7 @@ SmallVector<CHRScope *, 8> CHR::splitScope(
// point. Union the bases.
PrevSplitFromOuter = false;
PrevConditionValues = *OuterConditionValues;
- PrevConditionValues.insert(ConditionValues.begin(),
- ConditionValues.end());
+ PrevConditionValues.insert_range(ConditionValues);
PrevInsertPoint = OuterInsertPoint;
}
} else {
@@ -1209,7 +1208,7 @@ SmallVector<CHRScope *, 8> CHR::splitScope(
});
} else {
// Not splitting. Union the bases. Keep the hoist point.
- PrevConditionValues.insert(ConditionValues.begin(), ConditionValues.end());
+ PrevConditionValues.insert_range(ConditionValues);
}
}
}
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
index 66a9f7c43d3fe..c5932f0d65ee1 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
@@ -440,7 +440,7 @@ bool SanitizerBinaryMetadata::runOn(Instruction &I, MetadataInfoSet &MIS,
// Attach MD_pcsections to instruction.
if (!InstMetadata.empty()) {
- MIS.insert(InstMetadata.begin(), InstMetadata.end());
+ MIS.insert_range(InstMetadata);
SmallVector<MDBuilder::PCSection, 1> Sections;
for (const auto &MI : InstMetadata)
Sections.push_back({getSectionName(MI->SectionSuffix), {}});
diff --git a/llvm/lib/Transforms/ObjCARC/PtrState.cpp b/llvm/lib/Transforms/ObjCARC/PtrState.cpp
index e9b2dbeb62e60..3af238996fa76 100644
--- a/llvm/lib/Transforms/ObjCARC/PtrState.cpp
+++ b/llvm/lib/Transforms/ObjCARC/PtrState.cpp
@@ -107,7 +107,7 @@ bool RRInfo::Merge(const RRInfo &Other) {
CFGHazardAfflicted |= Other.CFGHazardAfflicted;
// Merge the call sets.
- Calls.insert(Other.Calls.begin(), Other.Calls.end());
+ Calls.insert_range(Other.Calls);
// Merge the insert point sets. If there are any differences,
// that makes this a partial merge.
diff --git a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
index 8cc8e713941b1..40c4c15b7120b 100644
--- a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -248,7 +248,7 @@ static void findBestInsertionSet(DominatorTree &DT, BlockFrequencyInfo &BFI,
continue;
// Add nodes on the Path into Candidates.
- Candidates.insert(Path.begin(), Path.end());
+ Candidates.insert_range(Path);
}
// Sort the nodes in Candidates in top-down order and save the nodes
@@ -283,7 +283,7 @@ static void findBestInsertionSet(DominatorTree &DT, BlockFrequencyInfo &BFI,
(InsertPtsFreq == BFI.getBlockFreq(Node) && InsertPts.size() > 1))
BBs.insert(Entry);
else
- BBs.insert(InsertPts.begin(), InsertPts.end());
+ BBs.insert_range(InsertPts);
break;
}
@@ -304,7 +304,7 @@ static void findBestInsertionSet(DominatorTree &DT, BlockFrequencyInfo &BFI,
ParentInsertPts.insert(Node);
ParentPtsFreq += BFI.getBlockFreq(Node);
} else {
- ParentInsertPts.insert(InsertPts.begin(), InsertPts.end());
+ ParentInsertPts.insert_range(InsertPts);
ParentPtsFreq += InsertPtsFreq;
}
}
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 85fcdd95f5d87..b41899a2dff66 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -3194,7 +3194,7 @@ void GVNPass::addDeadBlock(BasicBlock *BB) {
// All blocks dominated by D are dead.
SmallVector<BasicBlock *, 8> Dom;
DT->getDescendants(D, Dom);
- DeadBlocks.insert(Dom.begin(), Dom.end());
+ DeadBlocks.insert_range(Dom);
// Figure out the dominance-frontier(D).
for (BasicBlock *B : Dom) {
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 5b180c2390bfa..5d9a5f90af186 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -663,7 +663,7 @@ GVNSink::analyzeInstructionForSinking(LockstepReverseIterator<false> &LRI,
// values.
PHIContents.clear();
for (auto &PHI : NeededPHIs)
- PHIContents.insert(PHI.getValues().begin(), PHI.getValues().end());
+ PHIContents.insert_range(PHI.getValues());
}
// Is this instruction required by a later PHI that doesn't match this PHI?
@@ -705,7 +705,7 @@ GVNSink::analyzeInstructionForSinking(LockstepReverseIterator<false> &LRI,
NeededPHIs.reserve(NeededPHIs.size());
NeededPHIs.insert(PHI);
- PHIContents.insert(PHI.getValues().begin(), PHI.getValues().end());
+ PHIContents.insert_range(PHI.getValues());
}
if (isMemoryInst(NewInsts[0]))
diff --git a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp
index 92fd269f7557e..efbd1b89aca8f 100644
--- a/llvm/lib/Transforms/Scalar/LoopDistribute.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopDistribute.cpp
@@ -143,7 +143,7 @@ class InstPartition {
/// Moves this partition into \p Other. This partition becomes empty
/// after this.
void moveTo(InstPartition &Other) {
- Other.Set.insert(Set.begin(), Set.end());
+ Other.Set.insert_range(Set);
Set.clear();
Other.DepCycle |= DepCycle;
}
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 2462ec33e0c20..8dc7f325f6262 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -719,7 +719,7 @@ bool LoopIdiomRecognize::processLoopStores(SmallVectorImpl<StoreInst *> &SL,
MaybeAlign(HeadStore->getAlign()), StoredVal,
HeadStore, AdjacentStores, StoreEv, BECount,
IsNegStride)) {
- TransformedStores.insert(AdjacentStores.begin(), AdjacentStores.end());
+ TransformedStores.insert_range(AdjacentStores);
Changed = true;
}
}
diff --git a/llvm/lib/Transforms/Scalar/LoopSink.cpp b/llvm/lib/Transforms/Scalar/LoopSink.cpp
index 7f0c974ac4c5a..b9fde4c6a3b76 100644
--- a/llvm/lib/Transforms/Scalar/LoopSink.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopSink.cpp
@@ -120,7 +120,7 @@ findBBsToSinkInto(const Loop &L, const SmallPtrSetImpl<BasicBlock *> &UseBBs,
if (UseBBs.size() == 0)
return BBsToSinkInto;
- BBsToSinkInto.insert(UseBBs.begin(), UseBBs.end());
+ BBsToSinkInto.insert_range(UseBBs);
SmallPtrSet<BasicBlock *, 2> BBsDominatedByColdestBB;
// For every iteration:
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 2c3d64b0e07d9..ed3709b74d60f 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1738,7 +1738,7 @@ bool LSRUse::InsertFormula(const Formula &F, const Loop &L) {
Formulae.push_back(F);
// Record registers now being used by this use.
- Regs.insert(F.BaseRegs.begin(), F.BaseRegs.end());
+ Regs.insert_range(F.BaseRegs);
if (F.ScaledReg)
Regs.insert(F.ScaledReg);
@@ -1759,7 +1759,7 @@ void LSRUse::RecomputeRegs(size_t LUIdx, RegUseTracker &RegUses) {
Regs.clear();
for (const Formula &F : Formulae) {
if (F.ScaledReg) Regs.insert(F.ScaledReg);
- Regs.insert(F.BaseRegs.begin(), F.BaseRegs.end());
+ Regs.insert_range(F.BaseRegs);
}
// Update the RegTracker.
...
[truncated]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
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.