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 @@ -367,7 +367,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 +527,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 +673,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 +884,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)))) 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(); 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 @@ -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/IR/QuantOps.cpp b/mlir/lib/Dialect/Quant/IR/QuantOps.cpp --- a/mlir/lib/Dialect/Quant/IR/QuantOps.cpp +++ b/mlir/lib/Dialect/Quant/IR/QuantOps.cpp @@ -34,7 +34,7 @@ >(); } -OpFoldResult StorageCastOp::fold(ArrayRef operands) { +OpFoldResult StorageCastOp::fold(ArrayRef /*operands*/) { // Matches x -> [scast -> scast] -> y, replacing the second scast with the // value of x if the casts invert each other. auto srcScastOp = arg().getDefiningOp(); diff --git a/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp --- a/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp +++ b/mlir/lib/Dialect/Quant/IR/QuantTypes.cpp @@ -30,7 +30,7 @@ LogicalResult QuantizedType::verify(function_ref emitError, - unsigned flags, Type storageType, Type expressedType, + unsigned flags, Type storageType, Type /*expressedType*/, int64_t storageTypeMin, int64_t storageTypeMax) { // Verify that the storage type is integral. // This restriction may be lifted at some point in favor of using bf16 @@ -269,7 +269,7 @@ LogicalResult UniformQuantizedType::verify( function_ref emitError, unsigned flags, - Type storageType, Type expressedType, double scale, int64_t zeroPoint, + Type storageType, Type expressedType, double scale, int64_t /*zeroPoint*/, int64_t storageTypeMin, int64_t storageTypeMax) { if (failed(QuantizedType::verify(emitError, flags, storageType, expressedType, storageTypeMin, storageTypeMax))) { @@ -323,7 +323,7 @@ LogicalResult UniformQuantizedPerAxisType::verify( function_ref emitError, unsigned flags, Type storageType, Type expressedType, ArrayRef scales, - ArrayRef zeroPoints, int32_t quantizedDimension, + ArrayRef zeroPoints, int32_t /*quantizedDimension*/, int64_t storageTypeMin, int64_t storageTypeMax) { if (failed(QuantizedType::verify(emitError, flags, storageType, expressedType, storageTypeMin, storageTypeMax))) { 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,7 +61,7 @@ DecomposeCallGraphTypesOpConversionPattern; LogicalResult - matchAndRewrite(FuncOp op, OpAdaptor adaptor, + matchAndRewrite(FuncOp op, OpAdaptor /*adaptor*/, ConversionPatternRewriter &rewriter) const final { auto functionType = op.getType(); 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) { @@ -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]) 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. @@ -222,7 +222,7 @@ } SmallVector mlir::convertReassociationMapsToIndices( - OpBuilder &b, ArrayRef reassociationExprs) { + OpBuilder & /*b*/, ArrayRef reassociationExprs) { SmallVector reassociationIndices; for (const auto &exprs : reassociationExprs) { ReassociationIndices indices; 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/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 @@ -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( 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/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/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) { 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(); 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/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() { @@ -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/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); }); } 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)