diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp index 76c9b4775784..351eab7f9371 100644 --- a/polly/lib/Analysis/ScopBuilder.cpp +++ b/polly/lib/Analysis/ScopBuilder.cpp @@ -2633,8 +2633,7 @@ void ScopBuilder::checkForReductions(ScopStmt &Stmt) { if (auto *Ptr = dyn_cast(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(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)); } } diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 7ad2e53b589a..260211bdce31 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -500,7 +500,7 @@ bool ScopDetection::onlyValidRequiredInvariantLoads( } } - Context.RequiredILS.insert(RequiredILS.begin(), RequiredILS.end()); + Context.RequiredILS.insert_range(RequiredILS); return true; } diff --git a/polly/lib/CodeGen/IslNodeBuilder.cpp b/polly/lib/CodeGen/IslNodeBuilder.cpp index 6affc202d0a4..ca497927e297 100644 --- a/polly/lib/CodeGen/IslNodeBuilder.cpp +++ b/polly/lib/CodeGen/IslNodeBuilder.cpp @@ -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) diff --git a/polly/lib/Support/SCEVValidator.cpp b/polly/lib/Support/SCEVValidator.cpp index 599d7f9d6080..ad3d0c22295b 100644 --- a/polly/lib/Support/SCEVValidator.cpp +++ b/polly/lib/Support/SCEVValidator.cpp @@ -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; } diff --git a/polly/lib/Transform/MaximalStaticExpansion.cpp b/polly/lib/Transform/MaximalStaticExpansion.cpp index c9227ac0bfd1..0719840f74a7 100644 --- a/polly/lib/Transform/MaximalStaticExpansion.cpp +++ b/polly/lib/Transform/MaximalStaticExpansion.cpp @@ -139,8 +139,7 @@ class MaximalStaticExpansionImpl { SmallPtrSetImpl &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 Writes; - for (auto MA : S.getPHIIncomings(SAI)) - Writes.insert(MA); + SmallPtrSet Writes(llvm::from_range, + S.getPHIIncomings(SAI)); auto Read = S.getPHIRead(SAI); auto ExpandedSAI = expandAccess(Read);