Skip to content

Commit eba3734

Browse files
[polly] Use *Set::insert_range (NFC) (#133609)
1 parent c6d0e04 commit eba3734

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

polly/lib/Analysis/ScopBuilder.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2633,8 +2633,7 @@ void ScopBuilder::checkForReductions(ScopStmt &Stmt) {
26332633
if (auto *Ptr = dyn_cast<Instruction>(Load->getPointerOperand())) {
26342634
const auto &It = State.find(Ptr);
26352635
if (It != State.end())
2636-
for (const auto &FlowInSetElem : It->second)
2637-
InvalidLoads.insert(FlowInSetElem.first);
2636+
InvalidLoads.insert_range(llvm::make_first_range(It->second));
26382637
}
26392638

26402639
// If this load is used outside this stmt, invalidate it.
@@ -2654,8 +2653,7 @@ void ScopBuilder::checkForReductions(ScopStmt &Stmt) {
26542653
dyn_cast<Instruction>(Store->getPointerOperand())) {
26552654
const auto &It = State.find(Ptr);
26562655
if (It != State.end())
2657-
for (const auto &FlowInSetElem : It->second)
2658-
InvalidLoads.insert(FlowInSetElem.first);
2656+
InvalidLoads.insert_range(llvm::make_first_range(It->second));
26592657
}
26602658

26612659
// Propagate the uses of the value operand to the store
@@ -2710,8 +2708,7 @@ void ScopBuilder::checkForReductions(ScopStmt &Stmt) {
27102708
// If this operation is used outside the stmt, invalidate all the loads
27112709
// which feed into it.
27122710
if (UsedOutsideStmt)
2713-
for (const auto &FlowInSetElem : InstInFlowSet)
2714-
InvalidLoads.insert(FlowInSetElem.first);
2711+
InvalidLoads.insert_range(llvm::make_first_range(InstInFlowSet));
27152712
}
27162713
}
27172714

polly/lib/Analysis/ScopDetection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ bool ScopDetection::onlyValidRequiredInvariantLoads(
500500
}
501501
}
502502

503-
Context.RequiredILS.insert(RequiredILS.begin(), RequiredILS.end());
503+
Context.RequiredILS.insert_range(RequiredILS);
504504

505505
return true;
506506
}

polly/lib/CodeGen/IslNodeBuilder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ void IslNodeBuilder::getReferencesInSubtree(const isl::ast_node &For,
325325
SubtreeReferences References = {
326326
LI, SE, S, ValueMap, Values, SCEVs, getBlockGenerator(), nullptr};
327327

328-
for (const auto &I : IDToValue)
329-
Values.insert(I.second);
328+
Values.insert_range(llvm::make_second_range(IDToValue));
330329

331330
// NOTE: this is populated in IslNodeBuilder::addParameters
332331
for (const auto &I : OutsideLoopIterations)

polly/lib/Support/SCEVValidator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class ValidatorResult final {
8383

8484
/// Add the parameters of Source to this result.
8585
void addParamsFrom(const ValidatorResult &Source) {
86-
Parameters.insert(Source.Parameters.begin(), Source.Parameters.end());
86+
Parameters.insert_range(Source.Parameters);
8787
}
8888

8989
/// Merge a result.
@@ -633,7 +633,7 @@ static bool isAffineExpr(Value *V, const Region *R, Loop *Scope,
633633
return false;
634634

635635
auto ResultParams = Result.getParameters();
636-
Params.insert(ResultParams.begin(), ResultParams.end());
636+
Params.insert_range(ResultParams);
637637

638638
return true;
639639
}

polly/lib/Transform/MaximalStaticExpansion.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ class MaximalStaticExpansionImpl {
139139
SmallPtrSetImpl<MemoryAccess *> &Reads, Scop &S) {
140140
if (SAI->isValueKind()) {
141141
Writes.insert(S.getValueDef(SAI));
142-
for (auto MA : S.getValueUses(SAI))
143-
Reads.insert(MA);
142+
Reads.insert_range(S.getValueUses(SAI));
144143
return true;
145144
} else if (SAI->isPHIKind()) {
146145
auto Read = S.getPHIRead(SAI);
@@ -399,9 +398,8 @@ class MaximalStaticExpansionImpl {
399398
/// @param Dependences The RAW dependences of the SCop.
400399
void expandPhi(Scop &S, const ScopArrayInfo *SAI,
401400
const isl::union_map &Dependences) {
402-
SmallPtrSet<MemoryAccess *, 4> Writes;
403-
for (auto MA : S.getPHIIncomings(SAI))
404-
Writes.insert(MA);
401+
SmallPtrSet<MemoryAccess *, 4> Writes(llvm::from_range,
402+
S.getPHIIncomings(SAI));
405403
auto Read = S.getPHIRead(SAI);
406404
auto ExpandedSAI = expandAccess(Read);
407405

0 commit comments

Comments
 (0)