diff --git a/mlir/include/mlir/Dialect/Async/Transforms.h b/mlir/include/mlir/Dialect/Async/Transforms.h --- a/mlir/include/mlir/Dialect/Async/Transforms.h +++ b/mlir/include/mlir/Dialect/Async/Transforms.h @@ -32,7 +32,7 @@ /// operations. void populateAsyncParallelForPatterns( RewritePatternSet &patterns, bool asyncDispatch, int32_t numWorkerThreads, - AsyncMinTaskSizeComputationFunction computeMinTaskSize); + const AsyncMinTaskSizeComputationFunction &computeMinTaskSize); } // namespace async } // namespace mlir diff --git a/mlir/include/mlir/Dialect/Quant/UniformSupport.h b/mlir/include/mlir/Dialect/Quant/UniformSupport.h --- a/mlir/include/mlir/Dialect/Quant/UniformSupport.h +++ b/mlir/include/mlir/Dialect/Quant/UniformSupport.h @@ -31,7 +31,7 @@ /// process. struct ExpressedToQuantizedConverter { /// Creates a converter for the given input type. - static const ExpressedToQuantizedConverter forInputType(Type inputType); + static ExpressedToQuantizedConverter forInputType(Type inputType); /// Converts the inputType to be based on the given elemental type, /// returning the new type (or nullptr and emit an error on failure). diff --git a/mlir/include/mlir/TableGen/GenInfo.h b/mlir/include/mlir/TableGen/GenInfo.h --- a/mlir/include/mlir/TableGen/GenInfo.h +++ b/mlir/include/mlir/TableGen/GenInfo.h @@ -64,7 +64,8 @@ /// // At namespace scope. /// static GenRegistration Print("print", "Print records", [](...){...}); struct GenRegistration { - GenRegistration(StringRef arg, StringRef description, GenFunction function); + GenRegistration(StringRef arg, StringRef description, + const GenFunction &function); }; } // namespace mlir diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp --- a/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp +++ b/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp @@ -10,6 +10,8 @@ // //===----------------------------------------------------------------------===// +#include + #include "PassDetail.h" #include "mlir/Dialect/Arithmetic/IR/Arithmetic.h" #include "mlir/Dialect/Async/IR/Async.h" @@ -111,7 +113,7 @@ AsyncMinTaskSizeComputationFunction computeMinTaskSize) : OpRewritePattern(ctx), asyncDispatch(asyncDispatch), numWorkerThreads(numWorkerThreads), - computeMinTaskSize(computeMinTaskSize) {} + computeMinTaskSize(std::move(computeMinTaskSize)) {} LogicalResult matchAndRewrite(scf::ParallelOp op, PatternRewriter &rewriter) const override; @@ -244,7 +246,7 @@ // Create a parallel compute fuction from the parallel operation. static ParallelComputeFunction createParallelComputeFunction( - scf::ParallelOp op, ParallelComputeFunctionBounds bounds, + scf::ParallelOp op, const ParallelComputeFunctionBounds &bounds, unsigned numBlockAlignedInnerLoops, PatternRewriter &rewriter) { OpBuilder::InsertionGuard guard(rewriter); ImplicitLocOpBuilder b(op.getLoc(), rewriter); @@ -367,7 +369,7 @@ // work concurrently. LoopNestBuilder workLoopBuilder = [&](size_t loopIdx) -> LoopBodyBuilder { return [&, loopIdx](OpBuilder &nestedBuilder, Location loc, Value iv, - ValueRange args) { + ValueRange /*args*/) { ImplicitLocOpBuilder nb(loc, nestedBuilder); // Compute induction variable for `loopIdx`. @@ -527,7 +529,8 @@ // Call parallel compute function inside the async.execute region. auto executeBodyBuilder = [&](OpBuilder &executeBuilder, - Location executeLoc, ValueRange executeArgs) { + Location executeLoc, + ValueRange /*executeArgs*/) { // Update the original `blockStart` and `blockEnd` with new range. SmallVector operands{block->getArguments().begin(), block->getArguments().end()}; @@ -672,12 +675,13 @@ // Induction variable is the index of the block: [0, blockCount). LoopBodyBuilder loopBuilder = [&](OpBuilder &loopBuilder, Location loc, - Value iv, ValueRange args) { + Value iv, ValueRange /*args*/) { ImplicitLocOpBuilder nb(loc, loopBuilder); // Call parallel compute function inside the async.execute region. auto executeBodyBuilder = [&](OpBuilder &executeBuilder, - Location executeLoc, ValueRange executeArgs) { + Location executeLoc, + ValueRange /*executeArgs*/) { executeBuilder.create(executeLoc, compute.sym_name(), compute.getCallableResults(), computeFuncOperands(iv)); @@ -882,7 +886,7 @@ RewritePatternSet patterns(ctx); populateAsyncParallelForPatterns( patterns, asyncDispatch, numWorkerThreads, - [&](ImplicitLocOpBuilder builder, scf::ParallelOp op) { + [&](ImplicitLocOpBuilder builder, scf::ParallelOp /*op*/) { return builder.create(minTaskSize); }); if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) @@ -902,7 +906,7 @@ void mlir::async::populateAsyncParallelForPatterns( RewritePatternSet &patterns, bool asyncDispatch, int32_t numWorkerThreads, - AsyncMinTaskSizeComputationFunction computeMinTaskSize) { + const AsyncMinTaskSizeComputationFunction &computeMinTaskSize) { MLIRContext *ctx = patterns.getContext(); patterns.add(ctx, asyncDispatch, numWorkerThreads, computeMinTaskSize); diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp --- a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp +++ b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp @@ -31,7 +31,7 @@ //===----------------------------------------------------------------------===// // Drop the reference count immediately if the value has no uses. -static LogicalResult dropRefIfNoUses(Value value, unsigned count = 1) { +static LogicalResult dropRefIfNoUses(Value value) { if (!value.getUses().empty()) return failure(); @@ -418,7 +418,7 @@ continue; // Update terminator `successor` block to `refCountingBlock`. - for (auto pair : llvm::enumerate(terminator->getSuccessors())) + for (const auto &pair : llvm::enumerate(terminator->getSuccessors())) if (pair.value() == successor) terminator->setSuccessor(refCountingBlock, pair.index()); } diff --git a/mlir/lib/Dialect/DLTI/DLTI.cpp b/mlir/lib/Dialect/DLTI/DLTI.cpp --- a/mlir/lib/Dialect/DLTI/DLTI.cpp +++ b/mlir/lib/Dialect/DLTI/DLTI.cpp @@ -203,7 +203,7 @@ // Try overwriting the old entries with the new ones. for (const auto &kvp : newEntriesForType) { if (!entriesForType.count(kvp.first)) { - entriesForType[kvp.first] = std::move(kvp.second); + entriesForType[kvp.first] = kvp.second; continue; } @@ -343,7 +343,7 @@ } Attribute DLTIDialect::parseAttribute(DialectAsmParser &parser, - Type type) const { + Type /*type*/) const { StringRef attrKind; if (parser.parseKeyword(&attrKind)) return {}; diff --git a/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp b/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp --- a/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp +++ b/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp @@ -17,7 +17,7 @@ return inputType.isa(); } -const ExpressedToQuantizedConverter +ExpressedToQuantizedConverter ExpressedToQuantizedConverter::forInputType(Type inputType) { if (inputType.isa()) { Type elementType = inputType.cast().getElementType(); diff --git a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp --- a/mlir/lib/Dialect/StandardOps/IR/Ops.cpp +++ b/mlir/lib/Dialect/StandardOps/IR/Ops.cpp @@ -1163,7 +1163,7 @@ OpAsmPrinter &p, SwitchOp op, Type flagType, Block *defaultDestination, OperandRange defaultOperands, TypeRange defaultOperandTypes, DenseIntElementsAttr caseValues, SuccessorRange caseDestinations, - OperandRangeRange caseOperands, TypeRangeRange caseOperandTypes) { + OperandRangeRange caseOperands, const TypeRangeRange &caseOperandTypes) { p << " default: "; p.printSuccessorAndUseList(defaultDestination, defaultOperands); @@ -1289,7 +1289,7 @@ /// ] /// -> br ^bb2 static void foldSwitch(SwitchOp op, PatternRewriter &rewriter, - APInt caseValue) { + const APInt &caseValue) { auto caseValues = op.getCaseValues(); for (const auto &it : llvm::enumerate(caseValues->getValues())) { if (it.value() == caseValue) { diff --git a/mlir/lib/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.cpp b/mlir/lib/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.cpp --- a/mlir/lib/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.cpp +++ b/mlir/lib/Dialect/StandardOps/Transforms/DecomposeCallGraphTypes.cpp @@ -61,13 +61,13 @@ DecomposeCallGraphTypesOpConversionPattern; LogicalResult - matchAndRewrite(FuncOp op, OpAdaptor adaptor, + matchAndRewrite(FuncOp op, OpAdaptor /*adaptor*/, ConversionPatternRewriter &rewriter) const final { auto functionType = op.getType(); // Convert function arguments using the provided TypeConverter. TypeConverter::SignatureConversion conversion(functionType.getNumInputs()); - for (auto argType : llvm::enumerate(functionType.getInputs())) { + for (const auto &argType : llvm::enumerate(functionType.getInputs())) { SmallVector decomposedTypes; if (failed(typeConverter->convertType(argType.value(), decomposedTypes))) return failure(); diff --git a/mlir/lib/Dialect/StandardOps/Transforms/FuncConversions.cpp b/mlir/lib/Dialect/StandardOps/Transforms/FuncConversions.cpp --- a/mlir/lib/Dialect/StandardOps/Transforms/FuncConversions.cpp +++ b/mlir/lib/Dialect/StandardOps/Transforms/FuncConversions.cpp @@ -146,10 +146,7 @@ // ReturnLike operations have to be legalized with their parent. For // return this is handled, for other ops they remain as is. - if (op->hasTrait()) - return true; - - return false; + return op->hasTrait(); } bool mlir::isNotBranchOpInterfaceOrReturnLikeOp(Operation *op) { diff --git a/mlir/lib/Dialect/StandardOps/Transforms/TensorConstantBufferize.cpp b/mlir/lib/Dialect/StandardOps/Transforms/TensorConstantBufferize.cpp --- a/mlir/lib/Dialect/StandardOps/Transforms/TensorConstantBufferize.cpp +++ b/mlir/lib/Dialect/StandardOps/Transforms/TensorConstantBufferize.cpp @@ -75,7 +75,7 @@ globals(globals) {} LogicalResult - matchAndRewrite(arith::ConstantOp op, OpAdaptor adaptor, + matchAndRewrite(arith::ConstantOp op, OpAdaptor /*adaptor*/, ConversionPatternRewriter &rewriter) const override { auto type = op.getType().dyn_cast(); if (!type) diff --git a/mlir/lib/Dialect/StandardOps/Utils/Utils.cpp b/mlir/lib/Dialect/StandardOps/Utils/Utils.cpp --- a/mlir/lib/Dialect/StandardOps/Utils/Utils.cpp +++ b/mlir/lib/Dialect/StandardOps/Utils/Utils.cpp @@ -28,7 +28,7 @@ /// constant in place of the corresponding sentinel value. void mlir::canonicalizeSubViewPart( SmallVectorImpl &values, - llvm::function_ref isDynamic) { + llvm::function_ref /*isDynamic*/) { for (OpFoldResult &ofr : values) { if (ofr.is()) continue; diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp --- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp +++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp @@ -48,14 +48,15 @@ //===--------------------------------------------------------------------===// /// All operations can be inlined by default. - bool isLegalToInline(Operation *op, Region *region, bool wouldBeCloned, - BlockAndValueMapping &map) const final { + bool isLegalToInline(Operation * /*op*/, Region * /*region*/, + bool /*wouldBeCloned*/, + BlockAndValueMapping & /*map*/) const final { return true; } /// All regions with If and While parent operators can be inlined. - bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned, - BlockAndValueMapping &map) const final { + bool isLegalToInline(Region *dest, Region * /*src*/, bool /*wouldBeCloned*/, + BlockAndValueMapping & /*map*/) const final { return (isa(dest->getParentOp()) || isa(dest->getParentOp())); } @@ -462,7 +463,7 @@ // Operator Folders. //===----------------------------------------------------------------------===// -OpFoldResult CastOp::fold(ArrayRef operands) { +OpFoldResult CastOp::fold(ArrayRef /*operands*/) { if (input().getType() == getType()) return input(); return {}; @@ -488,7 +489,7 @@ ReduceFolder(ReduceSumOp) #undef ReduceFolder - OpFoldResult ReshapeOp::fold(ArrayRef operands) { + OpFoldResult ReshapeOp::fold(ArrayRef /*operands*/) { auto inputTy = input1().getType().dyn_cast(); auto outputTy = getType().dyn_cast(); @@ -509,7 +510,7 @@ return {}; } -OpFoldResult SliceOp::fold(ArrayRef operands) { +OpFoldResult SliceOp::fold(ArrayRef /*operands*/) { auto inputTy = input().getType().dyn_cast(); auto outputTy = getType().dyn_cast(); @@ -521,7 +522,7 @@ return {}; } -OpFoldResult TileOp::fold(ArrayRef operands) { +OpFoldResult TileOp::fold(ArrayRef /*operands*/) { bool allOnes = true; for (Attribute val : multiples().getValue()) { allOnes = allOnes && val.cast().getValue().getSExtValue() == 1; @@ -796,8 +797,9 @@ } LogicalResult tosa::ArgMaxOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor inputShape = operands.getShape(0); IntegerAttr axis = attributes.get("axis").cast(); @@ -821,8 +823,9 @@ } LogicalResult tosa::ConcatOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { // Infer all dimension sizes by reducing based on inputs. int32_t axis = @@ -878,8 +881,9 @@ } LogicalResult tosa::FullyConnectedOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr /*attributes*/, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor inputShape = operands.getShape(0); ShapeAdaptor weightShape = operands.getShape(1); @@ -908,8 +912,9 @@ } LogicalResult tosa::MatMulOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr /*attributes*/, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor lhsShape = operands.getShape(0); ShapeAdaptor rhsShape = operands.getShape(1); @@ -935,8 +940,9 @@ } LogicalResult tosa::PadOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr /*attributes*/, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor inputShape = operands.getShape(0); ShapeAdaptor paddingShape = operands.getShape(1); @@ -991,8 +997,9 @@ } LogicalResult tosa::SliceOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { ArrayAttr sizes = SliceOpAdaptor(operands, attributes).size(); SmallVector outputShape; @@ -1006,8 +1013,9 @@ } LogicalResult tosa::TableOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr /*attributes*/, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor inputShape = operands.getShape(0); @@ -1022,8 +1030,9 @@ } LogicalResult tosa::TileOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { TileOpAdaptor adaptor(operands, attributes); ArrayAttr multiples = adaptor.multiples(); @@ -1056,8 +1065,9 @@ } LogicalResult tosa::ReshapeOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { ReshapeOpAdaptor adaptor(operands, attributes); ShapeAdaptor inputShape = operands.getShape(0); @@ -1095,8 +1105,9 @@ } LogicalResult tosa::TransposeOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr /*attributes*/, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor inputShape = operands.getShape(0); ShapeAdaptor permsShape = operands.getShape(1); @@ -1162,8 +1173,9 @@ } LogicalResult tosa::GatherOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr /*attributes*/, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector outputShape; outputShape.resize(3, ShapedType::kDynamicSize); @@ -1187,8 +1199,9 @@ } LogicalResult tosa::ResizeOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { ResizeOpAdaptor adaptor(operands, attributes); llvm::SmallVector outputShape; @@ -1258,8 +1271,9 @@ } LogicalResult tosa::ScatterOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr /*attributes*/, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector outputShape; outputShape.resize(3, ShapedType::kDynamicSize); @@ -1465,8 +1479,9 @@ } LogicalResult Conv2DOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector outputShape(4, ShapedType::kDynamicSize); Conv2DOp::Adaptor adaptor(operands.getValues(), attributes); @@ -1530,8 +1545,9 @@ } LogicalResult Conv3DOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector outputShape(5, ShapedType::kDynamicSize); Conv2DOp::Adaptor adaptor(operands.getValues(), attributes); @@ -1606,22 +1622,25 @@ } LogicalResult AvgPool2dOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { return poolingInferReturnTypes(operands, attributes, inferredReturnShapes); } LogicalResult MaxPool2dOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { return poolingInferReturnTypes(operands, attributes, inferredReturnShapes); } LogicalResult DepthwiseConv2DOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector outputShape(4, ShapedType::kDynamicSize); DepthwiseConv2DOp::Adaptor adaptor(operands.getValues(), attributes); @@ -1698,8 +1717,9 @@ } LogicalResult TransposeConv2DOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange operands, DictionaryAttr attributes, + RegionRange /*regions*/, SmallVectorImpl &inferredReturnShapes) { TransposeConv2DOp::Adaptor adaptor(operands.getValues(), attributes); llvm::SmallVector outputShape; @@ -1766,8 +1786,9 @@ } LogicalResult IfOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange /*operands*/, DictionaryAttr /*attributes*/, + RegionRange regions, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector yieldOps; for (Region *region : regions) { @@ -1791,7 +1812,7 @@ if (resultKnowledge.size() != yieldOp.getNumOperands()) return failure(); - for (auto it : llvm::enumerate(yieldOp.getOperands())) { + for (const auto &it : llvm::enumerate(yieldOp.getOperands())) { int32_t index = it.index(); auto meet = ValueKnowledge::meet( resultKnowledge[index], @@ -1810,8 +1831,9 @@ } LogicalResult WhileOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext * /*context*/, ::llvm::Optional /*location*/, + ValueShapeRange /*operands*/, DictionaryAttr /*attributes*/, + RegionRange regions, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector yieldOps; for (auto &block : *regions[1]) @@ -1835,7 +1857,7 @@ if (resultKnowledge.size() != yieldOp.getNumOperands()) return failure(); - for (auto it : llvm::enumerate(yieldOp.getOperands())) { + for (const auto &it : llvm::enumerate(yieldOp.getOperands())) { int32_t index = it.index(); if (auto meet = ValueKnowledge::meet( resultKnowledge[index], diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp --- a/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp +++ b/mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp @@ -132,7 +132,7 @@ } for (auto yieldOp : yieldOps) { - for (auto it : llvm::enumerate(yieldOp.getOperands())) { + for (const auto &it : llvm::enumerate(yieldOp.getOperands())) { auto newKnowledge = ValueKnowledge::getKnowledgeFromType(it.value().getType()); yieldTypeInfo[it.index()] = diff --git a/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp b/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp --- a/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp +++ b/mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp @@ -150,7 +150,7 @@ Optional> mlir::composeReassociationIndices( ArrayRef producerReassociations, ArrayRef consumerReassociations, - MLIRContext *context) { + MLIRContext * /*context*/) { SmallVector composedIndices; // Make the producer the larger sized vector. If they are of same size, the // resulting reshape is not a supported reshape op. @@ -215,14 +215,14 @@ OpBuilder &b, ArrayRef reassociation) { SmallVector reassociationAttr = llvm::to_vector<4>(llvm::map_range( - reassociation, [&](ReassociationIndices indices) -> Attribute { + reassociation, [&](const ReassociationIndices &indices) -> Attribute { return b.getI64ArrayAttr(indices).cast(); })); return b.getArrayAttr(reassociationAttr); } SmallVector mlir::convertReassociationMapsToIndices( - OpBuilder &b, ArrayRef reassociationExprs) { + OpBuilder & /*b*/, ArrayRef reassociationExprs) { SmallVector reassociationIndices; for (const auto &exprs : reassociationExprs) { ReassociationIndices indices; @@ -253,7 +253,7 @@ return true; unsigned nDims = reassociation[0].getNumDims(); unsigned nextExpectedDim = 0; - for (auto it : llvm::enumerate(reassociation)) { + for (const auto &it : llvm::enumerate(reassociation)) { auto m = it.value(); if (m.getNumDims() != nDims || m.getNumSymbols() != 0) { if (invalidIndex) diff --git a/mlir/test/lib/Conversion/StandardToLLVM/TestConvertCallOp.cpp b/mlir/test/lib/Conversion/StandardToLLVM/TestConvertCallOp.cpp --- a/mlir/test/lib/Conversion/StandardToLLVM/TestConvertCallOp.cpp +++ b/mlir/test/lib/Conversion/StandardToLLVM/TestConvertCallOp.cpp @@ -25,7 +25,7 @@ test::TestTypeProducerOp>::ConvertOpToLLVMPattern; LogicalResult - matchAndRewrite(test::TestTypeProducerOp op, OpAdaptor adaptor, + matchAndRewrite(test::TestTypeProducerOp op, OpAdaptor /*adaptor*/, ConversionPatternRewriter &rewriter) const override { rewriter.replaceOpWithNewOp(op, getVoidPtrType()); return success(); @@ -49,7 +49,7 @@ // Populate type conversions. LLVMTypeConverter typeConverter(m.getContext()); - typeConverter.addConversion([&](test::TestType type) { + typeConverter.addConversion([&](test::TestType /*type*/) { return LLVM::LLVMPointerType::get(IntegerType::get(m.getContext(), 8)); }); typeConverter.addConversion([&](test::SimpleAType type) { diff --git a/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp b/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp --- a/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp +++ b/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp @@ -34,7 +34,7 @@ return "Tests affine data copy utility functions."; } TestAffineDataCopy() = default; - TestAffineDataCopy(const TestAffineDataCopy &pass){}; + TestAffineDataCopy(const TestAffineDataCopy &pass) : PassWrapper(pass){}; void getDependentDialects(DialectRegistry ®istry) const override { registry.insert(); @@ -59,7 +59,7 @@ // Gather all AffineForOps by loop depth. std::vector> depthToLoops; gatherLoops(getFunction(), depthToLoops); - assert(depthToLoops.size() && "Loop nest not found"); + assert(!depthToLoops.empty() && "Loop nest not found"); // Only support tests with a single loop nest and a single innermost loop // for now. diff --git a/mlir/test/lib/Dialect/Affine/TestAffineLoopUnswitching.cpp b/mlir/test/lib/Dialect/Affine/TestAffineLoopUnswitching.cpp --- a/mlir/test/lib/Dialect/Affine/TestAffineLoopUnswitching.cpp +++ b/mlir/test/lib/Dialect/Affine/TestAffineLoopUnswitching.cpp @@ -30,7 +30,7 @@ return "Tests affine loop unswitching / if/else hoisting"; } TestAffineLoopUnswitching() = default; - TestAffineLoopUnswitching(const TestAffineLoopUnswitching &pass) {} + TestAffineLoopUnswitching(const TestAffineLoopUnswitching &pass) = default; void runOnFunction() override; diff --git a/mlir/test/lib/Dialect/Affine/TestLoopPermutation.cpp b/mlir/test/lib/Dialect/Affine/TestLoopPermutation.cpp --- a/mlir/test/lib/Dialect/Affine/TestLoopPermutation.cpp +++ b/mlir/test/lib/Dialect/Affine/TestLoopPermutation.cpp @@ -32,7 +32,7 @@ return "Tests affine loop permutation utility"; } TestLoopPermutation() = default; - TestLoopPermutation(const TestLoopPermutation &pass){}; + TestLoopPermutation(const TestLoopPermutation &pass) : PassWrapper(pass){}; void runOnFunction() override; diff --git a/mlir/test/lib/Dialect/Linalg/TestComprehensiveBufferize.cpp b/mlir/test/lib/Dialect/Linalg/TestComprehensiveBufferize.cpp --- a/mlir/test/lib/Dialect/Linalg/TestComprehensiveBufferize.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestComprehensiveBufferize.cpp @@ -49,7 +49,8 @@ TestComprehensiveFunctionBufferize() = default; TestComprehensiveFunctionBufferize( - const TestComprehensiveFunctionBufferize &pass) {} + const TestComprehensiveFunctionBufferize &pass) + : PassWrapper(pass) {} void getDependentDialects(DialectRegistry ®istry) const override { registry.insert + #include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/GPU/GPUDialect.h" #include "mlir/Dialect/Linalg/IR/Linalg.h" @@ -33,7 +35,8 @@ return "Test Linalg Codegen Strategy."; } TestLinalgCodegenStrategy() = default; - TestLinalgCodegenStrategy(const TestLinalgCodegenStrategy &pass) {} + TestLinalgCodegenStrategy(const TestLinalgCodegenStrategy &pass) + : PassWrapper(pass) {} void getDependentDialects(DialectRegistry ®istry) const override { // clang-format off @@ -174,19 +177,20 @@ CodegenStrategy strategy; strategy .tileAndFuseIf(fuse && !tileSizes.empty(), anchorOpName, - tilingAndFusionOptions) - .tileIf(!fuse && !tileSizes.empty(), anchorOpName, tilingOptions) + std::move(tilingAndFusionOptions)) + .tileIf(!fuse && !tileSizes.empty(), anchorOpName, + std::move(tilingOptions)) .promoteIf(!fuse && promote, anchorOpName, LinalgPromotionOptions() .setAlignment(16) .setUseFullTileBuffersByDefault(promoteFullTile)) .tileIf(!fuse && !registerTileSizes.empty(), anchorOpName, - registerTilingOptions) + std::move(registerTilingOptions)) .promoteIf(!fuse && registerPromote, anchorOpName, LinalgPromotionOptions() .setAlignment(16) .setUseFullTileBuffersByDefault(registerPromoteFullTile)) - .padIf(pad, "", paddingOptions) + .padIf(pad, "", std::move(paddingOptions)) .decomposeIf(decompose) .generalizeIf(generalize, "") .interchangeIf(!iteratorInterchange.empty(), iteratorInterchange) diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgDistribution.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgDistribution.cpp --- a/mlir/test/lib/Dialect/Linalg/TestLinalgDistribution.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestLinalgDistribution.cpp @@ -43,7 +43,7 @@ StringRef getArgument() const final { return "test-linalg-distribution"; } StringRef getDescription() const final { return "Test Linalg distribution."; } TestLinalgDistribution() = default; - TestLinalgDistribution(const TestLinalgDistribution &pass) {} + TestLinalgDistribution(const TestLinalgDistribution &pass) = default; void getDependentDialects(DialectRegistry ®istry) const override { registry.insert(); } diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp --- a/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp @@ -264,7 +264,8 @@ } TestLinalgTileAndFuseSequencePass() = default; TestLinalgTileAndFuseSequencePass( - const TestLinalgTileAndFuseSequencePass &pass){}; + const TestLinalgTileAndFuseSequencePass &pass) + : PassWrapper(pass){}; ListOption tileSizes{ *this, "tile-sizes", llvm::cl::desc("Tile sizes to use for ops"), diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgHoisting.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgHoisting.cpp --- a/mlir/test/lib/Dialect/Linalg/TestLinalgHoisting.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestLinalgHoisting.cpp @@ -22,7 +22,7 @@ struct TestLinalgHoisting : public PassWrapper { TestLinalgHoisting() = default; - TestLinalgHoisting(const TestLinalgHoisting &pass) {} + TestLinalgHoisting(const TestLinalgHoisting &pass) : PassWrapper(pass) {} void getDependentDialects(DialectRegistry ®istry) const override { registry.insert(); } diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp --- a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp @@ -34,7 +34,7 @@ struct TestLinalgTransforms : public PassWrapper { TestLinalgTransforms() = default; - TestLinalgTransforms(const TestLinalgTransforms &pass) {} + TestLinalgTransforms(const TestLinalgTransforms &pass) : PassWrapper(pass) {} void getDependentDialects(DialectRegistry ®istry) const override { // clang-format off @@ -305,7 +305,7 @@ // Allocation call back static Optional allocCallBackFn(OpBuilder &b, memref::SubViewOp subView, ArrayRef boundingSubViewSize, - DataLayout &layout) { + DataLayout & /*layout*/) { SmallVector shape(boundingSubViewSize.size(), -1); return b .create( @@ -528,8 +528,7 @@ llvm::move(stage1Patterns, std::back_inserter(frozenStage1Patterns)); FrozenRewritePatternSet stage2Patterns = getLinalgTilingCanonicalizationPatterns(ctx); - (void)applyStagedPatterns(funcOp, frozenStage1Patterns, - std::move(stage2Patterns)); + (void)applyStagedPatterns(funcOp, frozenStage1Patterns, stage2Patterns); } static void applyVectorTransferForwardingPatterns(FuncOp funcOp) { @@ -568,7 +567,7 @@ (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); } -static void applyTilePattern(FuncOp funcOp, std::string loopType, +static void applyTilePattern(FuncOp funcOp, const std::string &loopType, ArrayRef tileSizes, ArrayRef peeledLoops, bool scalarizeDynamicDims) { diff --git a/mlir/test/lib/Dialect/Math/TestPolynomialApproximation.cpp b/mlir/test/lib/Dialect/Math/TestPolynomialApproximation.cpp --- a/mlir/test/lib/Dialect/Math/TestPolynomialApproximation.cpp +++ b/mlir/test/lib/Dialect/Math/TestPolynomialApproximation.cpp @@ -26,7 +26,8 @@ : public PassWrapper { TestMathPolynomialApproximationPass() = default; TestMathPolynomialApproximationPass( - const TestMathPolynomialApproximationPass &pass) {} + const TestMathPolynomialApproximationPass &pass) + : PassWrapper(pass) {} void runOnFunction() override; void getDependentDialects(DialectRegistry ®istry) const override { diff --git a/mlir/test/lib/Dialect/StandardOps/TestDecomposeCallGraphTypes.cpp b/mlir/test/lib/Dialect/StandardOps/TestDecomposeCallGraphTypes.cpp --- a/mlir/test/lib/Dialect/StandardOps/TestDecomposeCallGraphTypes.cpp +++ b/mlir/test/lib/Dialect/StandardOps/TestDecomposeCallGraphTypes.cpp @@ -71,7 +71,7 @@ }); typeConverter.addArgumentMaterialization( - [](OpBuilder &builder, TupleType resultType, ValueRange inputs, + [](OpBuilder &builder, TupleType /*resultType*/, ValueRange inputs, Location loc) -> Optional { if (inputs.size() == 1) return llvm::None; diff --git a/mlir/test/lib/Dialect/Test/TestAttributes.cpp b/mlir/test/lib/Dialect/Test/TestAttributes.cpp --- a/mlir/test/lib/Dialect/Test/TestAttributes.cpp +++ b/mlir/test/lib/Dialect/Test/TestAttributes.cpp @@ -29,7 +29,7 @@ // AttrWithSelfTypeParamAttr //===----------------------------------------------------------------------===// -Attribute AttrWithSelfTypeParamAttr::parse(AsmParser &parser, Type type) { +Attribute AttrWithSelfTypeParamAttr::parse(AsmParser &parser, Type /*type*/) { Type selfType; if (parser.parseType(selfType)) return Attribute(); @@ -44,7 +44,7 @@ // AttrWithTypeBuilderAttr //===----------------------------------------------------------------------===// -Attribute AttrWithTypeBuilderAttr::parse(AsmParser &parser, Type type) { +Attribute AttrWithTypeBuilderAttr::parse(AsmParser &parser, Type /*type*/) { IntegerAttr element; if (parser.parseAttribute(element)) return Attribute(); @@ -59,7 +59,7 @@ // CompoundAAttr //===----------------------------------------------------------------------===// -Attribute CompoundAAttr::parse(AsmParser &parser, Type type) { +Attribute CompoundAAttr::parse(AsmParser &parser, Type /*type*/) { int widthOfSomething; Type oneType; SmallVector arrayOfInts; @@ -129,8 +129,8 @@ LogicalResult TestAttrWithFormatAttr::verify(function_ref emitError, - int64_t one, std::string two, IntegerAttr three, - ArrayRef four) { + int64_t one, std::string /*two*/, + IntegerAttr /*three*/, ArrayRef four) { if (four.size() != static_cast(one)) return emitError() << "expected 'one' to equal 'four.size()'"; return success(); @@ -162,7 +162,7 @@ //===----------------------------------------------------------------------===// Attribute TestSubElementsAccessAttr::parse(::mlir::AsmParser &parser, - ::mlir::Type type) { + ::mlir::Type /*type*/) { Attribute first, second, third; if (parser.parseLess() || parser.parseAttribute(first) || parser.parseComma() || parser.parseAttribute(second) || @@ -180,7 +180,7 @@ void TestSubElementsAccessAttr::walkImmediateSubElements( llvm::function_ref walkAttrsFn, - llvm::function_ref walkTypesFn) const { + llvm::function_ref /*walkTypesFn*/) const { walkAttrsFn(getFirst()); walkAttrsFn(getSecond()); walkAttrsFn(getThird()); diff --git a/mlir/test/lib/Dialect/Test/TestPatterns.cpp b/mlir/test/lib/Dialect/Test/TestPatterns.cpp --- a/mlir/test/lib/Dialect/Test/TestPatterns.cpp +++ b/mlir/test/lib/Dialect/Test/TestPatterns.cpp @@ -182,7 +182,7 @@ if (failed(shapedOp.reifyReturnTypeShapes(b, op->getOperands(), shapes)) || !llvm::hasSingleElement(shapes)) return; - for (auto it : llvm::enumerate(shapes)) { + for (const auto &it : llvm::enumerate(shapes)) { op->emitRemark() << "value " << it.index() << ": " << it.value().getDefiningOp(); } diff --git a/mlir/test/lib/Dialect/Test/TestTraits.cpp b/mlir/test/lib/Dialect/Test/TestTraits.cpp --- a/mlir/test/lib/Dialect/Test/TestTraits.cpp +++ b/mlir/test/lib/Dialect/Test/TestTraits.cpp @@ -18,13 +18,13 @@ //===----------------------------------------------------------------------===// OpFoldResult TestInvolutionTraitFailingOperationFolderOp::fold( - ArrayRef operands) { + ArrayRef /*operands*/) { // This failure should cause the trait fold to run instead. return {}; } OpFoldResult TestInvolutionTraitSuccesfulOperationFolderOp::fold( - ArrayRef operands) { + ArrayRef /*operands*/) { auto argumentOp = getOperand(); // The success case should cause the trait fold to be supressed. return argumentOp.getDefiningOp() ? argumentOp : OpFoldResult{}; diff --git a/mlir/test/lib/Dialect/Test/TestTypes.cpp b/mlir/test/lib/Dialect/Test/TestTypes.cpp --- a/mlir/test/lib/Dialect/Test/TestTypes.cpp +++ b/mlir/test/lib/Dialect/Test/TestTypes.cpp @@ -121,9 +121,9 @@ // Example type validity checker. LogicalResult -TestIntegerType::verify(function_ref emitError, +TestIntegerType::verify(function_ref /*emitError*/, unsigned width, - TestIntegerType::SignednessSemantics ss) { + TestIntegerType::SignednessSemantics /*ss*/) { if (width > 8) return failure(); return success(); @@ -153,19 +153,19 @@ } unsigned -TestTypeWithLayoutType::getTypeSizeInBits(const DataLayout &dataLayout, +TestTypeWithLayoutType::getTypeSizeInBits(const DataLayout & /*dataLayout*/, DataLayoutEntryListRef params) const { return extractKind(params, "size"); } unsigned -TestTypeWithLayoutType::getABIAlignment(const DataLayout &dataLayout, +TestTypeWithLayoutType::getABIAlignment(const DataLayout & /*dataLayout*/, DataLayoutEntryListRef params) const { return extractKind(params, "alignment"); } unsigned TestTypeWithLayoutType::getPreferredAlignment( - const DataLayout &dataLayout, DataLayoutEntryListRef params) const { + const DataLayout & /*dataLayout*/, DataLayoutEntryListRef params) const { return extractKind(params, "preferred"); } @@ -177,7 +177,7 @@ LogicalResult TestTypeWithLayoutType::verifyEntries(DataLayoutEntryListRef params, - Location loc) const { + Location /*loc*/) const { for (DataLayoutEntryInterface entry : params) { // This is for testing purposes only, so assert well-formedness. assert(entry.isTypeEntry() && "unexpected identifier entry"); diff --git a/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp b/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp --- a/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp +++ b/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp @@ -71,7 +71,7 @@ double typeRangeMax = double(outputElementType.getStorageTypeMax() - outputElementType.getZeroPoint()) * outputElementType.getScale(); - bool narrowRange = outputElementType.getStorageTypeMin() == 1 ? true : false; + bool narrowRange = outputElementType.getStorageTypeMin() == 1; auto dstQConstType = RankedTensorType::get( outputType.getShape(), diff --git a/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp b/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp --- a/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp +++ b/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp @@ -31,7 +31,8 @@ struct TestVectorToVectorLowering : public PassWrapper { TestVectorToVectorLowering() = default; - TestVectorToVectorLowering(const TestVectorToVectorLowering &pass) {} + TestVectorToVectorLowering(const TestVectorToVectorLowering &pass) + : PassWrapper(pass) {} StringRef getArgument() const final { return "test-vector-to-vector-lowering"; } @@ -110,7 +111,8 @@ "dialect"; } TestVectorContractionLowering() = default; - TestVectorContractionLowering(const TestVectorContractionLowering &pass) {} + TestVectorContractionLowering(const TestVectorContractionLowering &pass) + : PassWrapper(pass) {} Option lowerToFlatMatrix{ *this, "vector-lower-matrix-intrinsics", @@ -182,7 +184,8 @@ "dialect"; } TestVectorTransposeLowering() = default; - TestVectorTransposeLowering(const TestVectorTransposeLowering &pass) {} + TestVectorTransposeLowering(const TestVectorTransposeLowering &pass) + : PassWrapper(pass) {} Option lowerToEltwise{ *this, "eltwise", @@ -253,7 +256,8 @@ "dialect"; } TestVectorUnrollingPatterns() = default; - TestVectorUnrollingPatterns(const TestVectorUnrollingPatterns &pass) {} + TestVectorUnrollingPatterns(const TestVectorUnrollingPatterns &pass) + : PassWrapper(pass) {} void runOnFunction() override { MLIRContext *ctx = &getContext(); RewritePatternSet patterns(ctx); @@ -312,7 +316,8 @@ "dialect"; } TestVectorDistributePatterns() = default; - TestVectorDistributePatterns(const TestVectorDistributePatterns &pass) {} + TestVectorDistributePatterns(const TestVectorDistributePatterns &pass) + : PassWrapper(pass) {} void getDependentDialects(DialectRegistry ®istry) const override { registry.insert(); registry.insert(); @@ -365,7 +370,8 @@ return "Test lowering patterns to break up a vector op into a for loop"; } TestVectorToLoopPatterns() = default; - TestVectorToLoopPatterns(const TestVectorToLoopPatterns &pass) {} + TestVectorToLoopPatterns(const TestVectorToLoopPatterns &pass) + : PassWrapper(pass) {} void getDependentDialects(DialectRegistry ®istry) const override { registry.insert(); registry.insert(); @@ -385,9 +391,7 @@ type.getNumElements() % multiplicity != 0) return mlir::WalkResult::advance(); auto filterAlloc = [](Operation *op) { - if (isa(op)) - return false; - return true; + return !isa(op); }; auto dependentOps = getSlice(op, filterAlloc); // Create a loop and move instructions from the Op slice into the loop. @@ -456,7 +460,8 @@ } TestVectorTransferFullPartialSplitPatterns() = default; TestVectorTransferFullPartialSplitPatterns( - const TestVectorTransferFullPartialSplitPatterns &pass) {} + const TestVectorTransferFullPartialSplitPatterns &pass) + : PassWrapper(pass) {} void getDependentDialects(DialectRegistry ®istry) const override { registry.insert { TestVectorMultiReductionLoweringPatterns() = default; TestVectorMultiReductionLoweringPatterns( - const TestVectorMultiReductionLoweringPatterns &pass) {} + const TestVectorMultiReductionLoweringPatterns &pass) + : PassWrapper(pass) {} void getDependentDialects(DialectRegistry ®istry) const override { registry.insert(); } @@ -544,7 +550,7 @@ FunctionPass> { TestVectorTransferCollapseInnerMostContiguousDims() = default; TestVectorTransferCollapseInnerMostContiguousDims( - const TestVectorTransferCollapseInnerMostContiguousDims &pass) {} + const TestVectorTransferCollapseInnerMostContiguousDims &pass) = default; void getDependentDialects(DialectRegistry ®istry) const override { registry.insert(); diff --git a/mlir/test/lib/IR/TestPrintDefUse.cpp b/mlir/test/lib/IR/TestPrintDefUse.cpp --- a/mlir/test/lib/IR/TestPrintDefUse.cpp +++ b/mlir/test/lib/IR/TestPrintDefUse.cpp @@ -41,7 +41,7 @@ // Print information about the user of each of the result. llvm::outs() << "Has " << op->getNumResults() << " results:\n"; - for (auto indexedResult : llvm::enumerate(op->getResults())) { + for (const auto &indexedResult : llvm::enumerate(op->getResults())) { Value result = indexedResult.value(); llvm::outs() << " - Result " << indexedResult.index(); if (result.use_empty()) { diff --git a/mlir/test/lib/IR/TestSlicing.cpp b/mlir/test/lib/IR/TestSlicing.cpp --- a/mlir/test/lib/IR/TestSlicing.cpp +++ b/mlir/test/lib/IR/TestSlicing.cpp @@ -33,7 +33,7 @@ builder.create(loc, clonedFuncOpName, parentFuncOp.getType()); BlockAndValueMapping mapper; builder.setInsertionPointToEnd(clonedFuncOp.addEntryBlock()); - for (auto arg : enumerate(parentFuncOp.getArguments())) + for (const auto &arg : enumerate(parentFuncOp.getArguments())) mapper.map(arg.value(), clonedFuncOp.getArgument(arg.index())); SetVector slice; getBackwardSlice(op, &slice); diff --git a/mlir/test/lib/Rewrite/TestPDLByteCode.cpp b/mlir/test/lib/Rewrite/TestPDLByteCode.cpp --- a/mlir/test/lib/Rewrite/TestPDLByteCode.cpp +++ b/mlir/test/lib/Rewrite/TestPDLByteCode.cpp @@ -13,9 +13,9 @@ using namespace mlir; /// Custom constraint invoked from PDL. -static LogicalResult customSingleEntityConstraint(PDLValue value, - ArrayAttr constantParams, - PatternRewriter &rewriter) { +static LogicalResult +customSingleEntityConstraint(PDLValue value, ArrayAttr /*constantParams*/, + PatternRewriter & /*rewriter*/) { Operation *rootOp = value.cast(); return success(rootOp->getName().getStringRef() == "test.op"); } @@ -26,8 +26,8 @@ } static LogicalResult customMultiEntityVariadicConstraint(ArrayRef values, - ArrayAttr constantParams, - PatternRewriter &rewriter) { + ArrayAttr /*constantParams*/, + PatternRewriter & /*rewriter*/) { if (llvm::any_of(values, [](const PDLValue &value) { return !value; })) return failure(); ValueRange operandValues = values[0].cast(); @@ -38,20 +38,21 @@ } // Custom creator invoked from PDL. -static void customCreate(ArrayRef args, ArrayAttr constantParams, +static void customCreate(ArrayRef args, ArrayAttr /*constantParams*/, PatternRewriter &rewriter, PDLResultList &results) { results.push_back(rewriter.createOperation( OperationState(args[0].cast()->getLoc(), "test.success"))); } static void customVariadicResultCreate(ArrayRef args, - ArrayAttr constantParams, - PatternRewriter &rewriter, + ArrayAttr /*constantParams*/, + PatternRewriter & /*rewriter*/, PDLResultList &results) { Operation *root = args[0].cast(); results.push_back(root->getOperands()); results.push_back(root->getOperands().getTypes()); } -static void customCreateType(ArrayRef args, ArrayAttr constantParams, +static void customCreateType(ArrayRef /*args*/, + ArrayAttr /*constantParams*/, PatternRewriter &rewriter, PDLResultList &results) { results.push_back(rewriter.getF32Type()); @@ -59,7 +60,8 @@ /// Custom rewriter invoked from PDL. static void customRewriter(ArrayRef args, ArrayAttr constantParams, - PatternRewriter &rewriter, PDLResultList &results) { + PatternRewriter &rewriter, + PDLResultList & /*results*/) { Operation *root = args[0].cast(); OperationState successOpState(root->getLoc(), "test.success"); successOpState.addOperands(args[1].cast()); diff --git a/mlir/test/lib/Transforms/TestLoopFusion.cpp b/mlir/test/lib/Transforms/TestLoopFusion.cpp --- a/mlir/test/lib/Transforms/TestLoopFusion.cpp +++ b/mlir/test/lib/Transforms/TestLoopFusion.cpp @@ -131,7 +131,7 @@ // ['loopDepth' + 1, 'maxLoopDepth']. // Returns true if loops were successfully fused, false otherwise. static bool testLoopFusionTransformation(AffineForOp forOpA, AffineForOp forOpB, - unsigned i, unsigned j, + unsigned /*i*/, unsigned /*j*/, unsigned loopDepth, unsigned maxLoopDepth) { for (unsigned d = loopDepth + 1; d <= maxLoopDepth; ++d) { @@ -186,7 +186,7 @@ // Try to fuse all combinations of src/dst loop nests in 'depthToLoops'. } while (iterateLoops(depthToLoops, testLoopFusionTransformation, - /*return_on_change=*/true)); + /*returnOnChange=*/true)); return; } diff --git a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp --- a/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp +++ b/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp @@ -361,7 +361,7 @@ static Optional findTensorDefArgIndex(StringRef name, SmallVectorImpl &args) { - for (auto it : llvm::enumerate(args)) { + for (const auto &it : llvm::enumerate(args)) { if (it.value().name == name) return it.index(); } @@ -382,7 +382,7 @@ return std::string("helper.getFloat64Type()"); // Search all argument types. - for (auto it : llvm::enumerate(args)) { + for (const auto &it : llvm::enumerate(args)) { if (it.value().typeVar == typeVar) return llvm::formatv("block.getArgument({0}).getType()", it.index()) .str(); diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp --- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp +++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp @@ -561,7 +561,7 @@ MethodParameter("const KeyTy &", "tblgenKey")); if (!def.hasStorageCustomConstructor()) { auto &body = construct->body().indent(); - for (auto it : llvm::enumerate(params)) { + for (const auto &it : llvm::enumerate(params)) { body << formatv("auto {0} = std::get<{1}>(tblgenKey);\n", it.value().getName(), it.index()); } diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp --- a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp +++ b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp @@ -541,7 +541,7 @@ /// Parse a literal element. FailureOr> parseLiteral(ParserContext ctx); /// Parse a variable element. - FailureOr> parseVariable(ParserContext ctx); + FailureOr> parseVariable(); /// Parse a directive. FailureOr> parseDirective(ParserContext ctx); /// Parse a `params` directive. @@ -591,7 +591,7 @@ if (curToken.getKind() == FormatToken::literal) return parseLiteral(ctx); if (curToken.getKind() == FormatToken::variable) - return parseVariable(ctx); + return parseVariable(); if (curToken.isKeyword()) return parseDirective(ctx); @@ -617,8 +617,7 @@ return {std::make_unique(value)}; } -FailureOr> -FormatParser::parseVariable(ParserContext ctx) { +FailureOr> FormatParser::parseVariable() { /// Get the parameter name without the preceding "$". auto name = curToken.getSpelling().drop_front(); @@ -661,7 +660,7 @@ /// Collect all of the attribute's or type's parameters. SmallVector> vars; /// Ensure that none of the parameters have already been captured. - for (auto it : llvm::enumerate(def.getParameters())) { + for (const auto &it : llvm::enumerate(def.getParameters())) { if (seenParams.test(it.index())) { return emitError("`params` captures duplicate parameter: " + it.value().getName()); diff --git a/mlir/tools/mlir-tblgen/DialectGen.cpp b/mlir/tools/mlir-tblgen/DialectGen.cpp --- a/mlir/tools/mlir-tblgen/DialectGen.cpp +++ b/mlir/tools/mlir-tblgen/DialectGen.cpp @@ -185,10 +185,11 @@ )"; /// Generate the declaration for the given dialect class. -static void emitDialectDecl(Dialect &dialect, - iterator_range dialectAttrs, - iterator_range dialectTypes, - raw_ostream &os) { +static void +emitDialectDecl(Dialect &dialect, + const iterator_range &dialectAttrs, + const iterator_range &dialectTypes, + raw_ostream &os) { /// Build the list of dependent dialects std::string dependentDialectRegistrations; { diff --git a/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp b/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp --- a/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp +++ b/mlir/tools/mlir-tblgen/DirectiveCommonGen.cpp @@ -43,18 +43,18 @@ static bool emitDecls(const RecordKeeper &recordKeeper, raw_ostream &os) { const auto &directiveLanguages = recordKeeper.getAllDerivedDefinitions("DirectiveLanguage"); - assert(directiveLanguages.size() != 0 && "DirectiveLanguage missing."); + assert(!directiveLanguages.empty() && "DirectiveLanguage missing."); const auto &clauses = recordKeeper.getAllDerivedDefinitions("Clause"); for (const auto &r : clauses) { Clause c{r}; const auto &clauseVals = c.getClauseVals(); - if (clauseVals.size() <= 0) + if (clauseVals.empty()) continue; const auto enumName = c.getEnumName(); - assert(enumName.size() != 0 && "enumClauseValue field not set."); + assert(!enumName.empty() && "enumClauseValue field not set."); std::vector cvDefs; for (const auto &cv : clauseVals) { diff --git a/mlir/tools/mlir-tblgen/EnumsGen.cpp b/mlir/tools/mlir-tblgen/EnumsGen.cpp --- a/mlir/tools/mlir-tblgen/EnumsGen.cpp +++ b/mlir/tools/mlir-tblgen/EnumsGen.cpp @@ -42,8 +42,8 @@ return str.str(); } -static void emitEnumClass(const Record &enumDef, StringRef enumName, - StringRef underlyingType, StringRef description, +static void emitEnumClass(StringRef enumName, StringRef underlyingType, + StringRef description, const std::vector &enumerants, raw_ostream &os) { os << "// " << description << "\n"; @@ -426,7 +426,7 @@ os << "namespace " << ns << " {\n"; // Emit the enum class definition - emitEnumClass(enumDef, enumName, underlyingType, description, enumerants, os); + emitEnumClass(enumName, underlyingType, description, enumerants, os); // Emit conversion function declarations if (llvm::all_of(enumerants, [](EnumAttrCase enumerant) { diff --git a/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp b/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp --- a/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp +++ b/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp @@ -65,7 +65,7 @@ const char *listName) { auto results = record.getValueAsListOfDefs(listName); IndicesTy overloadedOps(results.size()); - for (auto r : llvm::enumerate(results)) { + for (const auto &r : llvm::enumerate(results)) { llvm::MVT::SimpleValueType vt = getValueType(r.value()); switch (vt) { case llvm::MVT::iAny: diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -931,8 +931,7 @@ bool isAdaptor, StringRef sizeAttrInit, StringRef rangeType, StringRef rangeBeginCall, - StringRef rangeSizeCall, - StringRef getOperandCallPattern) { + StringRef rangeSizeCall) { const int numOperands = op.getNumOperands(); const int numVariadicOperands = op.getNumVariableLengthOperands(); const int numNormalOperands = numOperands - numVariadicOperands; @@ -1029,8 +1028,7 @@ /*sizeAttrInit=*/attrSizeInitCode, /*rangeType=*/"::mlir::Operation::operand_range", /*rangeBeginCall=*/"getOperation()->operand_begin()", - /*rangeSizeCall=*/"getOperation()->getNumOperands()", - /*getOperandCallPattern=*/"getOperation()->getOperand({0})"); + /*rangeSizeCall=*/"getOperation()->getNumOperands()"); } void OpEmitter::genNamedOperandSetters() { @@ -2267,7 +2265,7 @@ body << " {\n unsigned index = 0; (void)index;\n"; - for (auto staticValue : llvm::enumerate(values)) { + for (const auto &staticValue : llvm::enumerate(values)) { const NamedTypeConstraint &value = staticValue.value(); bool hasPredicate = value.hasPredicate(); @@ -2332,7 +2330,7 @@ return; body << " {\n unsigned index = 0; (void)index;\n"; - for (auto it : llvm::enumerate(regions)) { + for (const auto &it : llvm::enumerate(regions)) { const auto ®ion = it.value(); if (canSkip(region)) continue; @@ -2582,8 +2580,7 @@ /*isAdaptor=*/true, sizeAttrInit, /*rangeType=*/"::mlir::ValueRange", /*rangeBeginCall=*/"odsOperands.begin()", - /*rangeSizeCall=*/"odsOperands.size()", - /*getOperandCallPattern=*/"odsOperands[{0}]"); + /*rangeSizeCall=*/"odsOperands.size()"); FmtContext fctx; fctx.withBuilder("::mlir::Builder(odsAttrs.getContext())"); diff --git a/mlir/tools/mlir-tblgen/OpDocGen.cpp b/mlir/tools/mlir-tblgen/OpDocGen.cpp --- a/mlir/tools/mlir-tblgen/OpDocGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDocGen.cpp @@ -88,7 +88,7 @@ os << "```\n\n"; } -static void emitOpTraitsDoc(Operator op, raw_ostream &os) { +static void emitOpTraitsDoc(const Operator &op, raw_ostream &os) { // TODO: We should link to the trait/documentation of it. That also means we // should add descriptions to traits that can be queried. // Collect using set to sort effects, interfaces & traits. @@ -235,7 +235,7 @@ os << "\nSyntax:\n\n```\n!" << def.getDialect().getName() << "." << def.getMnemonic() << "<\n"; - for (auto it : llvm::enumerate(parameters)) { + for (const auto &it : llvm::enumerate(parameters)) { const AttrOrTypeParameter ¶m = it.value(); os << " " << param.getSyntax(); if (it.index() < (parameters.size() - 1)) diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp --- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp +++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp @@ -1374,7 +1374,7 @@ operand->getVar()->constraint.getCPPClassName(), listName); }) - .Default([&](auto operand) { + .Default([&](auto /*operand*/) { body << formatv(typeParserCode, "Type", listName); }); } @@ -2217,7 +2217,7 @@ /// attribute. void handleTypesMatchConstraint( llvm::StringMap &variableTyResolver, - llvm::Record def); + const llvm::Record &def); /// Returns an argument or attribute with the given name that has been seen /// within the format. @@ -2621,7 +2621,7 @@ void FormatParser::handleTypesMatchConstraint( llvm::StringMap &variableTyResolver, - llvm::Record def) { + const llvm::Record &def) { StringRef lhsName = def.getValueAsString("lhs"); StringRef rhsName = def.getValueAsString("rhs"); StringRef transformer = def.getValueAsString("transformer"); diff --git a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp --- a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp +++ b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp @@ -154,7 +154,7 @@ // GEN: Interface definitions //===----------------------------------------------------------------------===// -static void emitInterfaceDef(Interface interface, StringRef valueType, +static void emitInterfaceDef(const Interface &interface, StringRef valueType, raw_ostream &os) { StringRef interfaceName = interface.getName(); StringRef cppNamespace = interface.getCppNamespace(); diff --git a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp --- a/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp +++ b/mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp @@ -916,7 +916,7 @@ /// Emits named accessors to regions. static void emitRegionAccessors(const Operator &op, raw_ostream &os) { - for (auto en : llvm::enumerate(op.getRegions())) { + for (const auto &en : llvm::enumerate(op.getRegions())) { const NamedRegion ®ion = en.value(); if (region.name.empty()) continue; diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp --- a/mlir/tools/mlir-tblgen/RewriterGen.cpp +++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp @@ -46,7 +46,7 @@ template <> struct format_provider { static void format(const mlir::tblgen::Pattern::IdentifierLine &v, - raw_ostream &os, StringRef style) { + raw_ostream &os, StringRef /*style*/) { os << v.first << ":" << v.second; } }; @@ -114,8 +114,7 @@ // Emits C++ statements for matching the `argIndex`-th argument of the given // DAG `tree` as an attribute. - void emitAttributeMatch(DagNode tree, StringRef opName, int argIndex, - int depth); + void emitAttributeMatch(DagNode tree, StringRef opName, int argIndex); // Emits C++ for checking a match with a corresponding match failure // diagnostic. @@ -192,13 +191,12 @@ // Emits the concrete arguments used to call an op's builder. void supplyValuesForOpArgs(DagNode node, - const ChildNodeIndexNameMap &childNodeNames, - int depth); + const ChildNodeIndexNameMap &childNodeNames); // Emits the local variables for holding all values as a whole and all named // attributes as a whole to be used for creating an op. void createAggregateLocalVarsForOpArgs( - DagNode node, const ChildNodeIndexNameMap &childNodeNames, int depth); + DagNode node, const ChildNodeIndexNameMap &childNodeNames); // Returns the C++ expression to construct a constant attribute of the given // `value` for the given attribute kind `attr`. @@ -282,7 +280,7 @@ void populateStaticMatchers(raw_ostream &os); // Emit all static functions for Constraints. - void populateStaticConstraintFunctions(raw_ostream &os); + void populateStaticConstraintFunctions(); private: static constexpr unsigned kStaticMatcherThreshold = 1; @@ -631,7 +629,7 @@ /*argIndex=*/i); ++nextOperand; } else if (opArg.is()) { - emitAttributeMatch(tree, opName, i, depth); + emitAttributeMatch(tree, opName, i); } else { PrintFatalError(loc, "unhandled case when matching op"); } @@ -754,7 +752,7 @@ } void PatternEmitter::emitAttributeMatch(DagNode tree, StringRef opName, - int argIndex, int depth) { + int argIndex) { Operator &op = tree.getDialectOp(opMap); auto *namedAttr = op.getArg(argIndex).get(); const auto &attr = namedAttr->attr; @@ -1440,7 +1438,7 @@ // create the ops. // First prepare local variables for op arguments used in builder call. - createAggregateLocalVarsForOpArgs(tree, childNodeNames, depth); + createAggregateLocalVarsForOpArgs(tree, childNodeNames); // Then create the op. os.scope("", "\n}\n").os << formatv( @@ -1464,7 +1462,7 @@ os.scope().os << formatv("{0} = rewriter.create<{1}>({2}", valuePackName, resultOp.getQualCppClassName(), locToUse); - supplyValuesForOpArgs(tree, childNodeNames, depth); + supplyValuesForOpArgs(tree, childNodeNames); os << "\n );\n}\n"; return resultValue; } @@ -1479,7 +1477,7 @@ "return values replace the source pattern's root op"); // First prepare local variables for op arguments used in builder call. - createAggregateLocalVarsForOpArgs(tree, childNodeNames, depth); + createAggregateLocalVarsForOpArgs(tree, childNodeNames); // Then prepare the result types. We need to specify the types for all // results. @@ -1566,7 +1564,7 @@ } void PatternEmitter::supplyValuesForOpArgs( - DagNode node, const ChildNodeIndexNameMap &childNodeNames, int depth) { + DagNode node, const ChildNodeIndexNameMap &childNodeNames) { Operator &resultOp = node.getDialectOp(opMap); for (int argIndex = 0, numOpArgs = resultOp.getNumArgs(); argIndex != numOpArgs; ++argIndex) { @@ -1608,7 +1606,7 @@ } void PatternEmitter::createAggregateLocalVarsForOpArgs( - DagNode node, const ChildNodeIndexNameMap &childNodeNames, int depth) { + DagNode node, const ChildNodeIndexNameMap &childNodeNames) { Operator &resultOp = node.getDialectOp(opMap); auto scope = os.scope(); @@ -1707,7 +1705,7 @@ } } -void StaticMatcherHelper::populateStaticConstraintFunctions(raw_ostream &os) { +void StaticMatcherHelper::populateStaticConstraintFunctions() { staticVerifierEmitter.emitPatternConstraints(constraints); } @@ -1763,7 +1761,7 @@ StaticMatcherHelper staticMatcher(os, recordKeeper, recordOpMap); for (Record *p : patterns) staticMatcher.addPattern(p); - staticMatcher.populateStaticConstraintFunctions(os); + staticMatcher.populateStaticConstraintFunctions(); staticMatcher.populateStaticMatchers(os); std::vector rewriterNames; diff --git a/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp b/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp --- a/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp +++ b/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp @@ -688,8 +688,7 @@ } /// Generates code to serialize an SPV_Op `op` into `os`. -static void emitSerializationFunction(const Record *attrClass, - const Record *record, const Operator &op, +static void emitSerializationFunction(const Record *record, const Operator &op, raw_ostream &os) { // If the record has 'autogenSerialization' set to 0, nothing to do if (!record->getValueAsBit("autogenSerialization")) @@ -959,8 +958,7 @@ } /// Generates code to deserialize an SPV_Op `op` into `os`. -static void emitDeserializationFunction(const Record *attrClass, - const Record *record, +static void emitDeserializationFunction(const Record *record, const Operator &op, raw_ostream &os) { // If the record has 'autogenSerialization' set to 0, nothing to do if (!record->getValueAsBit("autogenSerialization")) @@ -1156,8 +1154,8 @@ auto defs = recordKeeper.getAllDerivedDefinitions("SPV_Op"); for (const auto *def : defs) { Operator op(def); - emitSerializationFunction(attrClass, def, op, serFn); - emitDeserializationFunction(attrClass, def, op, deserFn); + emitSerializationFunction(def, op, serFn); + emitDeserializationFunction(def, op, deserFn); if (def->getValueAsBit("hasOpcode") || def->isSubClassOf("SPV_ExtInstOp")) { emitSerializationDispatch(op, " ", opVar, dSerFn); } diff --git a/mlir/tools/mlir-tblgen/StructsGen.cpp b/mlir/tools/mlir-tblgen/StructsGen.cpp --- a/mlir/tools/mlir-tblgen/StructsGen.cpp +++ b/mlir/tools/mlir-tblgen/StructsGen.cpp @@ -31,7 +31,7 @@ using mlir::tblgen::StructAttr; static void -emitStructClass(const Record &structDef, StringRef structName, +emitStructClass(StringRef structName, llvm::ArrayRef fields, StringRef description, raw_ostream &os) { const char *structInfo = R"( @@ -89,7 +89,7 @@ os << "namespace " << ns << " {\n"; // Emit the struct class definition - emitStructClass(structDef, structName, fields, description, os); + emitStructClass(structName, fields, description, os); // Close the declared namespace. for (auto ns : namespaces) diff --git a/mlir/tools/mlir-tblgen/mlir-tblgen.cpp b/mlir/tools/mlir-tblgen/mlir-tblgen.cpp --- a/mlir/tools/mlir-tblgen/mlir-tblgen.cpp +++ b/mlir/tools/mlir-tblgen/mlir-tblgen.cpp @@ -29,7 +29,7 @@ static llvm::ManagedStatic> generatorRegistry; mlir::GenRegistration::GenRegistration(StringRef arg, StringRef description, - GenFunction function) { + const GenFunction &function) { generatorRegistry->emplace_back(arg, description, function); }