diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h index 34557238ecb23c..ad3c6426efd2fe 100644 --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -2247,7 +2247,7 @@ struct Attributor { CalleeRepairCBTy &&CalleeRepairCB, ACSRepairCBTy &&ACSRepairCB) : A(A), ReplacedFn(*Arg.getParent()), ReplacedArg(Arg), - ReplacementTypes(ReplacementTypes.begin(), ReplacementTypes.end()), + ReplacementTypes(ReplacementTypes), CalleeRepairCB(std::move(CalleeRepairCB)), ACSRepairCB(std::move(ACSRepairCB)) {} diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 9e4da5f8ca9615..8eceaef59a1e1f 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -1605,7 +1605,7 @@ struct SwitchCoroutineSplitter { ArrayRef Fns) { // This only works under the switch-lowering ABI because coro elision // only works on the switch-lowering ABI. - SmallVector Args(Fns.begin(), Fns.end()); + SmallVector Args(Fns); assert(!Args.empty()); Function *Part = *Fns.begin(); Module *M = Part->getParent(); diff --git a/llvm/lib/Transforms/IPO/PartialInlining.cpp b/llvm/lib/Transforms/IPO/PartialInlining.cpp index 3ca095e1520f3b..28c81465a09489 100644 --- a/llvm/lib/Transforms/IPO/PartialInlining.cpp +++ b/llvm/lib/Transforms/IPO/PartialInlining.cpp @@ -170,11 +170,10 @@ struct FunctionOutliningMultiRegionInfo { // Container for outline regions struct OutlineRegionInfo { - OutlineRegionInfo(ArrayRef Region, - BasicBlock *EntryBlock, BasicBlock *ExitBlock, - BasicBlock *ReturnBlock) - : Region(Region.begin(), Region.end()), EntryBlock(EntryBlock), - ExitBlock(ExitBlock), ReturnBlock(ReturnBlock) {} + OutlineRegionInfo(ArrayRef Region, BasicBlock *EntryBlock, + BasicBlock *ExitBlock, BasicBlock *ReturnBlock) + : Region(Region), EntryBlock(EntryBlock), ExitBlock(ExitBlock), + ReturnBlock(ReturnBlock) {} SmallVector Region; BasicBlock *EntryBlock; BasicBlock *ExitBlock; diff --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp index c2affafa49e519..810cbbda66085a 100644 --- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp +++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp @@ -281,8 +281,7 @@ class CHRScope { private: CHRScope(ArrayRef RegInfosIn, ArrayRef SubsIn) - : RegInfos(RegInfosIn.begin(), RegInfosIn.end()), - Subs(SubsIn.begin(), SubsIn.end()), BranchInsertPoint(nullptr) {} + : RegInfos(RegInfosIn), Subs(SubsIn), BranchInsertPoint(nullptr) {} }; class CHR { diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp index 400973fd9fc915..949296c3db0de2 100644 --- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp +++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp @@ -383,7 +383,7 @@ struct LoopInterchange { } bool run(LoopNest &LN) { - SmallVector LoopList(LN.getLoops().begin(), LN.getLoops().end()); + SmallVector LoopList(LN.getLoops()); for (unsigned I = 1; I < LoopList.size(); ++I) if (LoopList[I]->getParentLoop() != LoopList[I - 1]) return false; diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp index 6a681fd9339717..d0a83a8242ddc0 100644 --- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -362,7 +362,7 @@ class LowerMatrixIntrinsics { public: MatrixTy() : IsColumnMajor(MatrixLayout == MatrixLayoutTy::ColumnMajor) {} MatrixTy(ArrayRef Vectors) - : Vectors(Vectors.begin(), Vectors.end()), + : Vectors(Vectors), IsColumnMajor(MatrixLayout == MatrixLayoutTy::ColumnMajor) {} MatrixTy(unsigned NumRows, unsigned NumColumns, Type *EltTy) : IsColumnMajor(MatrixLayout == MatrixLayoutTy::ColumnMajor) { diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp index 56aa96e550d9c3..2d74b2b8d1d2fd 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp @@ -971,8 +971,7 @@ bool llvm::UnrollRuntimeLoopRemainder( // (e.g. breakLoopBackedgeAndSimplify) and reused in loop-deletion. BasicBlock *RemainderLatch = remainderLoop->getLoopLatch(); assert(RemainderLatch); - SmallVector RemainderBlocks(remainderLoop->getBlocks().begin(), - remainderLoop->getBlocks().end()); + SmallVector RemainderBlocks(remainderLoop->getBlocks()); breakLoopBackedge(remainderLoop, *DT, *SE, *LI, nullptr); remainderLoop = nullptr; diff --git a/llvm/lib/Transforms/Utils/LoopVersioning.cpp b/llvm/lib/Transforms/Utils/LoopVersioning.cpp index c43c92a6b4d5d3..af2ed6240f7220 100644 --- a/llvm/lib/Transforms/Utils/LoopVersioning.cpp +++ b/llvm/lib/Transforms/Utils/LoopVersioning.cpp @@ -42,10 +42,8 @@ LoopVersioning::LoopVersioning(const LoopAccessInfo &LAI, ArrayRef Checks, Loop *L, LoopInfo *LI, DominatorTree *DT, ScalarEvolution *SE) - : VersionedLoop(L), AliasChecks(Checks.begin(), Checks.end()), - Preds(LAI.getPSE().getPredicate()), LAI(LAI), LI(LI), DT(DT), - SE(SE) { -} + : VersionedLoop(L), AliasChecks(Checks), Preds(LAI.getPSE().getPredicate()), + LAI(LAI), LI(LI), DT(DT), SE(SE) {} void LoopVersioning::versionLoop( const SmallVectorImpl &DefsUsedOutside) { diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 6daa8043a3fbf9..40d10395de17d4 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -8219,7 +8219,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(Instruction *I, // If not provably safe, use a select to form a safe divisor before widening the // div/rem operation itself. Otherwise fall through to general handling below. if (CM.isPredicatedInst(I)) { - SmallVector Ops(Operands.begin(), Operands.end()); + SmallVector Ops(Operands); VPValue *Mask = getBlockInMask(I->getParent()); VPValue *One = Plan.getOrAddLiveIn(ConstantInt::get(I->getType(), 1u, false)); diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index cd273429e6e67e..305efb732d8f7e 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -1575,7 +1575,7 @@ class BoUpSLP { if (I1 && I2) { if (I1->getParent() != I2->getParent()) return CheckSameEntryOrFail(); - SmallVector Ops(MainAltOps.begin(), MainAltOps.end()); + SmallVector Ops(MainAltOps); Ops.push_back(I1); Ops.push_back(I2); InstructionsState S = getSameOpcode(Ops, TLI); @@ -5236,7 +5236,7 @@ void BoUpSLP::reorderNodeWithReuses(TreeEntry &TE, ArrayRef Mask) const { TE.ReorderIndices.clear(); // Try to improve gathered nodes with clustered reuses, if possible. ArrayRef Slice = ArrayRef(NewMask).slice(0, Sz); - SmallVector NewOrder(Slice.begin(), Slice.end()); + SmallVector NewOrder(Slice); inversePermutation(NewOrder, NewMask); reorderScalars(TE.Scalars, NewMask); // Fill the reuses mask with the identity submasks. @@ -7916,8 +7916,7 @@ class BaseShuffleAnalysis { } break; } - SmallVector ShuffleMask(SV->getShuffleMask().begin(), - SV->getShuffleMask().end()); + SmallVector ShuffleMask(SV->getShuffleMask()); combineMasks(LocalVF, ShuffleMask, Mask); Mask.swap(ShuffleMask); if (IsOp2Undef) @@ -8017,15 +8016,13 @@ class BaseShuffleAnalysis { isUndefVector(SV2->getOperand(1), UseMask2).all()) { Op1 = SV1->getOperand(0); Op2 = SV2->getOperand(0); - SmallVector ShuffleMask1(SV1->getShuffleMask().begin(), - SV1->getShuffleMask().end()); + SmallVector ShuffleMask1(SV1->getShuffleMask()); int LocalVF = ShuffleMask1.size(); if (auto *FTy = dyn_cast(Op1->getType())) LocalVF = FTy->getNumElements(); combineMasks(LocalVF, ShuffleMask1, CombinedMask1); CombinedMask1.swap(ShuffleMask1); - SmallVector ShuffleMask2(SV2->getShuffleMask().begin(), - SV2->getShuffleMask().end()); + SmallVector ShuffleMask2(SV2->getShuffleMask()); LocalVF = ShuffleMask2.size(); if (auto *FTy = dyn_cast(Op2->getType())) LocalVF = FTy->getNumElements(); @@ -8062,7 +8059,7 @@ class BaseShuffleAnalysis { if (isa(V1)) return Builder.createPoison( cast(V1->getType())->getElementType(), Mask.size()); - SmallVector NewMask(Mask.begin(), Mask.end()); + SmallVector NewMask(Mask); bool IsIdentity = peekThroughShuffles(V1, NewMask, /*SinglePermute=*/true); assert(V1 && "Expected non-null value after looking through shuffles."); @@ -8290,7 +8287,7 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis { return TTI::TCC_Free; auto *VecTy = getWidenedType(ScalarTy, VL.size()); InstructionCost GatherCost = 0; - SmallVector Gathers(VL.begin(), VL.end()); + SmallVector Gathers(VL); // Improve gather cost for gather of loads, if we can group some of the // loads into vector loads. InstructionsState S = getSameOpcode(VL, *R.TLI); @@ -8725,7 +8722,7 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis { const PointerUnion &P2, ArrayRef Mask) { ShuffleCostBuilder Builder(TTI); - SmallVector CommonMask(Mask.begin(), Mask.end()); + SmallVector CommonMask(Mask); Value *V1 = P1.dyn_cast(), *V2 = P2.dyn_cast(); unsigned CommonVF = Mask.size(); InstructionCost ExtraCost = 0; diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp index 444598520c981a..d81c747684f07a 100644 --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp @@ -1434,7 +1434,7 @@ bool VectorCombine::foldShuffleOfBinops(Instruction &I) { M -= NumSrcElts; }; - SmallVector NewMask0(OldMask.begin(), OldMask.end()); + SmallVector NewMask0(OldMask); TargetTransformInfo::ShuffleKind SK0 = TargetTransformInfo::SK_PermuteTwoSrc; if (X == Z) { llvm::for_each(NewMask0, ConvertToUnary); @@ -1442,7 +1442,7 @@ bool VectorCombine::foldShuffleOfBinops(Instruction &I) { Z = PoisonValue::get(BinOpTy); } - SmallVector NewMask1(OldMask.begin(), OldMask.end()); + SmallVector NewMask1(OldMask); TargetTransformInfo::ShuffleKind SK1 = TargetTransformInfo::SK_PermuteTwoSrc; if (Y == W) { llvm::for_each(NewMask1, ConvertToUnary); @@ -1624,7 +1624,7 @@ bool VectorCombine::foldShuffleOfShuffles(Instruction &I) { return false; // Merge shuffles - replace index to the RHS poison arg with PoisonMaskElem, - SmallVector NewMask(OuterMask.begin(), OuterMask.end()); + SmallVector NewMask(OuterMask); for (int &M : NewMask) { if (0 <= M && M < (int)NumImmElts) { M = (InnerMask0[M] >= (int)NumSrcElts) ? PoisonMaskElem : InnerMask0[M];