Skip to content

Commit 5262865

Browse files
[mlir] Construct SmallVector with ArrayRef (NFC) (#101896)
1 parent e525f91 commit 5262865

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+65
-90
lines changed

mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct UnrollVectorOptions {
5656

5757
/// Set the native shape to use for unrolling.
5858
UnrollVectorOptions &setNativeShape(ArrayRef<int64_t> shape) {
59-
SmallVector<int64_t> tsShape(shape.begin(), shape.end());
59+
SmallVector<int64_t> tsShape(shape);
6060
nativeShape = [=](Operation *) -> std::optional<SmallVector<int64_t>> {
6161
return tsShape;
6262
};

mlir/include/mlir/IR/DialectRegistry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class DialectExtensionBase {
6060
/// If the list is empty, the extension is invoked for every loaded dialect
6161
/// independently.
6262
DialectExtensionBase(ArrayRef<StringRef> dialectNames)
63-
: dialectNames(dialectNames.begin(), dialectNames.end()) {}
63+
: dialectNames(dialectNames) {}
6464

6565
private:
6666
/// The names of the dialects affected by this extension.

mlir/include/mlir/TableGen/Class.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ class MethodSignature {
129129
ArrayRef<MethodParameter> parameters)
130130
: MethodSignature(std::forward<RetTypeT>(retType),
131131
std::forward<NameT>(name),
132-
SmallVector<MethodParameter>(parameters.begin(),
133-
parameters.end())) {}
132+
SmallVector<MethodParameter>(parameters)) {}
134133
/// Create a method signature with a return type, a method name, and a
135134
/// variadic list of parameters.
136135
template <typename RetTypeT, typename NameT, typename... Parameters>

mlir/lib/Analysis/Presburger/IntegerRelation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ void IntegerRelation::addLocalFloorDiv(ArrayRef<DynamicAPInt> dividend,
15151515

15161516
appendVar(VarKind::Local);
15171517

1518-
SmallVector<DynamicAPInt, 8> dividendCopy(dividend.begin(), dividend.end());
1518+
SmallVector<DynamicAPInt, 8> dividendCopy(dividend);
15191519
dividendCopy.insert(dividendCopy.end() - 1, DynamicAPInt(0));
15201520
addInequality(
15211521
getDivLowerBound(dividendCopy, divisor, dividendCopy.size() - 2));

mlir/lib/Analysis/Presburger/Simplex.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ void SimplexBase::addDivisionVariable(ArrayRef<DynamicAPInt> coeffs,
13061306
assert(denom > 0 && "Denominator must be positive!");
13071307
appendVariable();
13081308

1309-
SmallVector<DynamicAPInt, 8> ineq(coeffs.begin(), coeffs.end());
1309+
SmallVector<DynamicAPInt, 8> ineq(coeffs);
13101310
DynamicAPInt constTerm = ineq.back();
13111311
ineq.back() = -denom;
13121312
ineq.emplace_back(constTerm);
@@ -1754,7 +1754,7 @@ class presburger::GBRSimplex {
17541754
getCoeffsForDirection(ArrayRef<DynamicAPInt> dir) {
17551755
assert(2 * dir.size() == simplex.getNumVariables() &&
17561756
"Direction vector has wrong dimensionality");
1757-
SmallVector<DynamicAPInt, 8> coeffs(dir.begin(), dir.end());
1757+
SmallVector<DynamicAPInt, 8> coeffs(dir);
17581758
coeffs.reserve(dir.size() + 1);
17591759
for (const DynamicAPInt &coeff : dir)
17601760
coeffs.emplace_back(-coeff);

mlir/lib/Analysis/Presburger/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ presburger::getDivUpperBound(ArrayRef<DynamicAPInt> dividend,
319319
assert(divisor > 0 && "divisor must be positive!");
320320
assert(dividend[localVarIdx] == 0 &&
321321
"Local to be set to division must have zero coeff!");
322-
SmallVector<DynamicAPInt, 8> ineq(dividend.begin(), dividend.end());
322+
SmallVector<DynamicAPInt, 8> ineq(dividend);
323323
ineq[localVarIdx] = -divisor;
324324
return ineq;
325325
}

mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static void getXferIndices(RewriterBase &rewriter, TransferOpType xferOp,
6363
for (auto expr : xferOp.getPermutationMap().getResults()) {
6464
if (auto dim = dyn_cast<AffineDimExpr>(expr)) {
6565
Value prevIdx = indices[dim.getPosition()];
66-
SmallVector<OpFoldResult, 3> dims(dimValues.begin(), dimValues.end());
66+
SmallVector<OpFoldResult, 3> dims(dimValues);
6767
dims.push_back(prevIdx);
6868
AffineExpr d0 = rewriter.getAffineDimExpr(offsetMap.getNumDims());
6969
indices[dim.getPosition()] = affine::makeComposedAffineApply(

mlir/lib/Dialect/Affine/IR/AffineOps.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4146,11 +4146,9 @@ static ParseResult parseAffineMapWithMinMax(OpAsmParser &parser,
41464146
llvm::append_range(flatExprs, map.getValue().getResults());
41474147
auto operandsRef = llvm::ArrayRef(mapOperands);
41484148
auto dimsRef = operandsRef.take_front(map.getValue().getNumDims());
4149-
SmallVector<OpAsmParser::UnresolvedOperand> dims(dimsRef.begin(),
4150-
dimsRef.end());
4149+
SmallVector<OpAsmParser::UnresolvedOperand> dims(dimsRef);
41514150
auto symsRef = operandsRef.drop_front(map.getValue().getNumDims());
4152-
SmallVector<OpAsmParser::UnresolvedOperand> syms(symsRef.begin(),
4153-
symsRef.end());
4151+
SmallVector<OpAsmParser::UnresolvedOperand> syms(symsRef);
41544152
flatDimOperands.append(map.getValue().getNumResults(), dims);
41554153
flatSymOperands.append(map.getValue().getNumResults(), syms);
41564154
numMapsPerGroup.push_back(map.getValue().getNumResults());

mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ unsigned mlir::affine::permuteLoops(MutableArrayRef<AffineForOp> input,
13841384
assert(input.size() == permMap.size() && "invalid permutation map size");
13851385
// Check whether the permutation spec is valid. This is a small vector - we'll
13861386
// just sort and check if it's iota.
1387-
SmallVector<unsigned, 4> checkPermMap(permMap.begin(), permMap.end());
1387+
SmallVector<unsigned, 4> checkPermMap(permMap);
13881388
llvm::sort(checkPermMap);
13891389
if (llvm::any_of(llvm::enumerate(checkPermMap),
13901390
[](const auto &en) { return en.value() != en.index(); }))
@@ -1583,7 +1583,7 @@ SmallVector<SmallVector<AffineForOp, 8>, 8>
15831583
mlir::affine::tile(ArrayRef<AffineForOp> forOps, ArrayRef<uint64_t> sizes,
15841584
ArrayRef<AffineForOp> targets) {
15851585
SmallVector<SmallVector<AffineForOp, 8>, 8> res;
1586-
SmallVector<AffineForOp, 8> currentTargets(targets.begin(), targets.end());
1586+
SmallVector<AffineForOp, 8> currentTargets(targets);
15871587
for (auto it : llvm::zip(forOps, sizes)) {
15881588
auto step = stripmineSink(std::get<0>(it), std::get<1>(it), currentTargets);
15891589
res.push_back(step);

mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ struct NarrowingPattern : OpRewritePattern<SourceOp> {
4444
NarrowingPattern(MLIRContext *ctx, const ArithIntNarrowingOptions &options,
4545
PatternBenefit benefit = 1)
4646
: OpRewritePattern<SourceOp>(ctx, benefit),
47-
supportedBitwidths(options.bitwidthsSupported.begin(),
48-
options.bitwidthsSupported.end()) {
47+
supportedBitwidths(options.bitwidthsSupported) {
4948
assert(!supportedBitwidths.empty() && "Invalid options");
5049
assert(!llvm::is_contained(supportedBitwidths, 0) && "Invalid bitwidth");
5150
llvm::sort(supportedBitwidths);

mlir/lib/Dialect/GPU/TransformOps/Utils.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ static GpuIdBuilderFnType common3DIdBuilderFn(int64_t multiplicity = 1) {
148148
rewriter, loc, d0.floorDiv(multiplicity), {scaledIds[0]})
149149
.get<Value>();
150150
// In the 3-D mapping case, unscale the first dimension by the multiplicity.
151-
SmallVector<int64_t> forallMappingSizeInOriginalBasis(
152-
forallMappingSizes.begin(), forallMappingSizes.end());
151+
SmallVector<int64_t> forallMappingSizeInOriginalBasis(forallMappingSizes);
153152
forallMappingSizeInOriginalBasis[0] *= multiplicity;
154153
return IdBuilderResult{
155154
/*mappingIdOps=*/scaledIds,

mlir/lib/Dialect/GPU/Transforms/NVVMAttachTarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ DictionaryAttr NVVMAttachTarget::getFlags(OpBuilder &builder) const {
6161
void NVVMAttachTarget::runOnOperation() {
6262
OpBuilder builder(&getContext());
6363
ArrayRef<std::string> libs(linkLibs);
64-
SmallVector<StringRef> filesToLink(libs.begin(), libs.end());
64+
SmallVector<StringRef> filesToLink(libs);
6565
auto target = builder.getAttr<NVVMTargetAttr>(
6666
optLevel, triple, chip, features, getFlags(builder),
6767
filesToLink.empty() ? nullptr : builder.getStrArrayAttr(filesToLink));

mlir/lib/Dialect/GPU/Transforms/ROCDLAttachTarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ DictionaryAttr ROCDLAttachTarget::getFlags(OpBuilder &builder) const {
6969
void ROCDLAttachTarget::runOnOperation() {
7070
OpBuilder builder(&getContext());
7171
ArrayRef<std::string> libs(linkLibs);
72-
SmallVector<StringRef> filesToLink(libs.begin(), libs.end());
72+
SmallVector<StringRef> filesToLink(libs);
7373
auto target = builder.getAttr<ROCDLTargetAttr>(
7474
optLevel, triple, chip, features, abiVersion, getFlags(builder),
7575
filesToLink.empty() ? nullptr : builder.getStrArrayAttr(filesToLink));

mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,10 +1117,8 @@ transform::InterchangeOp::applyToOne(transform::TransformRewriter &rewriter,
11171117
<< ") different from the number of loops in the target operation ("
11181118
<< numLoops << ")";
11191119
}
1120-
FailureOr<GenericOp> res =
1121-
interchangeGenericOp(rewriter, target,
1122-
SmallVector<unsigned>(interchangeVector.begin(),
1123-
interchangeVector.end()));
1120+
FailureOr<GenericOp> res = interchangeGenericOp(
1121+
rewriter, target, SmallVector<unsigned>(interchangeVector));
11241122
if (failed(res))
11251123
return emitDefiniteFailure() << "failed to apply";
11261124
results.push_back(res->getOperation());

mlir/lib/Dialect/Linalg/Transforms/Interchange.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ mlir::linalg::interchangeGenericOp(RewriterBase &rewriter, GenericOp genericOp,
7979
ArrayRef<Attribute> itTypes = genericOp.getIteratorTypes().getValue();
8080
SmallVector<Attribute> itTypesVector;
8181
llvm::append_range(itTypesVector, itTypes);
82-
SmallVector<int64_t> permutation(interchangeVector.begin(),
83-
interchangeVector.end());
82+
SmallVector<int64_t> permutation(interchangeVector);
8483
applyPermutationToVector(itTypesVector, permutation);
8584
genericOp.setIteratorTypesAttr(rewriter.getArrayAttr(itTypesVector));
8685

mlir/lib/Dialect/Linalg/Transforms/Loops.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static SmallVector<Value> makeCanonicalAffineApplies(OpBuilder &b, Location loc,
4848
auto dims = map.getNumDims();
4949
for (auto e : map.getResults()) {
5050
auto exprMap = AffineMap::get(dims, map.getNumSymbols(), e);
51-
SmallVector<Value> operands(vals.begin(), vals.end());
51+
SmallVector<Value> operands(vals);
5252
affine::canonicalizeMapAndOperands(&exprMap, &operands);
5353
res.push_back(b.create<affine::AffineApplyOp>(loc, exprMap, operands));
5454
}
@@ -133,7 +133,7 @@ static void emitScalarImplementation(OpBuilder &b, Location loc,
133133
SmallVector<Value> indexedValues;
134134
indexedValues.reserve(linalgOp->getNumOperands());
135135

136-
auto allIvsPlusDims = SmallVector<Value>(allIvs.begin(), allIvs.end());
136+
auto allIvsPlusDims = SmallVector<Value>(allIvs);
137137

138138
// TODO: Avoid the loads if the corresponding argument of the
139139
// region has no uses.

mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ mlir::linalg::makeTiledLoopRanges(RewriterBase &b, Location loc, AffineMap map,
5353
// Apply `map` to get shape sizes in loop order.
5454
SmallVector<OpFoldResult> shapeSizes =
5555
makeComposedFoldedMultiResultAffineApply(b, loc, map, allShapeSizes);
56-
SmallVector<OpFoldResult> tileSizes(allTileSizes.begin(), allTileSizes.end());
56+
SmallVector<OpFoldResult> tileSizes(allTileSizes);
5757

5858
// Traverse the tile sizes, which are in loop order, erase zeros everywhere.
5959
LoopIndexToRangeIndexMap loopIndexToRangeIndex;

mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ struct LinalgOpPartialReductionInterface
460460
Location loc, ValueRange partialReduce,
461461
ArrayRef<int> reductionDims) const {
462462
auto linalgOp = cast<LinalgOp>(op);
463-
SmallVector<int64_t> reductionDimsInt64(reductionDims.begin(),
464-
reductionDims.end());
463+
SmallVector<int64_t> reductionDimsInt64(reductionDims);
465464
auto reduction = b.create<linalg::ReduceOp>(
466465
loc, partialReduce, linalgOp.getDpsInits(), reductionDimsInt64,
467466
[&linalgOp](OpBuilder &b, Location loc, ValueRange inputs) {

mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ linalg::packMatmulGreedily(RewriterBase &rewriter, LinalgOp linalgOp,
904904
LinalgTilingOptions &
905905
mlir::linalg::LinalgTilingOptions::setTileSizes(ArrayRef<int64_t> ts) {
906906
assert(!tileSizeComputationFunction && "tile sizes already set");
907-
SmallVector<int64_t, 4> tileSizes(ts.begin(), ts.end());
907+
SmallVector<int64_t, 4> tileSizes(ts);
908908
tileSizeComputationFunction = [tileSizes](OpBuilder &b, Operation *op) {
909909
OpBuilder::InsertionGuard guard(b);
910910
b.setInsertionPointToStart(

mlir/lib/Dialect/Linalg/Utils/Utils.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@ GenericOp makeTransposeOp(OpBuilder &b, Location loc, Value inputTensor,
264264
// Compute the transpose and the indentity indexing maps.
265265
SmallVector<AffineMap> indexingMaps = {
266266
inversePermutation(AffineMap::getPermutationMap(
267-
SmallVector<unsigned>(transposeVector.begin(), transposeVector.end()),
268-
b.getContext())),
267+
SmallVector<unsigned>(transposeVector), b.getContext())),
269268
AffineMap::getMultiDimIdentityMap(transposeVector.size(),
270269
b.getContext())};
271270
SmallVector<utils::IteratorType> iteratorTypes(transposeVector.size(),

mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ handleMultidimensionalVectors(ImplicitLocOpBuilder &builder,
122122

123123
// Maybe expand operands to the higher rank vector shape that we'll use to
124124
// iterate over and extract one dimensional vectors.
125-
SmallVector<int64_t> expandedShape(inputShape.begin(), inputShape.end());
125+
SmallVector<int64_t> expandedShape(inputShape);
126126
SmallVector<Value> expandedOperands(operands);
127127

128128
if (expansionDim > 1) {

mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static void constifyIndexValues(
154154
/// expected for `getAttributes` in `constifyIndexValues`.
155155
static SmallVector<int64_t> getConstantSizes(MemRefType memRefTy) {
156156
ArrayRef<int64_t> sizes = memRefTy.getShape();
157-
return SmallVector<int64_t>(sizes.begin(), sizes.end());
157+
return SmallVector<int64_t>(sizes);
158158
}
159159

160160
/// Wrapper around `getStridesAndOffset` that returns only the offset and

mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,9 @@ static std::tuple<SmallVector<int64_t>, SmallVector<int64_t>,
740740
SmallVector<int64_t>>
741741
makeVectorShapes(ArrayRef<int64_t> lhs, ArrayRef<int64_t> rhs,
742742
ArrayRef<int64_t> res) {
743-
SmallVector<int64_t> vlhs{lhs.begin(), lhs.end()};
744-
SmallVector<int64_t> vrhs{rhs.begin(), rhs.end()};
745-
SmallVector<int64_t> vres{res.begin(), res.end()};
743+
SmallVector<int64_t> vlhs{lhs};
744+
SmallVector<int64_t> vrhs{rhs};
745+
SmallVector<int64_t> vres{res};
746746
return std::make_tuple(vlhs, vrhs, vres);
747747
}
748748

@@ -758,7 +758,7 @@ MmaSyncBuilder::getIndexCalculators(ArrayRef<int64_t> opShape,
758758
&MmaSyncBuilder::m16n8k4tf32Rhs,
759759
&MmaSyncBuilder::m16n8k4tf32Res),
760760
makeVectorShapes({2, 1}, {1, 1}, {2, 2}),
761-
SmallVector<int64_t>{opShape.begin(), opShape.end()},
761+
SmallVector<int64_t>{opShape},
762762
/*tf32Enabled=*/true};
763763
}
764764
// This is the version with f16 accumulation.
@@ -769,7 +769,7 @@ MmaSyncBuilder::getIndexCalculators(ArrayRef<int64_t> opShape,
769769
&MmaSyncBuilder::m16n8k16f16Rhs,
770770
&MmaSyncBuilder::m16n8k16f16Res),
771771
makeVectorShapes({4, 2}, {2, 2}, {2, 2}),
772-
SmallVector<int64_t>{opShape.begin(), opShape.end()},
772+
SmallVector<int64_t>{opShape},
773773
/*tf32Enabled=*/false};
774774
}
775775
return failure();

mlir/lib/Dialect/SCF/Utils/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ SmallVector<Loops, 8> mlir::tile(ArrayRef<scf::ForOp> forOps,
11841184
ArrayRef<Value> sizes,
11851185
ArrayRef<scf::ForOp> targets) {
11861186
SmallVector<SmallVector<scf::ForOp, 8>, 8> res;
1187-
SmallVector<scf::ForOp, 8> currentTargets(targets.begin(), targets.end());
1187+
SmallVector<scf::ForOp, 8> currentTargets(targets);
11881188
for (auto it : llvm::zip(forOps, sizes)) {
11891189
auto step = stripmineSink(std::get<0>(it), std::get<1>(it), currentTargets);
11901190
res.push_back(step);

mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ StructType::get(ArrayRef<Type> memberTypes,
10391039
assert(!memberTypes.empty() && "Struct needs at least one member type");
10401040
// Sort the decorations.
10411041
SmallVector<StructType::MemberDecorationInfo, 4> sortedDecorations(
1042-
memberDecorations.begin(), memberDecorations.end());
1042+
memberDecorations);
10431043
llvm::array_pod_sort(sortedDecorations.begin(), sortedDecorations.end());
10441044
return Base::get(memberTypes.vec().front().getContext(),
10451045
/*identifier=*/StringRef(), memberTypes, offsetInfo,

mlir/lib/Dialect/SparseTensor/Transforms/SparseBufferRewriting.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ static void forEachIJPairInAllBuffers(
132132
function_ref<void(uint64_t, Value, Value, Value)> bodyBuilder) {
133133

134134
// Create code for the first (xPerm + ny) buffers.
135-
SmallVector<AffineExpr> exps(xPerm.getResults().begin(),
136-
xPerm.getResults().end());
135+
SmallVector<AffineExpr> exps(xPerm.getResults());
137136
for (unsigned y = 0; y < ny; y++) {
138137
exps.push_back(builder.getAffineDimExpr(y + xPerm.getNumResults()));
139138
}

mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static Value genVectorLoad(PatternRewriter &rewriter, Location loc, VL vl,
112112
VectorType vtp = vectorType(vl, mem);
113113
Value pass = constantZero(rewriter, loc, vtp);
114114
if (llvm::isa<VectorType>(idxs.back().getType())) {
115-
SmallVector<Value> scalarArgs(idxs.begin(), idxs.end());
115+
SmallVector<Value> scalarArgs(idxs);
116116
Value indexVec = idxs.back();
117117
scalarArgs.back() = constantIndex(rewriter, loc, 0);
118118
return rewriter.create<vector::GatherOp>(loc, vtp, mem, scalarArgs,
@@ -129,7 +129,7 @@ static Value genVectorLoad(PatternRewriter &rewriter, Location loc, VL vl,
129129
static void genVectorStore(PatternRewriter &rewriter, Location loc, Value mem,
130130
ArrayRef<Value> idxs, Value vmask, Value rhs) {
131131
if (llvm::isa<VectorType>(idxs.back().getType())) {
132-
SmallVector<Value> scalarArgs(idxs.begin(), idxs.end());
132+
SmallVector<Value> scalarArgs(idxs);
133133
Value indexVec = idxs.back();
134134
scalarArgs.back() = constantIndex(rewriter, loc, 0);
135135
rewriter.create<vector::ScatterOp>(loc, mem, scalarArgs, indexVec, vmask,

mlir/lib/Dialect/Tensor/IR/TensorOps.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ static llvm::SmallBitVector getDroppedDims(ArrayRef<int64_t> reducedShape,
178178
static RankedTensorType
179179
foldDynamicToStaticDimSizes(RankedTensorType type, ValueRange dynamicSizes,
180180
SmallVector<Value> &foldedDynamicSizes) {
181-
SmallVector<int64_t> staticShape(type.getShape().begin(),
182-
type.getShape().end());
181+
SmallVector<int64_t> staticShape(type.getShape());
183182
assert(type.getNumDynamicDims() ==
184183
static_cast<int64_t>(dynamicSizes.size()) &&
185184
"incorrect number of dynamic sizes");
@@ -2810,8 +2809,7 @@ struct InsertSliceOpSourceCastInserter final
28102809
RankedTensorType srcType = insertSliceOp.getSourceType();
28112810
if (srcType.getRank() != insertSliceOp.getDestType().getRank())
28122811
return failure();
2813-
SmallVector<int64_t> newSrcShape(srcType.getShape().begin(),
2814-
srcType.getShape().end());
2812+
SmallVector<int64_t> newSrcShape(srcType.getShape());
28152813
for (int64_t i = 0; i < srcType.getRank(); ++i) {
28162814
if (std::optional<int64_t> constInt =
28172815
getConstantIntValue(insertSliceOp.getMixedSizes()[i])) {

mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ struct PackOpTiling
126126
// The tiling is applied on interchanged dimensions. We have to undo the
127127
// interchange to map sizes and offsets to the original input.
128128
int64_t inputRank = packOp.getSourceRank();
129-
SmallVector<OpFoldResult> origOffsets(offsets.begin(), offsets.end());
130-
SmallVector<OpFoldResult> origSizes(sizes.begin(), sizes.end());
129+
SmallVector<OpFoldResult> origOffsets(offsets);
130+
SmallVector<OpFoldResult> origSizes(sizes);
131131
applyPermToRange(origOffsets, origSizes,
132132
invertPermutationVector(packOp.getOuterDimsPerm()));
133133

@@ -486,9 +486,8 @@ struct UnPackOpTiling
486486
// The tiling is applied on interchanged dimensions. We have to undo the
487487
// interchange to map sizes and offsets to the original input.
488488
int64_t outputRank = unPackOp.getDestRank();
489-
SmallVector<OpFoldResult> origOffsets(destOffsets.begin(),
490-
destOffsets.end());
491-
SmallVector<OpFoldResult> origSizes(destSizes.begin(), destSizes.end());
489+
SmallVector<OpFoldResult> origOffsets(destOffsets);
490+
SmallVector<OpFoldResult> origSizes(destSizes);
492491
applyPermToRange(origOffsets, origSizes,
493492
invertPermutationVector(unPackOp.getOuterDimsPerm()));
494493

0 commit comments

Comments
 (0)