[Mlir-commits] [mlir] [mlir] Construct SmallVector with ArrayRef (NFC) (PR #101896)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Aug 4 09:28:37 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-scf
@llvm/pr-subscribers-mlir-core
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Patch is 40.59 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/101896.diff
44 Files Affected:
- (modified) mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h (+1-1)
- (modified) mlir/include/mlir/IR/DialectRegistry.h (+1-1)
- (modified) mlir/include/mlir/TableGen/Class.h (+1-2)
- (modified) mlir/lib/Analysis/Presburger/IntegerRelation.cpp (+1-1)
- (modified) mlir/lib/Analysis/Presburger/Simplex.cpp (+2-2)
- (modified) mlir/lib/Analysis/Presburger/Utils.cpp (+1-1)
- (modified) mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp (+1-1)
- (modified) mlir/lib/Dialect/Affine/IR/AffineOps.cpp (+2-4)
- (modified) mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp (+2-2)
- (modified) mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp (+1-2)
- (modified) mlir/lib/Dialect/GPU/TransformOps/Utils.cpp (+1-2)
- (modified) mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp (+1-1)
- (modified) mlir/lib/Dialect/GPU/Transforms/ROCDLAttachTarget.cpp (+1-1)
- (modified) mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp (+2-4)
- (modified) mlir/lib/Dialect/Linalg/Transforms/Interchange.cpp (+1-2)
- (modified) mlir/lib/Dialect/Linalg/Transforms/Loops.cpp (+2-2)
- (modified) mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp (+1-1)
- (modified) mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp (+1-2)
- (modified) mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp (+1-1)
- (modified) mlir/lib/Dialect/Linalg/Utils/Utils.cpp (+1-2)
- (modified) mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp (+1-1)
- (modified) mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp (+1-1)
- (modified) mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp (+5-5)
- (modified) mlir/lib/Dialect/SCF/Utils/Utils.cpp (+1-1)
- (modified) mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp (+1-1)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp (+1-2)
- (modified) mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp (+2-2)
- (modified) mlir/lib/Dialect/Tensor/IR/TensorOps.cpp (+2-4)
- (modified) mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp (+4-5)
- (modified) mlir/lib/Dialect/Tensor/Utils/Utils.cpp (+1-2)
- (modified) mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp (+1-1)
- (modified) mlir/lib/Dialect/Vector/IR/VectorOps.cpp (+2-3)
- (modified) mlir/lib/Dialect/Vector/Transforms/LowerVectorScan.cpp (+2-2)
- (modified) mlir/lib/Dialect/Vector/Transforms/LowerVectorTransfer.cpp (+1-2)
- (modified) mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp (+3-6)
- (modified) mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp (+1-1)
- (modified) mlir/lib/IR/AffineExpr.cpp (+1-2)
- (modified) mlir/lib/IR/AffineMap.cpp (+3-4)
- (modified) mlir/lib/IR/OperationSupport.cpp (+1-1)
- (modified) mlir/lib/Interfaces/FunctionInterfaces.cpp (+1-1)
- (modified) mlir/lib/Target/LLVMIR/ModuleImport.cpp (+1-1)
- (modified) mlir/lib/Transforms/Mem2Reg.cpp (+1-2)
- (modified) mlir/lib/Transforms/SROA.cpp (+1-2)
- (modified) mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp (+2-3)
``````````diff
diff --git a/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h b/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
index 8e6d36f0b5f09..10970fd03e6eb 100644
--- a/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
+++ b/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
@@ -56,7 +56,7 @@ struct UnrollVectorOptions {
/// Set the native shape to use for unrolling.
UnrollVectorOptions &setNativeShape(ArrayRef<int64_t> shape) {
- SmallVector<int64_t> tsShape(shape.begin(), shape.end());
+ SmallVector<int64_t> tsShape(shape);
nativeShape = [=](Operation *) -> std::optional<SmallVector<int64_t>> {
return tsShape;
};
diff --git a/mlir/include/mlir/IR/DialectRegistry.h b/mlir/include/mlir/IR/DialectRegistry.h
index c13a1a1858eb1..8e394988119da 100644
--- a/mlir/include/mlir/IR/DialectRegistry.h
+++ b/mlir/include/mlir/IR/DialectRegistry.h
@@ -60,7 +60,7 @@ class DialectExtensionBase {
/// If the list is empty, the extension is invoked for every loaded dialect
/// independently.
DialectExtensionBase(ArrayRef<StringRef> dialectNames)
- : dialectNames(dialectNames.begin(), dialectNames.end()) {}
+ : dialectNames(dialectNames) {}
private:
/// The names of the dialects affected by this extension.
diff --git a/mlir/include/mlir/TableGen/Class.h b/mlir/include/mlir/TableGen/Class.h
index 92fec6a3b11d9..855952d19492d 100644
--- a/mlir/include/mlir/TableGen/Class.h
+++ b/mlir/include/mlir/TableGen/Class.h
@@ -129,8 +129,7 @@ class MethodSignature {
ArrayRef<MethodParameter> parameters)
: MethodSignature(std::forward<RetTypeT>(retType),
std::forward<NameT>(name),
- SmallVector<MethodParameter>(parameters.begin(),
- parameters.end())) {}
+ SmallVector<MethodParameter>(parameters)) {}
/// Create a method signature with a return type, a method name, and a
/// variadic list of parameters.
template <typename RetTypeT, typename NameT, typename... Parameters>
diff --git a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
index bdcb55251b104..87204d2100713 100644
--- a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
+++ b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
@@ -1515,7 +1515,7 @@ void IntegerRelation::addLocalFloorDiv(ArrayRef<DynamicAPInt> dividend,
appendVar(VarKind::Local);
- SmallVector<DynamicAPInt, 8> dividendCopy(dividend.begin(), dividend.end());
+ SmallVector<DynamicAPInt, 8> dividendCopy(dividend);
dividendCopy.insert(dividendCopy.end() - 1, DynamicAPInt(0));
addInequality(
getDivLowerBound(dividendCopy, divisor, dividendCopy.size() - 2));
diff --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index 7c8a019557132..c78a0723a6c0f 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -1306,7 +1306,7 @@ void SimplexBase::addDivisionVariable(ArrayRef<DynamicAPInt> coeffs,
assert(denom > 0 && "Denominator must be positive!");
appendVariable();
- SmallVector<DynamicAPInt, 8> ineq(coeffs.begin(), coeffs.end());
+ SmallVector<DynamicAPInt, 8> ineq(coeffs);
DynamicAPInt constTerm = ineq.back();
ineq.back() = -denom;
ineq.emplace_back(constTerm);
@@ -1754,7 +1754,7 @@ class presburger::GBRSimplex {
getCoeffsForDirection(ArrayRef<DynamicAPInt> dir) {
assert(2 * dir.size() == simplex.getNumVariables() &&
"Direction vector has wrong dimensionality");
- SmallVector<DynamicAPInt, 8> coeffs(dir.begin(), dir.end());
+ SmallVector<DynamicAPInt, 8> coeffs(dir);
coeffs.reserve(dir.size() + 1);
for (const DynamicAPInt &coeff : dir)
coeffs.emplace_back(-coeff);
diff --git a/mlir/lib/Analysis/Presburger/Utils.cpp b/mlir/lib/Analysis/Presburger/Utils.cpp
index e74aae7079680..f12bd5239245d 100644
--- a/mlir/lib/Analysis/Presburger/Utils.cpp
+++ b/mlir/lib/Analysis/Presburger/Utils.cpp
@@ -319,7 +319,7 @@ presburger::getDivUpperBound(ArrayRef<DynamicAPInt> dividend,
assert(divisor > 0 && "divisor must be positive!");
assert(dividend[localVarIdx] == 0 &&
"Local to be set to division must have zero coeff!");
- SmallVector<DynamicAPInt, 8> ineq(dividend.begin(), dividend.end());
+ SmallVector<DynamicAPInt, 8> ineq(dividend);
ineq[localVarIdx] = -divisor;
return ineq;
}
diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
index 0150ff667e4ef..e059d31ca5842 100644
--- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
+++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
@@ -63,7 +63,7 @@ static void getXferIndices(RewriterBase &rewriter, TransferOpType xferOp,
for (auto expr : xferOp.getPermutationMap().getResults()) {
if (auto dim = dyn_cast<AffineDimExpr>(expr)) {
Value prevIdx = indices[dim.getPosition()];
- SmallVector<OpFoldResult, 3> dims(dimValues.begin(), dimValues.end());
+ SmallVector<OpFoldResult, 3> dims(dimValues);
dims.push_back(prevIdx);
AffineExpr d0 = rewriter.getAffineDimExpr(offsetMap.getNumDims());
indices[dim.getPosition()] = affine::makeComposedAffineApply(
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index a40ffd53f9d71..35d5f53aad241 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -4146,11 +4146,9 @@ static ParseResult parseAffineMapWithMinMax(OpAsmParser &parser,
llvm::append_range(flatExprs, map.getValue().getResults());
auto operandsRef = llvm::ArrayRef(mapOperands);
auto dimsRef = operandsRef.take_front(map.getValue().getNumDims());
- SmallVector<OpAsmParser::UnresolvedOperand> dims(dimsRef.begin(),
- dimsRef.end());
+ SmallVector<OpAsmParser::UnresolvedOperand> dims(dimsRef);
auto symsRef = operandsRef.drop_front(map.getValue().getNumDims());
- SmallVector<OpAsmParser::UnresolvedOperand> syms(symsRef.begin(),
- symsRef.end());
+ SmallVector<OpAsmParser::UnresolvedOperand> syms(symsRef);
flatDimOperands.append(map.getValue().getNumResults(), dims);
flatSymOperands.append(map.getValue().getNumResults(), syms);
numMapsPerGroup.push_back(map.getValue().getNumResults());
diff --git a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
index f09d93f3ba444..d68a29f07f1b6 100644
--- a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
@@ -1384,7 +1384,7 @@ unsigned mlir::affine::permuteLoops(MutableArrayRef<AffineForOp> input,
assert(input.size() == permMap.size() && "invalid permutation map size");
// Check whether the permutation spec is valid. This is a small vector - we'll
// just sort and check if it's iota.
- SmallVector<unsigned, 4> checkPermMap(permMap.begin(), permMap.end());
+ SmallVector<unsigned, 4> checkPermMap(permMap);
llvm::sort(checkPermMap);
if (llvm::any_of(llvm::enumerate(checkPermMap),
[](const auto &en) { return en.value() != en.index(); }))
@@ -1583,7 +1583,7 @@ SmallVector<SmallVector<AffineForOp, 8>, 8>
mlir::affine::tile(ArrayRef<AffineForOp> forOps, ArrayRef<uint64_t> sizes,
ArrayRef<AffineForOp> targets) {
SmallVector<SmallVector<AffineForOp, 8>, 8> res;
- SmallVector<AffineForOp, 8> currentTargets(targets.begin(), targets.end());
+ SmallVector<AffineForOp, 8> currentTargets(targets);
for (auto it : llvm::zip(forOps, sizes)) {
auto step = stripmineSink(std::get<0>(it), std::get<1>(it), currentTargets);
res.push_back(step);
diff --git a/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp b/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
index e2d42e961c576..70fd9bc0a1e68 100644
--- a/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
@@ -44,8 +44,7 @@ struct NarrowingPattern : OpRewritePattern<SourceOp> {
NarrowingPattern(MLIRContext *ctx, const ArithIntNarrowingOptions &options,
PatternBenefit benefit = 1)
: OpRewritePattern<SourceOp>(ctx, benefit),
- supportedBitwidths(options.bitwidthsSupported.begin(),
- options.bitwidthsSupported.end()) {
+ supportedBitwidths(options.bitwidthsSupported) {
assert(!supportedBitwidths.empty() && "Invalid options");
assert(!llvm::is_contained(supportedBitwidths, 0) && "Invalid bitwidth");
llvm::sort(supportedBitwidths);
diff --git a/mlir/lib/Dialect/GPU/TransformOps/Utils.cpp b/mlir/lib/Dialect/GPU/TransformOps/Utils.cpp
index e8ecbe16c3f06..17bda27b55811 100644
--- a/mlir/lib/Dialect/GPU/TransformOps/Utils.cpp
+++ b/mlir/lib/Dialect/GPU/TransformOps/Utils.cpp
@@ -148,8 +148,7 @@ static GpuIdBuilderFnType common3DIdBuilderFn(int64_t multiplicity = 1) {
rewriter, loc, d0.floorDiv(multiplicity), {scaledIds[0]})
.get<Value>();
// In the 3-D mapping case, unscale the first dimension by the multiplicity.
- SmallVector<int64_t> forallMappingSizeInOriginalBasis(
- forallMappingSizes.begin(), forallMappingSizes.end());
+ SmallVector<int64_t> forallMappingSizeInOriginalBasis(forallMappingSizes);
forallMappingSizeInOriginalBasis[0] *= multiplicity;
return IdBuilderResult{
/*mappingIdOps=*/scaledIds,
diff --git a/mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp b/mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp
index ad6b0afa29a1a..dd705cd338312 100644
--- a/mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp
@@ -61,7 +61,7 @@ DictionaryAttr NVVMAttachTarget::getFlags(OpBuilder &builder) const {
void NVVMAttachTarget::runOnOperation() {
OpBuilder builder(&getContext());
ArrayRef<std::string> libs(linkLibs);
- SmallVector<StringRef> filesToLink(libs.begin(), libs.end());
+ SmallVector<StringRef> filesToLink(libs);
auto target = builder.getAttr<NVVMTargetAttr>(
optLevel, triple, chip, features, getFlags(builder),
filesToLink.empty() ? nullptr : builder.getStrArrayAttr(filesToLink));
diff --git a/mlir/lib/Dialect/GPU/Transforms/ROCDLAttachTarget.cpp b/mlir/lib/Dialect/GPU/Transforms/ROCDLAttachTarget.cpp
index 60f6a74748828..1f44ffa52e068 100644
--- a/mlir/lib/Dialect/GPU/Transforms/ROCDLAttachTarget.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/ROCDLAttachTarget.cpp
@@ -69,7 +69,7 @@ DictionaryAttr ROCDLAttachTarget::getFlags(OpBuilder &builder) const {
void ROCDLAttachTarget::runOnOperation() {
OpBuilder builder(&getContext());
ArrayRef<std::string> libs(linkLibs);
- SmallVector<StringRef> filesToLink(libs.begin(), libs.end());
+ SmallVector<StringRef> filesToLink(libs);
auto target = builder.getAttr<ROCDLTargetAttr>(
optLevel, triple, chip, features, abiVersion, getFlags(builder),
filesToLink.empty() ? nullptr : builder.getStrArrayAttr(filesToLink));
diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 9baf358a95503..48b3abbeee701 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -1117,10 +1117,8 @@ transform::InterchangeOp::applyToOne(transform::TransformRewriter &rewriter,
<< ") different from the number of loops in the target operation ("
<< numLoops << ")";
}
- FailureOr<GenericOp> res =
- interchangeGenericOp(rewriter, target,
- SmallVector<unsigned>(interchangeVector.begin(),
- interchangeVector.end()));
+ FailureOr<GenericOp> res = interchangeGenericOp(
+ rewriter, target, SmallVector<unsigned>(interchangeVector));
if (failed(res))
return emitDefiniteFailure() << "failed to apply";
results.push_back(res->getOperation());
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Interchange.cpp b/mlir/lib/Dialect/Linalg/Transforms/Interchange.cpp
index a0faeb524c57d..785330736b39a 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Interchange.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Interchange.cpp
@@ -79,8 +79,7 @@ mlir::linalg::interchangeGenericOp(RewriterBase &rewriter, GenericOp genericOp,
ArrayRef<Attribute> itTypes = genericOp.getIteratorTypes().getValue();
SmallVector<Attribute> itTypesVector;
llvm::append_range(itTypesVector, itTypes);
- SmallVector<int64_t> permutation(interchangeVector.begin(),
- interchangeVector.end());
+ SmallVector<int64_t> permutation(interchangeVector);
applyPermutationToVector(itTypesVector, permutation);
genericOp.setIteratorTypesAttr(rewriter.getArrayAttr(itTypesVector));
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
index 8b0e04fb61b1b..20a99491b6644 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp
@@ -48,7 +48,7 @@ static SmallVector<Value> makeCanonicalAffineApplies(OpBuilder &b, Location loc,
auto dims = map.getNumDims();
for (auto e : map.getResults()) {
auto exprMap = AffineMap::get(dims, map.getNumSymbols(), e);
- SmallVector<Value> operands(vals.begin(), vals.end());
+ SmallVector<Value> operands(vals);
affine::canonicalizeMapAndOperands(&exprMap, &operands);
res.push_back(b.create<affine::AffineApplyOp>(loc, exprMap, operands));
}
@@ -133,7 +133,7 @@ static void emitScalarImplementation(OpBuilder &b, Location loc,
SmallVector<Value> indexedValues;
indexedValues.reserve(linalgOp->getNumOperands());
- auto allIvsPlusDims = SmallVector<Value>(allIvs.begin(), allIvs.end());
+ auto allIvsPlusDims = SmallVector<Value>(allIvs);
// TODO: Avoid the loads if the corresponding argument of the
// region has no uses.
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
index fb6ab2055e7dd..31f37334ce397 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
@@ -53,7 +53,7 @@ mlir::linalg::makeTiledLoopRanges(RewriterBase &b, Location loc, AffineMap map,
// Apply `map` to get shape sizes in loop order.
SmallVector<OpFoldResult> shapeSizes =
makeComposedFoldedMultiResultAffineApply(b, loc, map, allShapeSizes);
- SmallVector<OpFoldResult> tileSizes(allTileSizes.begin(), allTileSizes.end());
+ SmallVector<OpFoldResult> tileSizes(allTileSizes);
// Traverse the tile sizes, which are in loop order, erase zeros everywhere.
LoopIndexToRangeIndexMap loopIndexToRangeIndex;
diff --git a/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
index 2133458efe74c..fbff91a94219c 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
@@ -460,8 +460,7 @@ struct LinalgOpPartialReductionInterface
Location loc, ValueRange partialReduce,
ArrayRef<int> reductionDims) const {
auto linalgOp = cast<LinalgOp>(op);
- SmallVector<int64_t> reductionDimsInt64(reductionDims.begin(),
- reductionDims.end());
+ SmallVector<int64_t> reductionDimsInt64(reductionDims);
auto reduction = b.create<linalg::ReduceOp>(
loc, partialReduce, linalgOp.getDpsInits(), reductionDimsInt64,
[&linalgOp](OpBuilder &b, Location loc, ValueRange inputs) {
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
index f30ef235e9cd3..0e5e563ed5450 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
@@ -904,7 +904,7 @@ linalg::packMatmulGreedily(RewriterBase &rewriter, LinalgOp linalgOp,
LinalgTilingOptions &
mlir::linalg::LinalgTilingOptions::setTileSizes(ArrayRef<int64_t> ts) {
assert(!tileSizeComputationFunction && "tile sizes already set");
- SmallVector<int64_t, 4> tileSizes(ts.begin(), ts.end());
+ SmallVector<int64_t, 4> tileSizes(ts);
tileSizeComputationFunction = [tileSizes](OpBuilder &b, Operation *op) {
OpBuilder::InsertionGuard guard(b);
b.setInsertionPointToStart(
diff --git a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
index 74f6d97aeea53..fa0598dd96885 100644
--- a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp
@@ -264,8 +264,7 @@ GenericOp makeTransposeOp(OpBuilder &b, Location loc, Value inputTensor,
// Compute the transpose and the indentity indexing maps.
SmallVector<AffineMap> indexingMaps = {
inversePermutation(AffineMap::getPermutationMap(
- SmallVector<unsigned>(transposeVector.begin(), transposeVector.end()),
- b.getContext())),
+ SmallVector<unsigned>(transposeVector), b.getContext())),
AffineMap::getMultiDimIdentityMap(transposeVector.size(),
b.getContext())};
SmallVector<utils::IteratorType> iteratorTypes(transposeVector.size(),
diff --git a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
index d6fe22158d002..f0503555bfe4b 100644
--- a/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
+++ b/mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp
@@ -122,7 +122,7 @@ handleMultidimensionalVectors(ImplicitLocOpBuilder &builder,
// Maybe expand operands to the higher rank vector shape that we'll use to
// iterate over and extract one dimensional vectors.
- SmallVector<int64_t> expandedShape(inputShape.begin(), inputShape.end());
+ SmallVector<int64_t> expandedShape(inputShape);
SmallVector<Value> expandedOperands(operands);
if (expansionDim > 1) {
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
index f9e8a27973178..779ffbfc23f4d 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
@@ -154,7 +154,7 @@ static void constifyIndexValues(
/// expected for `getAttributes` in `constifyIndexValues`.
static SmallVector<int64_t> getConstantSizes(MemRefType memRefTy) {
ArrayRef<int64_t> sizes = memRefTy.getShape();
- return SmallVector<int64_t>(sizes.begin(), sizes.end());
+ return SmallVector<int64_t>(sizes);
}
/// Wrapper around `getStridesAndOffset` that returns only the offset and
diff --git a/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp b/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp
index 7d3d868b326c6..733fde78e4259 100644
--- a/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp
+++ b/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp
@@ -740,9 +740,9 @@ static std::tuple<SmallVector<int64_t>, SmallVector<int64_t>,
SmallVector<int64_t>>
makeVectorShapes(ArrayRef<int64_t> lhs, ArrayRef<int64_t> rhs,
ArrayRef<int64_t> res) {
- SmallVector<int64_t> vlhs{lhs.begin(), lhs.end()};
- SmallVector<int64_t> vrhs{rhs.begin(), rhs.end()};
- SmallVector<int64_t> vres{res.begin(), res.end()};
+ SmallVector<int64_t> vlhs{lhs};
+ SmallVector<int64_t> vrhs{rhs};
+ SmallVector<int64_t> vres{res};
return std::make_tuple(vlhs, vrhs, vres);
}
@@ -758,7 +758,7 @@ MmaSyncBuilder::getIndexCalculators(ArrayRef<int64_t> opShape,
&MmaSyncBuilder::m16n8k4tf32Rhs,
&MmaSyncBuilder::m16n8k4tf32Res),
makeVectorShapes({2, 1}, {1, 1}, {2, 2}),
- SmallVector<int64_t>{opShape.begin(), opShape.end()},
+ SmallVector<int64_t>{opShape},
/*tf32Enabled=*/true};
}
// This is the version with f16 accumulation.
@@ -769,7 +769,7 @@ MmaSyncBuilder::getIndexCalculators(ArrayRef<in...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/101896
More information about the Mlir-commits
mailing list