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

0 commit comments

Comments
 (0)