Skip to content

Commit d4427f3

Browse files
[llvm] Use range constructors of *Set (NFC) (#133549)
1 parent b33cc64 commit d4427f3

File tree

16 files changed

+20
-20
lines changed

16 files changed

+20
-20
lines changed

llvm/include/llvm/Support/GenericDomTreeConstruction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ struct SemiNCAInfo {
697697
const SmallVectorImpl<NodePtr> &B) {
698698
if (A.size() != B.size())
699699
return false;
700-
SmallPtrSet<NodePtr, 4> Set(A.begin(), A.end());
700+
SmallPtrSet<NodePtr, 4> Set(llvm::from_range, A);
701701
for (NodePtr N : B)
702702
if (Set.count(N) == 0)
703703
return false;

llvm/include/llvm/Transforms/Utils/FunctionImportUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class FunctionImportGlobalProcessing {
116116
collectUsedGlobalVariables(M, Vec, /*CompilerUsed=*/false);
117117
// Next collect those in the llvm.compiler.used set.
118118
collectUsedGlobalVariables(M, Vec, /*CompilerUsed=*/true);
119-
Used = {Vec.begin(), Vec.end()};
119+
Used = {llvm::from_range, Vec};
120120
#endif
121121
}
122122

llvm/lib/Analysis/DependenceGraphBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ template <class G> void AbstractDependenceGraphBuilder<G>::createPiBlocks() {
131131

132132
// Build a set to speed up the lookup for edges whose targets
133133
// are inside the SCC.
134-
SmallPtrSet<NodeType *, 4> NodesInSCC(NL.begin(), NL.end());
134+
SmallPtrSet<NodeType *, 4> NodesInSCC(llvm::from_range, NL);
135135

136136
// We have the set of nodes in the SCC. We go through the set of nodes
137137
// that are outside of the SCC and look for edges that cross the two sets.

llvm/lib/Analysis/LazyCallGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ LazyCallGraph::RefSCC::insertIncomingRefEdge(Node &SourceN, Node &TargetN) {
10841084

10851085
// Build a set, so we can do fast tests for whether a RefSCC will end up as
10861086
// part of the merged RefSCC.
1087-
SmallPtrSet<RefSCC *, 16> MergeSet(MergeRange.begin(), MergeRange.end());
1087+
SmallPtrSet<RefSCC *, 16> MergeSet(llvm::from_range, MergeRange);
10881088

10891089
// This RefSCC will always be part of that set, so just insert it here.
10901090
MergeSet.insert(this);

llvm/lib/Analysis/MemorySSAUpdater.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,8 +1083,8 @@ void MemorySSAUpdater::applyInsertUpdates(ArrayRef<CFGUpdate> Updates,
10831083
SmallVector<BasicBlock *, 32> IDFBlocks;
10841084
if (!BlocksToProcess.empty()) {
10851085
ForwardIDFCalculator IDFs(DT, GD);
1086-
SmallPtrSet<BasicBlock *, 16> DefiningBlocks(BlocksToProcess.begin(),
1087-
BlocksToProcess.end());
1086+
SmallPtrSet<BasicBlock *, 16> DefiningBlocks(llvm::from_range,
1087+
BlocksToProcess);
10881088
IDFs.setDefiningBlocks(DefiningBlocks);
10891089
IDFs.calculate(IDFBlocks);
10901090

@@ -1265,7 +1265,7 @@ void MemorySSAUpdater::wireOldPredecessorsToNewImmediatePredecessor(
12651265
assert(!Preds.empty() && "Must be moving at least one predecessor to the "
12661266
"new immediate predecessor.");
12671267
MemoryPhi *NewPhi = MSSA->createMemoryPhi(New);
1268-
SmallPtrSet<BasicBlock *, 16> PredsSet(Preds.begin(), Preds.end());
1268+
SmallPtrSet<BasicBlock *, 16> PredsSet(llvm::from_range, Preds);
12691269
// Currently only support the case of removing a single incoming edge when
12701270
// identical edges were not merged.
12711271
if (!IdenticalEdgesWereMerged)

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14217,7 +14217,7 @@ void ScalarEvolution::forgetBackedgeTakenCounts(const Loop *L,
1421714217
}
1421814218

1421914219
void ScalarEvolution::forgetMemoizedResults(ArrayRef<const SCEV *> SCEVs) {
14220-
SmallPtrSet<const SCEV *, 8> ToForget(SCEVs.begin(), SCEVs.end());
14220+
SmallPtrSet<const SCEV *, 8> ToForget(llvm::from_range, SCEVs);
1422114221
SmallVector<const SCEV *, 8> Worklist(ToForget.begin(), ToForget.end());
1422214222

1422314223
while (!Worklist.empty()) {

llvm/lib/CodeGen/RDFGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ void DataFlowGraph::recordDefsForDF(BlockRefsMap &PhiM,
14151415

14161416
// Calculate the iterated dominance frontier of BB.
14171417
const MachineDominanceFrontier::DomSetType &DF = DFLoc->second;
1418-
SetVector<MachineBasicBlock *> IDF(DF.begin(), DF.end());
1418+
SetVector<MachineBasicBlock *> IDF(llvm::from_range, DF);
14191419
for (unsigned i = 0; i < IDF.size(); ++i) {
14201420
auto F = MDF.find(IDF[i]);
14211421
if (F != MDF.end())

llvm/lib/CodeGen/RDFLiveness.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ void Liveness::computeLiveIns() {
759759
auto F1 = MDF.find(&B);
760760
if (F1 == MDF.end())
761761
continue;
762-
SetVector<MachineBasicBlock *> IDFB(F1->second.begin(), F1->second.end());
762+
SetVector<MachineBasicBlock *> IDFB(llvm::from_range, F1->second);
763763
for (unsigned i = 0; i < IDFB.size(); ++i) {
764764
auto F2 = MDF.find(IDFB[i]);
765765
if (F2 != MDF.end())

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4864,7 +4864,7 @@ static void redirectAllPredecessorsTo(BasicBlock *OldTarget,
48644864
/// Determine which blocks in \p BBs are reachable from outside and remove the
48654865
/// ones that are not reachable from the function.
48664866
static void removeUnusedBlocksFromParent(ArrayRef<BasicBlock *> BBs) {
4867-
SmallPtrSet<BasicBlock *, 6> BBsToErase{BBs.begin(), BBs.end()};
4867+
SmallPtrSet<BasicBlock *, 6> BBsToErase(llvm::from_range, BBs);
48684868
auto HasRemainingUses = [&BBsToErase](BasicBlock *BB) {
48694869
for (Use &U : BB->uses()) {
48704870
auto *UseInst = dyn_cast<Instruction>(U.getUser());

llvm/lib/IR/DIBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ DIBuilder::DIBuilder(Module &m, bool AllowUnresolvedNodes, DICompileUnit *CU)
3838
if (const auto &IMs = CUNode->getImportedEntities())
3939
ImportedModules.assign(IMs.begin(), IMs.end());
4040
if (const auto &MNs = CUNode->getMacros())
41-
AllMacrosPerParent.insert({nullptr, {MNs.begin(), MNs.end()}});
41+
AllMacrosPerParent.insert({nullptr, {llvm::from_range, MNs}});
4242
}
4343
}
4444

0 commit comments

Comments
 (0)