Skip to content

[polly] Use *Set::insert_range (NFC) #133609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions polly/lib/Analysis/ScopBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2633,8 +2633,7 @@ void ScopBuilder::checkForReductions(ScopStmt &Stmt) {
if (auto *Ptr = dyn_cast<Instruction>(Load->getPointerOperand())) {
const auto &It = State.find(Ptr);
if (It != State.end())
for (const auto &FlowInSetElem : It->second)
InvalidLoads.insert(FlowInSetElem.first);
InvalidLoads.insert_range(llvm::make_first_range(It->second));
}

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

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

Expand Down
2 changes: 1 addition & 1 deletion polly/lib/Analysis/ScopDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ bool ScopDetection::onlyValidRequiredInvariantLoads(
}
}

Context.RequiredILS.insert(RequiredILS.begin(), RequiredILS.end());
Context.RequiredILS.insert_range(RequiredILS);

return true;
}
Expand Down
3 changes: 1 addition & 2 deletions polly/lib/CodeGen/IslNodeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,7 @@ void IslNodeBuilder::getReferencesInSubtree(const isl::ast_node &For,
SubtreeReferences References = {
LI, SE, S, ValueMap, Values, SCEVs, getBlockGenerator(), nullptr};

for (const auto &I : IDToValue)
Values.insert(I.second);
Values.insert_range(llvm::make_second_range(IDToValue));

// NOTE: this is populated in IslNodeBuilder::addParameters
for (const auto &I : OutsideLoopIterations)
Expand Down
4 changes: 2 additions & 2 deletions polly/lib/Support/SCEVValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ValidatorResult final {

/// Add the parameters of Source to this result.
void addParamsFrom(const ValidatorResult &Source) {
Parameters.insert(Source.Parameters.begin(), Source.Parameters.end());
Parameters.insert_range(Source.Parameters);
}

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

auto ResultParams = Result.getParameters();
Params.insert(ResultParams.begin(), ResultParams.end());
Params.insert_range(ResultParams);

return true;
}
Expand Down
8 changes: 3 additions & 5 deletions polly/lib/Transform/MaximalStaticExpansion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ class MaximalStaticExpansionImpl {
SmallPtrSetImpl<MemoryAccess *> &Reads, Scop &S) {
if (SAI->isValueKind()) {
Writes.insert(S.getValueDef(SAI));
for (auto MA : S.getValueUses(SAI))
Reads.insert(MA);
Reads.insert_range(S.getValueUses(SAI));
return true;
} else if (SAI->isPHIKind()) {
auto Read = S.getPHIRead(SAI);
Expand Down Expand Up @@ -399,9 +398,8 @@ class MaximalStaticExpansionImpl {
/// @param Dependences The RAW dependences of the SCop.
void expandPhi(Scop &S, const ScopArrayInfo *SAI,
const isl::union_map &Dependences) {
SmallPtrSet<MemoryAccess *, 4> Writes;
for (auto MA : S.getPHIIncomings(SAI))
Writes.insert(MA);
SmallPtrSet<MemoryAccess *, 4> Writes(llvm::from_range,
S.getPHIIncomings(SAI));
auto Read = S.getPHIRead(SAI);
auto ExpandedSAI = expandAccess(Read);

Expand Down