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

This commit is contained in:
Kazu Hirata 2025-03-29 21:07:24 -07:00 committed by GitHub
parent c6d0e0435d
commit eba3734f04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 10 additions and 16 deletions

View File

@ -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.
@ -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
@ -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));
}
}

View File

@ -500,7 +500,7 @@ bool ScopDetection::onlyValidRequiredInvariantLoads(
}
}
Context.RequiredILS.insert(RequiredILS.begin(), RequiredILS.end());
Context.RequiredILS.insert_range(RequiredILS);
return true;
}

View File

@ -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)

View File

@ -83,7 +83,7 @@ public:
/// 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.
@ -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;
}

View File

@ -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);
@ -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);