diff --git a/mlir/lib/Analysis/AffineAnalysis.cpp b/mlir/lib/Analysis/AffineAnalysis.cpp --- a/mlir/lib/Analysis/AffineAnalysis.cpp +++ b/mlir/lib/Analysis/AffineAnalysis.cpp @@ -376,7 +376,7 @@ // equality constraints (if possible), and direction vectors from inequalities. static void computeDirectionVector( const FlatAffineValueConstraints &srcDomain, - const FlatAffineValueConstraints &dstDomain, unsigned loopDepth, + const FlatAffineValueConstraints &dstDomain, FlatAffineValueConstraints *dependenceDomain, SmallVector *dependenceComponents) { // Find the number of common loops shared by src and dst accesses. @@ -625,8 +625,8 @@ // Compute dependence direction vector and return true. if (dependenceComponents != nullptr) - computeDirectionVector(srcDomain, dstDomain, loopDepth, - dependenceConstraints, dependenceComponents); + computeDirectionVector(srcDomain, dstDomain, dependenceConstraints, + dependenceComponents); LLVM_DEBUG(llvm::dbgs() << "Dependence polyhedron:\n"); LLVM_DEBUG(dependenceConstraints->dump()); diff --git a/mlir/lib/Analysis/AliasAnalysis.cpp b/mlir/lib/Analysis/AliasAnalysis.cpp --- a/mlir/lib/Analysis/AliasAnalysis.cpp +++ b/mlir/lib/Analysis/AliasAnalysis.cpp @@ -69,7 +69,7 @@ // AliasAnalysis //===----------------------------------------------------------------------===// -AliasAnalysis::AliasAnalysis(Operation *op) { +AliasAnalysis::AliasAnalysis(Operation *) { addAnalysisImplementation(LocalAliasAnalysis()); } diff --git a/mlir/lib/Analysis/NumberOfExecutions.cpp b/mlir/lib/Analysis/NumberOfExecutions.cpp --- a/mlir/lib/Analysis/NumberOfExecutions.cpp +++ b/mlir/lib/Analysis/NumberOfExecutions.cpp @@ -187,7 +187,7 @@ } void NumberOfExecutions::printBlockExecutions( - raw_ostream &os, Region *perEntryOfThisRegion) const { + raw_ostream &, Region *perEntryOfThisRegion) const { unsigned blockId = 0; operation->walk([&](Block *block) { @@ -201,7 +201,7 @@ } void NumberOfExecutions::printOperationExecutions( - raw_ostream &os, Region *perEntryOfThisRegion) const { + raw_ostream &, Region *perEntryOfThisRegion) const { operation->walk([&](Block *block) { block->walk([&](Operation *operation) { // Skip the operation that was used to build the analysis. diff --git a/mlir/lib/Analysis/Utils.cpp b/mlir/lib/Analysis/Utils.cpp --- a/mlir/lib/Analysis/Utils.cpp +++ b/mlir/lib/Analysis/Utils.cpp @@ -1294,8 +1294,7 @@ static Optional getMemoryFootprintBytes(Block &block, Block::iterator start, - Block::iterator end, - int memorySpace) { + Block::iterator end) { SmallDenseMap, 4> regions; // Walk this 'affine.for' operation to gather all memory regions. @@ -1339,9 +1338,9 @@ Optional mlir::getMemoryFootprintBytes(AffineForOp forOp, int memorySpace) { auto *forInst = forOp.getOperation(); - return ::getMemoryFootprintBytes( - *forInst->getBlock(), Block::iterator(forInst), - std::next(Block::iterator(forInst)), memorySpace); + return ::getMemoryFootprintBytes(*forInst->getBlock(), + Block::iterator(forInst), + std::next(Block::iterator(forInst))); } /// Returns whether a loop is parallel and contains a reduction loop. diff --git a/mlir/lib/Bindings/Python/IRAffine.cpp b/mlir/lib/Bindings/Python/IRAffine.cpp --- a/mlir/lib/Bindings/Python/IRAffine.cpp +++ b/mlir/lib/Bindings/Python/IRAffine.cpp @@ -536,8 +536,7 @@ }) .def("__eq__", [](PyAffineExpr &self, PyAffineExpr &other) { return self == other; }) - .def("__eq__", - [](PyAffineExpr &self, py::object &other) { return false; }) + .def("__eq__", [](PyAffineExpr &, py::object &) { return false; }) .def("__str__", [](PyAffineExpr &self) { PyPrintAccumulator printAccum; @@ -644,7 +643,7 @@ .def(MLIR_PYTHON_CAPI_FACTORY_ATTR, &PyAffineMap::createFromCapsule) .def("__eq__", [](PyAffineMap &self, PyAffineMap &other) { return self == other; }) - .def("__eq__", [](PyAffineMap &self, py::object &other) { return false; }) + .def("__eq__", [](PyAffineMap &, py::object &) { return false; }) .def("__str__", [](PyAffineMap &self) { PyPrintAccumulator printAccum; @@ -829,7 +828,7 @@ .def(MLIR_PYTHON_CAPI_FACTORY_ATTR, &PyIntegerSet::createFromCapsule) .def("__eq__", [](PyIntegerSet &self, PyIntegerSet &other) { return self == other; }) - .def("__eq__", [](PyIntegerSet &self, py::object other) { return false; }) + .def("__eq__", [](PyIntegerSet &, py::object) { return false; }) .def("__str__", [](PyIntegerSet &self) { PyPrintAccumulator printAccum; diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp --- a/mlir/lib/Bindings/Python/IRCore.cpp +++ b/mlir/lib/Bindings/Python/IRCore.cpp @@ -176,7 +176,7 @@ /// Wrapper for the global LLVM debugging flag. struct PyGlobalDebugFlag { - static void set(py::object &o, bool enable) { mlirEnableGlobalDebug(enable); } + static void set(py::object &, bool enable) { mlirEnableGlobalDebug(enable); } static bool get(const py::object &) { return mlirIsGlobalDebugEnabled(); } @@ -505,9 +505,9 @@ return PyThreadContextEntry::pushContext(*this); } -void PyMlirContext::contextExit(const pybind11::object &excType, - const pybind11::object &excVal, - const pybind11::object &excTb) { +void PyMlirContext::contextExit(const pybind11::object &, + const pybind11::object &, + const pybind11::object &) { PyThreadContextEntry::popContext(*this); } @@ -691,9 +691,8 @@ return PyThreadContextEntry::pushLocation(*this); } -void PyLocation::contextExit(const pybind11::object &excType, - const pybind11::object &excVal, - const pybind11::object &excTb) { +void PyLocation::contextExit(const pybind11::object &, const pybind11::object &, + const pybind11::object &) { PyThreadContextEntry::popLocation(*this); } @@ -841,7 +840,7 @@ void PyOperationBase::print(py::object fileObject, bool binary, llvm::Optional largeElementsLimit, bool enableDebugInfo, bool prettyDebugInfo, - bool printGenericOpForm, bool useLocalScope, + bool printGenericOpForm, bool, bool assumeVerified) { PyOperation &operation = getOperation(); operation.checkValid(); @@ -1467,9 +1466,9 @@ return PyThreadContextEntry::pushInsertionPoint(*this); } -void PyInsertionPoint::contextExit(const pybind11::object &excType, - const pybind11::object &excVal, - const pybind11::object &excTb) { +void PyInsertionPoint::contextExit(const pybind11::object &, + const pybind11::object &, + const pybind11::object &) { PyThreadContextEntry::popInsertionPoint(*this); } @@ -2159,7 +2158,7 @@ [](PyLocation &self, PyLocation &other) -> bool { return mlirLocationEqual(self, other); }) - .def("__eq__", [](PyLocation &self, py::object other) { return false; }) + .def("__eq__", [](PyLocation &, py::object) { return false; }) .def_property_readonly_static( "current", [](py::object & /*class*/) { @@ -2205,7 +2204,8 @@ py::arg("context") = py::none(), kContextGetFileLocationDocstring) .def_static( "fused", - [](const std::vector &pyLocations, llvm::Optional metadata, + [](const std::vector &pyLocations, + llvm::Optional metadata, DefaultingPyMlirContext context) { if (pyLocations.empty()) throw py::value_error("No locations provided"); @@ -2322,8 +2322,7 @@ [](PyOperationBase &self, PyOperationBase &other) { return &self.getOperation() == &other.getOperation(); }) - .def("__eq__", - [](PyOperationBase &self, py::object other) { return false; }) + .def("__eq__", [](PyOperationBase &, py::object) { return false; }) .def("__hash__", [](PyOperationBase &self) { return static_cast(llvm::hash_value(&self.getOperation())); @@ -2521,7 +2520,7 @@ [](PyRegion &self, PyRegion &other) { return self.get().ptr == other.get().ptr; }) - .def("__eq__", [](PyRegion &self, py::object &other) { return false; }); + .def("__eq__", [](PyRegion &, py::object &) { return false; }); //---------------------------------------------------------------------------- // Mapping of PyBlock. @@ -2617,7 +2616,7 @@ [](PyBlock &self, PyBlock &other) { return self.get().ptr == other.get().ptr; }) - .def("__eq__", [](PyBlock &self, py::object &other) { return false; }) + .def("__eq__", [](PyBlock &, py::object &) { return false; }) .def( "__str__", [](PyBlock &self) { @@ -2718,7 +2717,7 @@ py::keep_alive<0, 1>(), "Binds a name to the attribute") .def("__eq__", [](PyAttribute &self, PyAttribute &other) { return self == other; }) - .def("__eq__", [](PyAttribute &self, py::object &other) { return false; }) + .def("__eq__", [](PyAttribute &, py::object &) { return false; }) .def("__hash__", [](PyAttribute &self) { return static_cast(llvm::hash_value(self.get().ptr)); @@ -2816,7 +2815,7 @@ "context", [](PyType &self) { return self.getContext().getObject(); }, "Context that owns the Type") .def("__eq__", [](PyType &self, PyType &other) { return self == other; }) - .def("__eq__", [](PyType &self, py::object &other) { return false; }) + .def("__eq__", [](PyType &, py::object &) { return false; }) .def("__hash__", [](PyType &self) { return static_cast(llvm::hash_value(self.get().ptr)); @@ -2870,7 +2869,7 @@ [](PyValue &self, PyValue &other) { return self.get().ptr == other.get().ptr; }) - .def("__eq__", [](PyValue &self, py::object other) { return false; }) + .def("__eq__", [](PyValue &, py::object) { return false; }) .def("__hash__", [](PyValue &self) { return static_cast(llvm::hash_value(self.get().ptr)); diff --git a/mlir/lib/CAPI/IR/BuiltinAttributes.cpp b/mlir/lib/CAPI/IR/BuiltinAttributes.cpp --- a/mlir/lib/CAPI/IR/BuiltinAttributes.cpp +++ b/mlir/lib/CAPI/IR/BuiltinAttributes.cpp @@ -99,8 +99,7 @@ return unwrap(attr).isa(); } -MlirAttribute mlirFloatAttrDoubleGet(MlirContext ctx, MlirType type, - double value) { +MlirAttribute mlirFloatAttrDoubleGet(MlirContext, MlirType type, double value) { return wrap(FloatAttr::get(unwrap(type), value)); } diff --git a/mlir/lib/CAPI/IR/IntegerSet.cpp b/mlir/lib/CAPI/IR/IntegerSet.cpp --- a/mlir/lib/CAPI/IR/IntegerSet.cpp +++ b/mlir/lib/CAPI/IR/IntegerSet.cpp @@ -39,7 +39,7 @@ unwrap(context))); } -MlirIntegerSet mlirIntegerSetGet(MlirContext context, intptr_t numDims, +MlirIntegerSet mlirIntegerSetGet(MlirContext, intptr_t numDims, intptr_t numSymbols, intptr_t numConstraints, const MlirAffineExpr *constraints, const bool *eqFlags) { diff --git a/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp b/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp --- a/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp +++ b/mlir/lib/Conversion/ArithmeticToSPIRV/ArithmeticToSPIRV.cpp @@ -270,7 +270,7 @@ //===----------------------------------------------------------------------===// LogicalResult ConstantCompositeOpPattern::matchAndRewrite( - arith::ConstantOp constOp, OpAdaptor adaptor, + arith::ConstantOp constOp, OpAdaptor, ConversionPatternRewriter &rewriter) const { auto srcType = constOp.getType().dyn_cast(); if (!srcType || srcType.getNumElements() == 1) @@ -355,7 +355,7 @@ //===----------------------------------------------------------------------===// LogicalResult ConstantScalarOpPattern::matchAndRewrite( - arith::ConstantOp constOp, OpAdaptor adaptor, + arith::ConstantOp constOp, OpAdaptor, ConversionPatternRewriter &rewriter) const { Type srcType = constOp.getType(); if (auto shapedType = srcType.dyn_cast()) { diff --git a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp --- a/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp +++ b/mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp @@ -327,7 +327,7 @@ using OpConversionPattern::OpConversionPattern; LogicalResult - matchAndRewrite(CoroIdOp op, OpAdaptor adaptor, + matchAndRewrite(CoroIdOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { auto token = AsyncAPI::tokenType(op->getContext()); auto i8Ptr = AsyncAPI::opaquePointerType(op->getContext()); @@ -543,7 +543,7 @@ using OpConversionPattern::OpConversionPattern; LogicalResult - matchAndRewrite(RuntimeCreateOp op, OpAdaptor adaptor, + matchAndRewrite(RuntimeCreateOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { TypeConverter *converter = getTypeConverter(); Type resultType = op->getResultTypes()[0]; diff --git a/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp b/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp --- a/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp +++ b/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp @@ -31,7 +31,7 @@ using OpConversionPattern::OpConversionPattern; LogicalResult - matchAndRewrite(bufferization::CloneOp op, OpAdaptor adaptor, + matchAndRewrite(bufferization::CloneOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { // Check for unranked memref types which are currently not supported. Type type = op.getType(); diff --git a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp --- a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp +++ b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp @@ -15,7 +15,7 @@ using namespace mlir; LogicalResult -GPUFuncOpLowering::matchAndRewrite(gpu::GPUFuncOp gpuFuncOp, OpAdaptor adaptor, +GPUFuncOpLowering::matchAndRewrite(gpu::GPUFuncOp gpuFuncOp, OpAdaptor, ConversionPatternRewriter &rewriter) const { Location loc = gpuFuncOp.getLoc(); diff --git a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp --- a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp +++ b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp @@ -851,7 +851,7 @@ LLVMTypeConverter &converter, OwningRewritePatternList &patterns, StringRef gpuBinaryAnnotation) { converter.addConversion( - [context = &converter.getContext()](gpu::AsyncTokenType type) -> Type { + [context = &converter.getContext()](gpu::AsyncTokenType) -> Type { return LLVM::LLVMPointerType::get(IntegerType::get(context, 8)); }); patterns.add LogicalResult LaunchConfigConversion::matchAndRewrite( - SourceOp op, typename SourceOp::Adaptor adaptor, + SourceOp op, typename SourceOp::Adaptor, ConversionPatternRewriter &rewriter) const { auto index = getLaunchConfigIndex(op); if (!index) @@ -150,7 +150,7 @@ template LogicalResult SingleDimLaunchConfigConversion::matchAndRewrite( - SourceOp op, typename SourceOp::Adaptor adaptor, + SourceOp op, typename SourceOp::Adaptor, ConversionPatternRewriter &rewriter) const { auto *typeConverter = this->template getTypeConverter(); auto indexType = typeConverter->getIndexType(); @@ -162,8 +162,7 @@ } LogicalResult WorkGroupSizeConversion::matchAndRewrite( - gpu::BlockDimOp op, OpAdaptor adaptor, - ConversionPatternRewriter &rewriter) const { + gpu::BlockDimOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const { auto index = getLaunchConfigIndex(op); if (!index) return failure(); @@ -264,7 +263,7 @@ } LogicalResult GPUFuncOpConversion::matchAndRewrite( - gpu::GPUFuncOp funcOp, OpAdaptor adaptor, + gpu::GPUFuncOp funcOp, OpAdaptor, ConversionPatternRewriter &rewriter) const { if (!gpu::GPUDialect::isKernel(funcOp)) return failure(); @@ -306,7 +305,7 @@ //===----------------------------------------------------------------------===// LogicalResult GPUModuleConversion::matchAndRewrite( - gpu::GPUModuleOp moduleOp, OpAdaptor adaptor, + gpu::GPUModuleOp moduleOp, OpAdaptor, ConversionPatternRewriter &rewriter) const { spirv::TargetEnvAttr targetEnv = spirv::lookupTargetEnvOrDefault(moduleOp); spirv::AddressingModel addressingModel = spirv::getAddressingModel(targetEnv); diff --git a/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp b/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp --- a/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp +++ b/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp @@ -507,7 +507,7 @@ Value UnrankedMemRefDescriptor::stride(OpBuilder &builder, Location loc, LLVMTypeConverter &typeConverter, Value strideBasePtr, Value index, - Value stride) { + Value) { Type indexPtrTy = LLVM::LLVMPointerType::get(typeConverter.getIndexType()); Value strideStoreGep = builder.create( loc, indexPtrTy, strideBasePtr, ValueRange({index})); diff --git a/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp b/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp --- a/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp +++ b/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp @@ -171,9 +171,7 @@ return options.dataLayout.getPointerSizeInBits(addressSpace); } -Type LLVMTypeConverter::convertIndexType(IndexType type) { - return getIndexType(); -} +Type LLVMTypeConverter::convertIndexType(IndexType) { return getIndexType(); } Type LLVMTypeConverter::convertIntegerType(IntegerType type) { return IntegerType::get(&getContext(), type.getWidth()); diff --git a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp --- a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp +++ b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp @@ -194,7 +194,7 @@ using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult - matchAndRewrite(memref::AllocaScopeOp allocaScopeOp, OpAdaptor adaptor, + matchAndRewrite(memref::AllocaScopeOp allocaScopeOp, OpAdaptor, ConversionPatternRewriter &rewriter) const override { OpBuilder::InsertionGuard guard(rewriter); Location loc = allocaScopeOp.getLoc(); @@ -432,7 +432,7 @@ using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult - matchAndRewrite(memref::GlobalOp global, OpAdaptor adaptor, + matchAndRewrite(memref::GlobalOp global, OpAdaptor, ConversionPatternRewriter &rewriter) const override { MemRefType type = global.type(); if (!isConvertibleAndHasIdentityMaps(type)) @@ -482,7 +482,7 @@ /// Buffer "allocation" for memref.get_global op is getting the address of /// the global variable referenced. std::tuple allocateBuffer(ConversionPatternRewriter &rewriter, - Location loc, Value sizeBytes, + Location loc, Value, Operation *op) const override { auto getGlobalOp = cast(op); MemRefType type = getGlobalOp.result().getType().cast(); @@ -819,8 +819,8 @@ Type srcType = castOp.source().getType(); Value descriptor; - if (failed(convertSourceMemRefToDescriptor(rewriter, srcType, castOp, - adaptor, &descriptor))) + if (failed(convertSourceMemRefToDescriptor(rewriter, castOp, adaptor, + &descriptor))) return failure(); rewriter.replaceOp(castOp, {descriptor}); return success(); @@ -828,8 +828,7 @@ private: LogicalResult convertSourceMemRefToDescriptor( - ConversionPatternRewriter &rewriter, Type srcType, - memref::ReinterpretCastOp castOp, + ConversionPatternRewriter &rewriter, memref::ReinterpretCastOp castOp, memref::ReinterpretCastOp::Adaptor adaptor, Value *descriptor) const { MemRefType targetMemRefType = castOp.getResult().getType().cast(); @@ -885,19 +884,17 @@ Type srcType = reshapeOp.source().getType(); Value descriptor; - if (failed(convertSourceMemRefToDescriptor(rewriter, srcType, reshapeOp, - adaptor, &descriptor))) + if (failed(convertSourceMemRefToDescriptor(rewriter, reshapeOp, adaptor, + &descriptor))) return failure(); rewriter.replaceOp(reshapeOp, {descriptor}); return success(); } private: - LogicalResult - convertSourceMemRefToDescriptor(ConversionPatternRewriter &rewriter, - Type srcType, memref::ReshapeOp reshapeOp, - memref::ReshapeOp::Adaptor adaptor, - Value *descriptor) const { + LogicalResult convertSourceMemRefToDescriptor( + ConversionPatternRewriter &rewriter, memref::ReshapeOp reshapeOp, + memref::ReshapeOp::Adaptor adaptor, Value *descriptor) const { // Conversion for statically-known shape args is performed via // `memref_reinterpret_cast`. auto shapeMemRefType = reshapeOp.shape().getType().cast(); diff --git a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp --- a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp +++ b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp @@ -220,7 +220,7 @@ //===----------------------------------------------------------------------===// LogicalResult -AllocOpPattern::matchAndRewrite(memref::AllocOp operation, OpAdaptor adaptor, +AllocOpPattern::matchAndRewrite(memref::AllocOp operation, OpAdaptor, ConversionPatternRewriter &rewriter) const { MemRefType allocType = operation.getType(); if (!isAllocationSupported(allocType)) @@ -258,8 +258,7 @@ //===----------------------------------------------------------------------===// LogicalResult -DeallocOpPattern::matchAndRewrite(memref::DeallocOp operation, - OpAdaptor adaptor, +DeallocOpPattern::matchAndRewrite(memref::DeallocOp operation, OpAdaptor, ConversionPatternRewriter &rewriter) const { MemRefType deallocType = operation.memref().getType().cast(); if (!isAllocationSupported(deallocType)) diff --git a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp --- a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp +++ b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp @@ -329,7 +329,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::AddressOfOp op, OpAdaptor adaptor, + matchAndRewrite(spirv::AddressOfOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { auto dstType = typeConverter.convertType(op.pointer().getType()); if (!dstType) @@ -345,7 +345,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::BitFieldInsertOp op, OpAdaptor adaptor, + matchAndRewrite(spirv::BitFieldInsertOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = op.getType(); auto dstType = typeConverter.convertType(srcType); @@ -433,7 +433,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::BitFieldSExtractOp op, OpAdaptor adaptor, + matchAndRewrite(spirv::BitFieldSExtractOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = op.getType(); auto dstType = typeConverter.convertType(srcType); @@ -486,7 +486,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::BitFieldUExtractOp op, OpAdaptor adaptor, + matchAndRewrite(spirv::BitFieldUExtractOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = op.getType(); auto dstType = typeConverter.convertType(srcType); @@ -535,7 +535,7 @@ spirv::BranchConditionalOp>::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::BranchConditionalOp op, OpAdaptor adaptor, + matchAndRewrite(spirv::BranchConditionalOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { // If branch weights exist, map them to 32-bit integer vector. ElementsAttr branchWeights = nullptr; @@ -640,7 +640,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::ExecutionModeOp op, OpAdaptor adaptor, + matchAndRewrite(spirv::ExecutionModeOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { // First, create the global struct's name that would be associated with // this entry point's execution mode. We set it to be: @@ -720,7 +720,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::GlobalVariableOp op, OpAdaptor adaptor, + matchAndRewrite(spirv::GlobalVariableOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { // Currently, there is no support of initialization with a constant value in // SPIR-V dialect. Specialization constants are not considered as well. @@ -833,7 +833,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(SPIRVOp operation, typename SPIRVOp::Adaptor adaptor, + matchAndRewrite(SPIRVOp operation, typename SPIRVOp::Adaptor, ConversionPatternRewriter &rewriter) const override { auto dstType = this->typeConverter.convertType(operation.getType()); @@ -854,7 +854,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(SPIRVOp operation, typename SPIRVOp::Adaptor adaptor, + matchAndRewrite(SPIRVOp operation, typename SPIRVOp::Adaptor, ConversionPatternRewriter &rewriter) const override { auto dstType = this->typeConverter.convertType(operation.getType()); @@ -874,7 +874,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::GLSLInverseSqrtOp op, OpAdaptor adaptor, + matchAndRewrite(spirv::GLSLInverseSqrtOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = op.getType(); auto dstType = typeConverter.convertType(srcType); @@ -932,7 +932,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(SPIRVOp notOp, typename SPIRVOp::Adaptor adaptor, + matchAndRewrite(SPIRVOp notOp, typename SPIRVOp::Adaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = notOp.getType(); auto dstType = this->typeConverter.convertType(srcType); @@ -960,7 +960,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(SPIRVOp op, typename SPIRVOp::Adaptor adaptor, + matchAndRewrite(SPIRVOp op, typename SPIRVOp::Adaptor, ConversionPatternRewriter &rewriter) const override { rewriter.eraseOp(op); return success(); @@ -972,7 +972,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::ReturnOp returnOp, OpAdaptor adaptor, + matchAndRewrite(spirv::ReturnOp returnOp, OpAdaptor, ConversionPatternRewriter &rewriter) const override { rewriter.replaceOpWithNewOp(returnOp, ArrayRef(), ArrayRef()); @@ -1046,7 +1046,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::LoopOp loopOp, OpAdaptor adaptor, + matchAndRewrite(spirv::LoopOp loopOp, OpAdaptor, ConversionPatternRewriter &rewriter) const override { // There is no support of loop control at the moment. if (loopOp.loop_control() != spirv::LoopControl::None) @@ -1093,7 +1093,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::SelectionOp op, OpAdaptor adaptor, + matchAndRewrite(spirv::SelectionOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { // There is no support for `Flatten` or `DontFlatten` selection control at // the moment. This are just compiler hints and can be performed during the @@ -1199,7 +1199,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::GLSLTanOp tanOp, OpAdaptor adaptor, + matchAndRewrite(spirv::GLSLTanOp tanOp, OpAdaptor, ConversionPatternRewriter &rewriter) const override { auto dstType = typeConverter.convertType(tanOp.getType()); if (!dstType) @@ -1224,7 +1224,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::GLSLTanhOp tanhOp, OpAdaptor adaptor, + matchAndRewrite(spirv::GLSLTanhOp tanhOp, OpAdaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = tanhOp.getType(); auto dstType = typeConverter.convertType(srcType); @@ -1287,7 +1287,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::FuncOp funcOp, OpAdaptor adaptor, + matchAndRewrite(spirv::FuncOp funcOp, OpAdaptor, ConversionPatternRewriter &rewriter) const override { // Convert function signature. At the moment LLVMType converter is enough @@ -1350,7 +1350,7 @@ using SPIRVToLLVMConversion::SPIRVToLLVMConversion; LogicalResult - matchAndRewrite(spirv::ModuleOp spvModuleOp, OpAdaptor adaptor, + matchAndRewrite(spirv::ModuleOp spvModuleOp, OpAdaptor, ConversionPatternRewriter &rewriter) const override { auto newModuleOp = diff --git a/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp b/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp --- a/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp +++ b/mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp @@ -179,8 +179,7 @@ } // namespace LogicalResult ConstShapeOpConverter::matchAndRewrite( - ConstShapeOp op, OpAdaptor adaptor, - ConversionPatternRewriter &rewriter) const { + ConstShapeOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const { // For now, this lowering supports only extent tensors, not `shape.shape` // types. @@ -213,8 +212,7 @@ } // namespace LogicalResult ConstSizeOpConversion::matchAndRewrite( - ConstSizeOp op, OpAdaptor adaptor, - ConversionPatternRewriter &rewriter) const { + ConstSizeOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const { rewriter.replaceOpWithNewOp( op, op.getValue().getSExtValue()); return success(); @@ -502,7 +500,7 @@ b.create(loc, i1Ty, b.getBoolAttr(true)); auto loop = b.create( loc, zero, firstRank, one, ValueRange{init}, - [&](OpBuilder &b, Location nestedLoc, Value iv, ValueRange args) { + [&](OpBuilder &b, Location, Value iv, ValueRange args) { Value conj = args[0]; Value lhsExtent = b.create(loc, firstShape, iv); diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp --- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp +++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp @@ -721,7 +721,7 @@ auto linalgOp = rewriter.create( loc, opResultTypes, operands, initTensors, indexingMaps, getNParallelLoopsAttrs(rank), - [&](OpBuilder &nestedBuilder, Location nestedLoc, ValueRange blockArgs) { + [&](OpBuilder &nestedBuilder, Location, ValueRange blockArgs) { Value opResult = createLinalgBodyCalculationForElementwiseOp( operation, blockArgs.take_front(operation->getNumOperands()), bodyResultTypes, rewriter); @@ -898,7 +898,7 @@ auto maps = AffineMap::inferFromExprList({srcExprs, dstExprs}); auto linalgOp = rewriter.create( loc, reduceTy, input, filledTensor, maps, iteratorTypes, - [&](OpBuilder &nestedBuilder, Location nestedLoc, ValueRange blockArgs) { + [&](OpBuilder &nestedBuilder, Location, ValueRange blockArgs) { auto result = createLinalgBodyCalculationForReduceOp( op, blockArgs, elementTy, rewriter); if (result) @@ -1197,7 +1197,7 @@ rewriter.replaceOpWithNewOp( op, resultTy, op.input1(), ValueRange{initTensor}, affineMaps, getNParallelLoopsAttrs(resultTy.getRank()), - [&](OpBuilder &nestedBuilder, Location nestedLoc, ValueRange args) { + [&](OpBuilder &nestedBuilder, Location, ValueRange args) { nestedBuilder.create(loc, *args.begin()); }); return success(); @@ -1799,7 +1799,7 @@ rewriter.replaceOpWithNewOp( op, resultTy, ArrayRef({}), ValueRange{initTensor}, affineMaps, getNParallelLoopsAttrs(resultTy.getRank()), - [&](OpBuilder &nestedBuilder, Location nestedLoc, ValueRange args) { + [&](OpBuilder &nestedBuilder, Location nestedLoc, ValueRange) { llvm::SmallVector indices; for (unsigned int i = 0; i < inputTy.getRank(); i++) { auto index = @@ -1832,7 +1832,7 @@ using OpConversionPattern::OpConversionPattern; LogicalResult - matchAndRewrite(tosa::TileOp op, OpAdaptor adaptor, + matchAndRewrite(tosa::TileOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { auto loc = op.getLoc(); auto input = op.input1(); @@ -1875,7 +1875,7 @@ loc, RankedTensorType::get(genericShape, elementTy), input, ValueRange{initTensor}, affineMaps, getNParallelLoopsAttrs(genericShape.size()), - [&](OpBuilder &nestedBuilder, Location nestedLoc, ValueRange args) { + [&](OpBuilder &nestedBuilder, Location, ValueRange args) { nestedBuilder.create(op.getLoc(), *args.begin()); }); @@ -2134,7 +2134,7 @@ loc, ArrayRef({resultTy}), ValueRange{indices}, ValueRange{initTensor}, affineMaps, getNParallelLoopsAttrs(resultTy.getRank()), - [&](OpBuilder &b, Location loc, ValueRange args) { + [&](OpBuilder &, Location loc, ValueRange args) { auto indexValue = args[0]; auto index0 = rewriter.create(loc, 0); Value index1 = rewriter.create( diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp --- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp +++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp @@ -96,7 +96,7 @@ public: using OpConversionPattern::OpConversionPattern; LogicalResult - matchAndRewrite(tosa::Conv2DOp op, OpAdaptor adaptor, + matchAndRewrite(tosa::Conv2DOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const final { Location loc = op->getLoc(); Value input = op->getOperand(0); @@ -261,7 +261,7 @@ public: using OpConversionPattern::OpConversionPattern; LogicalResult - matchAndRewrite(tosa::DepthwiseConv2DOp op, OpAdaptor adaptor, + matchAndRewrite(tosa::DepthwiseConv2DOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const final { Location loc = op->getLoc(); Value input = op->getOperand(0); @@ -477,7 +477,7 @@ public: using OpConversionPattern::OpConversionPattern; LogicalResult - matchAndRewrite(tosa::FullyConnectedOp op, OpAdaptor adaptor, + matchAndRewrite(tosa::FullyConnectedOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const final { Location loc = op.getLoc(); auto outputTy = op.getType().cast(); @@ -735,7 +735,7 @@ ValueRange{genericInitTensor}, ArrayRef({affineMap, affineMap}), getNParallelLoopsAttrs(resultTy.getRank()), - [&](OpBuilder &b, Location loc, ValueRange args) { + [&](OpBuilder &, Location loc, ValueRange args) { auto zero = rewriter.create(loc, 0); auto one = rewriter.create(loc, 1); auto iH = rewriter.create( diff --git a/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp b/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp --- a/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp +++ b/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp @@ -84,7 +84,7 @@ struct TileZeroConversion : public ConvertOpToLLVMPattern { using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern; LogicalResult - matchAndRewrite(TileZeroOp op, OpAdaptor adaptor, + matchAndRewrite(TileZeroOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const override { VectorType vType = op.getVectorType(); // Determine m x n tile sizes. diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp --- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp +++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp @@ -145,7 +145,7 @@ /// 'dest' that is attached to an operation registered to the current dialect. /// 'wouldBeCloned' is set if the region is cloned into its new location /// rather than moved, indicating there may be other users. - bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned, + bool isLegalToInline(Region *dest, Region *src, bool, BlockAndValueMapping &valueMapping) const final { // We can inline into affine loops and conditionals if this doesn't break // affine value categorization rules. @@ -190,8 +190,8 @@ /// Returns true if the given operation 'op', that is registered to this /// dialect, can be inlined into the given region, false otherwise. - bool isLegalToInline(Operation *op, Region *region, bool wouldBeCloned, - BlockAndValueMapping &valueMapping) const final { + bool isLegalToInline(Operation *, Region *region, bool, + BlockAndValueMapping &) const final { // Always allow inlining affine operations into a region that is marked as // affine scope, or into affine loops and conditionals. There are some edge // cases when inlining *into* affine structures, but that is handled in the @@ -202,7 +202,7 @@ } /// Affine regions should be analyzed recursively. - bool shouldAnalyzeRecursively(Operation *op) const final { return true; } + bool shouldAnalyzeRecursively(Operation *) const final { return true; } }; } // namespace @@ -1002,7 +1002,7 @@ //===----------------------------------------------------------------------===// // TODO: Check that map operands are loop IVs or symbols. -void AffineDmaStartOp::build(OpBuilder &builder, OperationState &result, +void AffineDmaStartOp::build(OpBuilder &, OperationState &result, Value srcMemRef, AffineMap srcMap, ValueRange srcIndices, Value destMemRef, AffineMap dstMap, ValueRange destIndices, @@ -1157,8 +1157,8 @@ return success(); } -LogicalResult AffineDmaStartOp::fold(ArrayRef cstOperands, - SmallVectorImpl &results) { +LogicalResult AffineDmaStartOp::fold(ArrayRef, + SmallVectorImpl &) { /// dma_start(memrefcast) -> dma_start return foldMemRefCast(*this); } @@ -1168,7 +1168,7 @@ //===----------------------------------------------------------------------===// // TODO: Check that map operands are loop IVs or symbols. -void AffineDmaWaitOp::build(OpBuilder &builder, OperationState &result, +void AffineDmaWaitOp::build(OpBuilder &, OperationState &result, Value tagMemRef, AffineMap tagMap, ValueRange tagIndices, Value numElements) { result.addOperands(tagMemRef); @@ -1234,8 +1234,8 @@ return success(); } -LogicalResult AffineDmaWaitOp::fold(ArrayRef cstOperands, - SmallVectorImpl &results) { +LogicalResult AffineDmaWaitOp::fold(ArrayRef, + SmallVectorImpl &) { /// dma_wait(memrefcast) -> dma_wait return foldMemRefCast(*this); } @@ -1693,7 +1693,7 @@ return ub - lb <= 0; } -LogicalResult AffineForOp::fold(ArrayRef operands, +LogicalResult AffineForOp::fold(ArrayRef, SmallVectorImpl &results) { bool folded = succeeded(foldLoopBounds(*this)); folded |= succeeded(canonicalizeLoopBounds(*this)); @@ -1884,7 +1884,7 @@ for (unsigned i = 0, e = lbs.size(); i < e; ++i) { // Callback for creating the loop body, always creates the terminator. auto loopBody = [&](OpBuilder &nestedBuilder, Location nestedLoc, Value iv, - ValueRange iterArgs) { + ValueRange) { ivs.push_back(iv); // In the innermost loop, call the body builder. if (i == e - 1 && bodyBuilderFn) { @@ -2230,8 +2230,8 @@ // AffineLoadOp //===----------------------------------------------------------------------===// -void AffineLoadOp::build(OpBuilder &builder, OperationState &result, - AffineMap map, ValueRange operands) { +void AffineLoadOp::build(OpBuilder &, OperationState &result, AffineMap map, + ValueRange operands) { assert(operands.size() == 1 + map.getNumInputs() && "inconsistent operands"); result.addOperands(operands); if (map) @@ -2240,8 +2240,8 @@ result.types.push_back(memrefType.getElementType()); } -void AffineLoadOp::build(OpBuilder &builder, OperationState &result, - Value memref, AffineMap map, ValueRange mapOperands) { +void AffineLoadOp::build(OpBuilder &, OperationState &result, Value memref, + AffineMap map, ValueRange mapOperands) { assert(map.getNumInputs() == mapOperands.size() && "inconsistent index info"); result.addOperands(memref); result.addOperands(mapOperands); @@ -2342,7 +2342,7 @@ results.add>(context); } -OpFoldResult AffineLoadOp::fold(ArrayRef cstOperands) { +OpFoldResult AffineLoadOp::fold(ArrayRef) { /// load(memrefcast) -> load if (succeeded(foldMemRefCast(*this))) return getResult(); @@ -2353,7 +2353,7 @@ // AffineStoreOp //===----------------------------------------------------------------------===// -void AffineStoreOp::build(OpBuilder &builder, OperationState &result, +void AffineStoreOp::build(OpBuilder &, OperationState &result, Value valueToStore, Value memref, AffineMap map, ValueRange mapOperands) { assert(map.getNumInputs() == mapOperands.size() && "inconsistent index info"); @@ -2432,8 +2432,8 @@ results.add>(context); } -LogicalResult AffineStoreOp::fold(ArrayRef cstOperands, - SmallVectorImpl &results) { +LogicalResult AffineStoreOp::fold(ArrayRef, + SmallVectorImpl &) { /// store(memrefcast) -> store return foldMemRefCast(*this, getValueToStore()); } @@ -2789,8 +2789,8 @@ results.add>(context); } -LogicalResult AffinePrefetchOp::fold(ArrayRef cstOperands, - SmallVectorImpl &results) { +LogicalResult AffinePrefetchOp::fold(ArrayRef, + SmallVectorImpl &) { /// prefetch(memrefcast) -> prefetch return foldMemRefCast(*this); } @@ -3096,8 +3096,8 @@ return success(); } -LogicalResult AffineParallelOp::fold(ArrayRef operands, - SmallVectorImpl &results) { +LogicalResult AffineParallelOp::fold(ArrayRef, + SmallVectorImpl &) { return canonicalizeLoopBounds(*this); } @@ -3431,7 +3431,7 @@ // AffineVectorLoadOp //===----------------------------------------------------------------------===// -void AffineVectorLoadOp::build(OpBuilder &builder, OperationState &result, +void AffineVectorLoadOp::build(OpBuilder &, OperationState &result, VectorType resultType, AffineMap map, ValueRange operands) { assert(operands.size() == 1 + map.getNumInputs() && "inconsistent operands"); @@ -3441,7 +3441,7 @@ result.types.push_back(resultType); } -void AffineVectorLoadOp::build(OpBuilder &builder, OperationState &result, +void AffineVectorLoadOp::build(OpBuilder &, OperationState &result, VectorType resultType, Value memref, AffineMap map, ValueRange mapOperands) { assert(map.getNumInputs() == mapOperands.size() && "inconsistent index info"); @@ -3532,7 +3532,7 @@ // AffineVectorStoreOp //===----------------------------------------------------------------------===// -void AffineVectorStoreOp::build(OpBuilder &builder, OperationState &result, +void AffineVectorStoreOp::build(OpBuilder &, OperationState &result, Value valueToStore, Value memref, AffineMap map, ValueRange mapOperands) { assert(map.getNumInputs() == mapOperands.size() && "inconsistent index info"); diff --git a/mlir/lib/Dialect/Affine/Utils/Utils.cpp b/mlir/lib/Dialect/Affine/Utils/Utils.cpp --- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp +++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp @@ -683,7 +683,6 @@ // 3) There is no potential read between writeA and writeB. static void findUnusedStore(AffineWriteOpInterface writeA, SmallVectorImpl &opsToErase, - SmallPtrSetImpl &memrefsToErase, PostDominanceInfo &postDominanceInfo) { for (Operation *user : writeA.getMemRef().getUsers()) { @@ -830,7 +829,7 @@ // Walk all store's and perform unused store elimination f.walk([&](AffineWriteOpInterface storeOp) { - findUnusedStore(storeOp, opsToErase, memrefsToErase, postDomInfo); + findUnusedStore(storeOp, opsToErase, postDomInfo); }); // Erase all store op's which don't impact the program for (auto *op : opsToErase) diff --git a/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp b/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp --- a/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp +++ b/mlir/lib/Dialect/Arithmetic/IR/ArithmeticOps.cpp @@ -136,9 +136,7 @@ return value.isa(); } -OpFoldResult arith::ConstantOp::fold(ArrayRef operands) { - return getValue(); -} +OpFoldResult arith::ConstantOp::fold(ArrayRef) { return getValue(); } void arith::ConstantIntOp::build(OpBuilder &builder, OperationState &result, int64_t value, unsigned width) { 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 @@ -369,7 +369,7 @@ // work concurrently. LoopNestBuilder workLoopBuilder = [&](size_t loopIdx) -> LoopBodyBuilder { return [&, loopIdx](OpBuilder &nestedBuilder, Location loc, Value iv, - ValueRange args) { + ValueRange) { ImplicitLocOpBuilder nb(loc, nestedBuilder); // Compute induction variable for `loopIdx`. @@ -529,7 +529,7 @@ // Call parallel compute function inside the async.execute region. auto executeBodyBuilder = [&](OpBuilder &executeBuilder, - Location executeLoc, ValueRange executeArgs) { + Location executeLoc, ValueRange) { // Update the original `blockStart` and `blockEnd` with new range. SmallVector operands{block->getArguments().begin(), block->getArguments().end()}; @@ -674,12 +674,12 @@ // Induction variable is the index of the block: [0, blockCount). LoopBodyBuilder loopBuilder = [&](OpBuilder &loopBuilder, Location loc, - Value iv, ValueRange args) { + Value iv, ValueRange) { ImplicitLocOpBuilder nb(loc, loopBuilder); // Call parallel compute function inside the async.execute region. auto executeBodyBuilder = [&](OpBuilder &executeBuilder, - Location executeLoc, ValueRange executeArgs) { + Location executeLoc, ValueRange) { executeBuilder.create(executeLoc, compute.sym_name(), compute.getCallableResults(), computeFuncOperands(iv)); @@ -884,7 +884,7 @@ RewritePatternSet patterns(ctx); populateAsyncParallelForPatterns( patterns, asyncDispatch, numWorkerThreads, - [&](ImplicitLocOpBuilder builder, scf::ParallelOp op) { + [&](ImplicitLocOpBuilder builder, scf::ParallelOp) { 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/Bufferization/IR/BufferizationOps.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp --- a/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp +++ b/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp @@ -28,7 +28,7 @@ SideEffects::DefaultResource::get()); } -OpFoldResult CloneOp::fold(ArrayRef operands) { +OpFoldResult CloneOp::fold(ArrayRef) { return succeeded(memref::foldMemRefCast(*this)) ? getResult() : Value(); } 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 @@ -342,8 +342,7 @@ addInterfaces(); } -Attribute DLTIDialect::parseAttribute(DialectAsmParser &parser, - Type type) const { +Attribute DLTIDialect::parseAttribute(DialectAsmParser &parser, Type) const { StringRef attrKind; if (parser.parseKeyword(&attrKind)) return {}; diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp --- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp +++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp @@ -166,7 +166,7 @@ #define GET_ATTRDEF_CLASSES #include "mlir/Dialect/EmitC/IR/EmitCAttributes.cpp.inc" -Attribute emitc::OpaqueAttr::parse(AsmParser &parser, Type type) { +Attribute emitc::OpaqueAttr::parse(AsmParser &parser, Type) { if (parser.parseLess()) return Attribute(); std::string value; diff --git a/mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp b/mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp --- a/mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp @@ -100,8 +100,8 @@ assert(accumFactory && "failed to create accumulator factory"); // Reduce elements within each subgroup to produce the intermediate results. - Value subgroupReduce = createSubgroupReduce(activeWidth, laneId, - reduceOp.value(), accumFactory); + Value subgroupReduce = + createSubgroupReduce(activeWidth, reduceOp.value(), accumFactory); // Add workgroup buffer to parent function for intermediate result. Value buffer = createWorkgroupBuffer(); @@ -129,8 +129,7 @@ createPredicatedBlock(isValidSubgroup, [&] { Value index = create(indexType, invocationIdx); Value value = create(valueType, buffer, index); - Value result = - createSubgroupReduce(numSubgroups, laneId, value, accumFactory); + Value result = createSubgroupReduce(numSubgroups, value, accumFactory); create(result, buffer, zero); }); @@ -322,7 +321,7 @@ /// Creates a reduction across the first activeWidth lanes of a subgroup, or /// the entire subgroup if activeWidth is larger than the subgroup width. /// The first lane returns the result, all others return values are undefined. - Value createSubgroupReduce(Value activeWidth, Value laneId, Value operand, + Value createSubgroupReduce(Value activeWidth, Value operand, AccumulatorFactory &accumFactory) { Value subgroupSize = create(kSubgroupSize, int32Type); Value isPartialSubgroup = create(arith::CmpIPredicate::slt, diff --git a/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp b/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp --- a/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/AsyncRegionRewriter.cpp @@ -236,7 +236,7 @@ SmallVector tokens; tokens.reserve(asyncTokens.size()); TypeSwitch(op) - .Case([&](auto awaitOp) { + .Case([&](auto) { // Add async.await ops to wait for the !gpu.async.tokens. builder.setInsertionPointAfter(op); for (auto asyncToken : asyncTokens) diff --git a/mlir/lib/Dialect/GPU/Transforms/SerializeToBlob.cpp b/mlir/lib/Dialect/GPU/Transforms/SerializeToBlob.cpp --- a/mlir/lib/Dialect/GPU/Transforms/SerializeToBlob.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/SerializeToBlob.cpp @@ -87,9 +87,8 @@ getOperation()->setAttr(gpuBinaryAnnotation, attr); } -LogicalResult -gpu::SerializeToBlobPass::optimizeLlvm(llvm::Module &llvmModule, - llvm::TargetMachine &targetMachine) { +LogicalResult gpu::SerializeToBlobPass::optimizeLlvm(llvm::Module &, + llvm::TargetMachine &) { // TODO: If serializeToCubin ends up defining optimizations, factor them // into here from SerializeToHsaco return success(); diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp @@ -57,7 +57,7 @@ LogicalResult LLVMArrayType::verify(function_ref emitError, - Type elementType, unsigned numElements) { + Type elementType, unsigned) { if (!isValidElementType(elementType)) return emitError() << "invalid array element type: " << elementType; return success(); @@ -69,20 +69,19 @@ } unsigned LLVMArrayType::getTypeSize(const DataLayout &dataLayout, - DataLayoutEntryListRef params) const { + DataLayoutEntryListRef) const { return llvm::alignTo(dataLayout.getTypeSize(getElementType()), dataLayout.getTypeABIAlignment(getElementType())) * getNumElements(); } unsigned LLVMArrayType::getABIAlignment(const DataLayout &dataLayout, - DataLayoutEntryListRef params) const { + DataLayoutEntryListRef) const { return dataLayout.getTypeABIAlignment(getElementType()); } -unsigned -LLVMArrayType::getPreferredAlignment(const DataLayout &dataLayout, - DataLayoutEntryListRef params) const { +unsigned LLVMArrayType::getPreferredAlignment(const DataLayout &dataLayout, + DataLayoutEntryListRef) const { return dataLayout.getTypePreferredAlignment(getElementType()); } @@ -416,9 +415,8 @@ return success(); } -unsigned -LLVMStructType::getTypeSizeInBits(const DataLayout &dataLayout, - DataLayoutEntryListRef params) const { +unsigned LLVMStructType::getTypeSizeInBits(const DataLayout &dataLayout, + DataLayoutEntryListRef) const { unsigned structSize = 0; unsigned structAlignment = 1; for (Type element : getBody()) { @@ -444,8 +442,7 @@ } // namespace static Optional -getStructDataLayoutEntry(DataLayoutEntryListRef params, LLVMStructType type, - StructDLEntryPos pos) { +getStructDataLayoutEntry(DataLayoutEntryListRef params, StructDLEntryPos pos) { const auto *currentEntry = llvm::find_if(params, [](DataLayoutEntryInterface entry) { return entry.isTypeEntry(); @@ -480,8 +477,7 @@ } // Entries are only allowed to be stricter than the required alignment - if (Optional entryResult = - getStructDataLayoutEntry(params, type, pos)) + if (Optional entryResult = getStructDataLayoutEntry(params, pos)) return std::max(*entryResult / kBitsInByte, structAlignment); return structAlignment; diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ArithInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ArithInterfaceImpl.cpp --- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ArithInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ArithInterfaceImpl.cpp @@ -40,7 +40,7 @@ return success(); } - bool isWritable(Operation *op, Value value, BufferizationState &state) const { + bool isWritable(Operation *, Value value, BufferizationState &) const { // Memory locations returned by memref::GetGlobalOp may not be written to. assert(value.isa()); return false; diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizationInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizationInterfaceImpl.cpp --- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizationInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizationInterfaceImpl.cpp @@ -39,18 +39,18 @@ struct ToMemrefOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &, + BufferizationState &) const { // It is unknown whether the resulting MemRef will be read or not. return true; } - OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + OpResult getAliasingOpResult(Operation *, OpOperand &, + BufferizationState &) const { return OpResult(); } - LogicalResult bufferize(Operation *op, OpBuilder &b, + LogicalResult bufferize(Operation *op, OpBuilder &, BufferizationState &state) const { auto toMemrefOp = cast(op); @@ -86,12 +86,12 @@ struct ToTensorOpInterface : public BufferizableOpInterface::ExternalModel { - LogicalResult bufferize(Operation *op, OpBuilder &b, - BufferizationState &state) const { + LogicalResult bufferize(Operation *, OpBuilder &, + BufferizationState &) const { return success(); } - bool isWritable(Operation *op, Value value, BufferizationState &state) const { + bool isWritable(Operation *, Value, BufferizationState &) const { // It is unknown whether the MemRef operand is writable or not. return false; } diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp --- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp +++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp @@ -83,7 +83,7 @@ LogicalResult run(Operation *op, BufferizationState &state, BufferizationAliasInfo &aliasInfo, - SmallVector &newOps) override { + SmallVector &) override { ModuleBufferizationState &moduleState = getModuleBufferizationState(state); // Support only single return-terminated block in the function. @@ -490,8 +490,8 @@ struct CallOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &, + BufferizationState &) const { // CallOpInterface alone doesn't bufferize to a memory read, one of the uses // of the matching bbArg may. It is the responsibility of the caller to // inspect bbArgs. In the absence of a BufferizationAliasInfo, we need to be @@ -499,8 +499,8 @@ return true; } - OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + OpResult getAliasingOpResult(Operation *, OpOperand &, + BufferizationState &) const { // CallOpInterface is special, it needs to wait for the callee to be // bufferized and needs to inspect the BufferAliasInfo object. It can't // make a proper determination by itself and needs to be conservative. @@ -620,18 +620,18 @@ struct ReturnOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &, + BufferizationState &) const { return true; } - bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryWrite(Operation *, OpOperand &, + BufferizationState &) const { return false; } - OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + OpResult getAliasingOpResult(Operation *, OpOperand &, + BufferizationState &) const { return OpResult(); } @@ -656,7 +656,7 @@ struct FuncOpInterface : public BufferizableOpInterface::ExternalModel { - LogicalResult bufferize(Operation *op, OpBuilder &b, + LogicalResult bufferize(Operation *op, OpBuilder &, BufferizationState &state) const { auto funcOp = cast(op); @@ -690,7 +690,7 @@ return false; } - bool isAllocationHoistingBarrier(Operation *op) const { return true; } + bool isAllocationHoistingBarrier(Operation *) const { return true; } }; } // namespace std_ext diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/SCFInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/SCFInterfaceImpl.cpp --- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/SCFInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/SCFInterfaceImpl.cpp @@ -22,9 +22,9 @@ struct ExecuteRegionOpInterface : public BufferizableOpInterface::ExternalModel { - SmallVector - getAliasingOpOperand(Operation *op, OpResult opResult, - BufferizationState &state) const { + SmallVector getAliasingOpOperand(Operation *op, + OpResult opResult, + BufferizationState &) const { // ExecuteRegionOps do not have tensor OpOperands. The yielded value can be // any SSA value that is in scope. To allow for use-def chain traversal // through ExecuteRegionOps in the analysis, the corresponding yield value @@ -40,8 +40,7 @@ return {&yieldOp->getOpOperand(resultNum)}; } - bool mustBufferizeInPlace(Operation *op, OpResult opResult, - BufferizationState &state) const { + bool mustBufferizeInPlace(Operation *, OpResult, BufferizationState &) const { // ExecuteRegionOp results always bufferize in-place. Since they have no // OpOperands, they are mostly ignored by the analysis once alias sets are // set up. @@ -50,8 +49,7 @@ // TODO: For better bufferization results, this could return `true` only if // there is a memory write in the region. - bool isMemoryWrite(Operation *op, OpResult opResult, - BufferizationState &state) const { + bool isMemoryWrite(Operation *, OpResult, BufferizationState &) const { // Similar to scf.if, results of this op are always considered memory writes // in the analysis. This is a useful pattern for all ops that have tensor // OpResults but no tensor OpOperands. By default, `isMemoryWrite` is @@ -60,7 +58,7 @@ return true; } - LogicalResult bufferize(Operation *op, OpBuilder &b, + LogicalResult bufferize(Operation *op, OpBuilder &, BufferizationState &state) const { // TODO: Add bufferization support when needed. scf.execute_region should be // bufferized similar to scf.if. @@ -74,18 +72,18 @@ state); } - BufferRelation bufferRelation(Operation *op, OpResult opResult, - const BufferizationAliasInfo &aliasInfo, - BufferizationState &state) const { + BufferRelation bufferRelation(Operation *, OpResult, + const BufferizationAliasInfo &, + BufferizationState &) const { return BufferRelation::Equivalent; } }; struct IfOpInterface : public BufferizableOpInterface::ExternalModel { - SmallVector - getAliasingOpOperand(Operation *op, OpResult opResult, - BufferizationState &state) const { + SmallVector getAliasingOpOperand(Operation *op, + OpResult opResult, + BufferizationState &) const { // IfOps do not have tensor OpOperands. The yielded value can be any SSA // value that is in scope. To allow for use-def chain traversal through // IfOps in the analysis, both corresponding yield values from the then/else @@ -101,8 +99,7 @@ // there is a memory write in one (or both) of the branches. Since this is not // allowed at the moment, we should never encounter scf.ifs that yield // unmodified tensors. Such scf.yield ops could just fold away. - bool isMemoryWrite(Operation *op, OpResult opResult, - BufferizationState &state) const { + bool isMemoryWrite(Operation *, OpResult, BufferizationState &) const { // IfOp results are always considered memory writes in the analysis. This // design decision simplifies the analysis considerably. E.g., consider the // following test case: @@ -128,14 +125,13 @@ return true; } - bool mustBufferizeInPlace(Operation *op, OpResult opResult, - BufferizationState &state) const { + bool mustBufferizeInPlace(Operation *, OpResult, BufferizationState &) const { // IfOp results always bufferize in-place. Since they have no OpOperands, // they are mostly ignored by the analysis once alias sets are set up. return true; } - LogicalResult bufferize(Operation *op, OpBuilder &b, + LogicalResult bufferize(Operation *op, OpBuilder &, BufferizationState &state) const { auto ifOp = cast(op); @@ -236,8 +232,8 @@ return state.isValueRead(forOp.getRegionIterArgForOpOperand(opOperand)); } - bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryWrite(Operation *, OpOperand &, + BufferizationState &) const { // Tensor iter_args of scf::ForOps are always considered as a write. This is // to simplify the analysis. // TODO: Consider doing sth. like isValueWritten. @@ -245,7 +241,7 @@ } OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + BufferizationState &) const { auto forOp = cast(op); if (!opOperand.get().getType().isa()) return OpResult(); @@ -254,7 +250,7 @@ BufferRelation bufferRelation(Operation *op, OpResult opResult, const BufferizationAliasInfo &aliasInfo, - BufferizationState &state) const { + BufferizationState &) const { // ForOp results are equivalent to their corresponding init_args if the // corresponding iter_args and yield values are equivalent. auto forOp = cast(op); @@ -266,7 +262,7 @@ return equivalentYield ? BufferRelation::Equivalent : BufferRelation::None; } - bool isWritable(Operation *op, Value value, BufferizationState &state) const { + bool isWritable(Operation *, Value, BufferizationState &) const { // Interestingly, scf::ForOp's bbArg can **always** be viewed // inplace from the perspective of ops nested under: // 1. Either the matching iter operand is not bufferized inplace and an @@ -308,7 +304,7 @@ // Construct a new scf.for op with memref instead of tensor values. SmallVector initArgs = - convert(forOp.getInitArgs(), [&](Value val, int64_t index) { + convert(forOp.getInitArgs(), [&](Value, int64_t index) { return state.getResultBuffer(forOp->getOpResult(index)); }); auto newForOp = rewriter.create( @@ -320,7 +316,7 @@ // iter_args of the new loop in ToTensorOps. rewriter.setInsertionPointToStart(loopBody); SmallVector iterArgs = - convert(newForOp.getRegionIterArgs(), [&](Value val, int64_t index) { + convert(newForOp.getRegionIterArgs(), [&](Value val, int64_t) { return rewriter.create(val.getLoc(), val); }); iterArgs.insert(iterArgs.begin(), newForOp.getInductionVar()); @@ -357,9 +353,9 @@ // do not bufferize inplace. (Requires a few more changes for ConstantOp, // InitTensorOp, CallOp.) LogicalResult mlir::linalg::comprehensive_bufferize::scf_ext:: - AssertDestinationPassingStyle::run(Operation *op, BufferizationState &state, + AssertDestinationPassingStyle::run(Operation *op, BufferizationState &, BufferizationAliasInfo &aliasInfo, - SmallVector &newOps) { + SmallVector &) { LogicalResult status = success(); op->walk([&](scf::YieldOp yieldOp) { if (auto forOp = dyn_cast(yieldOp->getParentOp())) { @@ -423,23 +419,23 @@ struct YieldOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &, + BufferizationState &) const { return true; } - bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryWrite(Operation *, OpOperand &, + BufferizationState &) const { return false; } - OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + OpResult getAliasingOpResult(Operation *, OpOperand &, + BufferizationState &) const { return OpResult(); } - LogicalResult bufferize(Operation *op, OpBuilder &b, - BufferizationState &state) const { + LogicalResult bufferize(Operation *op, OpBuilder &, + BufferizationState &) const { auto yieldOp = cast(op); if (!isa( yieldOp->getParentOp())) diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/TensorInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/TensorInterfaceImpl.cpp --- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/TensorInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/TensorInterfaceImpl.cpp @@ -40,24 +40,24 @@ struct CastOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &, + BufferizationState &) const { return false; } - bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryWrite(Operation *, OpOperand &, + BufferizationState &) const { return false; } - OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + OpResult getAliasingOpResult(Operation *op, OpOperand &, + BufferizationState &) const { return op->getResult(0); } - BufferRelation bufferRelation(Operation *op, OpResult opResult, - const BufferizationAliasInfo &aliasInfo, - BufferizationState &state) const { + BufferRelation bufferRelation(Operation *, OpResult, + const BufferizationAliasInfo &, + BufferizationState &) const { return BufferRelation::Equivalent; } @@ -90,18 +90,18 @@ struct DimOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &, + BufferizationState &) const { return true; } - bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryWrite(Operation *, OpOperand &, + BufferizationState &) const { return false; } - OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + OpResult getAliasingOpResult(Operation *, OpOperand &, + BufferizationState &) const { return OpResult(); } @@ -119,26 +119,26 @@ struct ExtractSliceOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &, + BufferizationState &) const { return false; } - bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryWrite(Operation *, OpOperand &, + BufferizationState &) const { return false; } OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + BufferizationState &) const { return &opOperand == &op->getOpOperand(0) /*source*/ ? op->getResult(0) : OpResult(); } - BufferRelation bufferRelation(Operation *op, OpResult opResult, - const BufferizationAliasInfo &aliasInfo, - BufferizationState &state) const { + BufferRelation bufferRelation(Operation *, OpResult, + const BufferizationAliasInfo &, + BufferizationState &) const { return BufferRelation::None; } @@ -184,18 +184,18 @@ struct ExtractOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &, + BufferizationState &) const { return true; } - bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryWrite(Operation *, OpOperand &, + BufferizationState &) const { return false; } - OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + OpResult getAliasingOpResult(Operation *, OpOperand &, + BufferizationState &) const { return OpResult(); } @@ -212,26 +212,25 @@ struct InsertOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &, + BufferizationState &) const { return true; } - bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryWrite(Operation *, OpOperand &, + BufferizationState &) const { return true; } OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + BufferizationState &) const { assert(&opOperand == &op->getOpOperand(1) /*dest*/ && "expected dest OpOperand"); return op->getOpResult(0); } - SmallVector - getAliasingOpOperand(Operation *op, OpResult opResult, - BufferizationState &state) const { + SmallVector getAliasingOpOperand(Operation *op, OpResult, + BufferizationState &) const { return {&op->getOpOperand(1) /*dest*/}; } @@ -246,9 +245,9 @@ return success(); } - BufferRelation bufferRelation(Operation *op, OpResult opResult, - const BufferizationAliasInfo &aliasInfo, - BufferizationState &state) const { + BufferRelation bufferRelation(Operation *, OpResult, + const BufferizationAliasInfo &, + BufferizationState &) const { return BufferRelation::Equivalent; } }; @@ -307,30 +306,30 @@ struct InsertSliceOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &, + BufferizationState &) const { return true; } bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + BufferizationState &) const { return &opOperand == &op->getOpOperand(1) /*dest*/; } OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + BufferizationState &) const { return &opOperand == &op->getOpOperand(1) /*dest*/ ? op->getResult(0) : OpResult(); } - BufferRelation bufferRelation(Operation *op, OpResult opResult, - const BufferizationAliasInfo &aliasInfo, - BufferizationState &state) const { + BufferRelation bufferRelation(Operation *, OpResult, + const BufferizationAliasInfo &, + BufferizationState &) const { return BufferRelation::Equivalent; } - bool isNotConflicting(Operation *op, OpOperand *uRead, + bool isNotConflicting(Operation *, OpOperand *uRead, OpOperand *uConflictingWrite, BufferizationState &state, const BufferizationAliasInfo &aliasInfo) const { Operation *readingOp = uRead->getOwner(); @@ -455,7 +454,7 @@ LogicalResult mlir::linalg::comprehensive_bufferize::tensor_ext:: InplaceInsertSliceOpAnalysis::run(Operation *op, BufferizationState &state, BufferizationAliasInfo &aliasInfo, - SmallVector &newOps) { + SmallVector &) { auto &tensorState = getTensorBufferizationState(state); op->walk([&](InsertSliceOp insertSliceOp) { // A copy of the source buffer is needed if either: diff --git a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/VectorInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/VectorInterfaceImpl.cpp --- a/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/VectorInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Linalg/ComprehensiveBufferize/VectorInterfaceImpl.cpp @@ -20,22 +20,22 @@ struct TransferReadOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &opOperand, + BufferizationState &) const { assert(opOperand.get().getType().isa() && "only tensor types expected"); return true; } - bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryWrite(Operation *, OpOperand &opOperand, + BufferizationState &) const { assert(opOperand.get().getType().isa() && "only tensor types expected"); return false; } - OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + OpResult getAliasingOpResult(Operation *, OpOperand &, + BufferizationState &) const { return OpResult(); } @@ -59,30 +59,30 @@ struct TransferWriteOpInterface : public BufferizableOpInterface::ExternalModel { - bool bufferizesToMemoryRead(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryRead(Operation *, OpOperand &opOperand, + BufferizationState &) const { assert(opOperand.get().getType().isa() && "only tensor types expected"); return true; } - bool bufferizesToMemoryWrite(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + bool bufferizesToMemoryWrite(Operation *, OpOperand &opOperand, + BufferizationState &) const { assert(opOperand.get().getType().isa() && "only tensor types expected"); return true; } OpResult getAliasingOpResult(Operation *op, OpOperand &opOperand, - BufferizationState &state) const { + BufferizationState &) const { assert(opOperand.get().getType().isa() && "only tensor types expected"); return op->getOpResult(0); } - BufferRelation bufferRelation(Operation *op, OpResult opResult, - const BufferizationAliasInfo &aliasInfo, - BufferizationState &state) const { + BufferRelation bufferRelation(Operation *, OpResult, + const BufferizationAliasInfo &, + BufferizationState &) const { return BufferRelation::Equivalent; } diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp --- a/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp +++ b/mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp @@ -37,8 +37,8 @@ // We don't have any special restrictions on what can be inlined into // destination regions (e.g. while/conditional bodies). Always allow it. - bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned, - BlockAndValueMapping &valueMapping) const final { + bool isLegalToInline(Region *, Region *, bool, + BlockAndValueMapping &) const final { return true; } // Operations in Linalg dialect are always legal to inline. diff --git a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp @@ -101,7 +101,7 @@ blockArgsToDetensor(std::move(blockArgsToDetensor)) {} LogicalResult - matchAndRewrite(Operation *op, ArrayRef operands, + matchAndRewrite(Operation *op, ArrayRef, ConversionPatternRewriter &rewriter) const override { rewriter.startRootUpdate(op); Region ®ion = function_like_impl::getFunctionBody(op); @@ -151,8 +151,8 @@ }); // A tensor value is detensoried by extracting its element(s). - addTargetMaterialization([](OpBuilder &builder, Type type, - ValueRange inputs, Location loc) -> Value { + addTargetMaterialization([](OpBuilder &builder, Type, ValueRange inputs, + Location loc) -> Value { return builder.create(loc, inputs[0], ValueRange{}); }); diff --git a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp @@ -260,7 +260,7 @@ // Encode structural fusion safety preconditions. // Some of these will be lifted in the future with better analysis. -static bool isStructurallyFusableProducer(LinalgOp producer, Value consumedView, +static bool isStructurallyFusableProducer(LinalgOp producer, LinalgOp consumer) { assert(producer.hasBufferSemantics() && "expected linalg op with buffer semantics"); @@ -291,7 +291,7 @@ "expected linalg op with buffer semantics"); // Make some simple structural checks that alleviate the need for more // complex analyses. - if (!isStructurallyFusableProducer(producer, consumedView, consumer)) { + if (!isStructurallyFusableProducer(producer, consumer)) { LLVM_DEBUG(llvm::dbgs() << "\n***Not static last write due to structure:\t" << *producer.getOperation()); return false; diff --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp @@ -180,7 +180,7 @@ .Case([&](AffineForOp affineForOp) { allIvs.push_back(affineForOp.getInductionVar()); }) - .Default([&](Operation *op) { assert(false && "unexpected op"); }); + .Default([&](Operation *) { assert(false && "unexpected op"); }); } assert(linalgOp.getNumLoops() == allIvs.size() && "expected the number of loops and induction variables to match"); @@ -308,8 +308,9 @@ if (!seqIVs.empty()) { scf::LoopNest nest = scf::buildLoopNest(builder, loc, seqLBs, seqUBs, seqSteps, - [&](OpBuilder &builder, Location loc, - ValueRange ivs) { bvm.map(seqIVs, ivs); }); + [&](OpBuilder &, Location, ValueRange ivs) { + bvm.map(seqIVs, ivs); + }); builder.setInsertionPointToStart(nest.loops.back().getBody()); } for (auto &op : tiledLoop.getBody()->without_terminator()) diff --git a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp --- a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp @@ -116,19 +116,17 @@ return llvm::TypeSwitch>( reductionOp) .Case( - [&](auto op) { return vector::CombiningKind::ADD; }) - .Case([&](auto op) { return vector::CombiningKind::AND; }) - .Case( - [&](auto op) { return vector::CombiningKind::MAXSI; }) - .Case([&](auto op) { return vector::CombiningKind::MAXF; }) - .Case( - [&](auto op) { return vector::CombiningKind::MINSI; }) - .Case([&](auto op) { return vector::CombiningKind::MINF; }) + [&](auto) { return vector::CombiningKind::ADD; }) + .Case([&](auto) { return vector::CombiningKind::AND; }) + .Case([&](auto) { return vector::CombiningKind::MAXSI; }) + .Case([&](auto) { return vector::CombiningKind::MAXF; }) + .Case([&](auto) { return vector::CombiningKind::MINSI; }) + .Case([&](auto) { return vector::CombiningKind::MINF; }) .Case( - [&](auto op) { return vector::CombiningKind::MUL; }) - .Case([&](auto op) { return vector::CombiningKind::OR; }) - .Case([&](auto op) { return vector::CombiningKind::XOR; }) - .Default([&](auto op) { return llvm::None; }); + [&](auto) { return vector::CombiningKind::MUL; }) + .Case([&](auto) { return vector::CombiningKind::OR; }) + .Case([&](auto) { return vector::CombiningKind::XOR; }) + .Default([&](auto) { return llvm::None; }); } /// Check whether `outputOperand` is a reduction with a single combiner @@ -547,8 +545,7 @@ // 4b. Register CustomVectorizationHook for indexOp. CustomVectorizationHook vectorizeIndex = - [&](Operation *op, - const BlockAndValueMapping &bvm) -> VectorizationResult { + [&](Operation *op, const BlockAndValueMapping &) -> VectorizationResult { return vectorizeLinalgIndex(b, op, linalgOp); }; hooks.push_back(vectorizeIndex); @@ -1548,8 +1545,8 @@ // Compute contraction: O{n, w, f} += I{n, sw * w + dw * kw, c} * F{c, f} for (int64_t kw = 0; kw < kwSize; ++kw) { for (int64_t w = 0; w < wSize; w += wSizeStep) { - resVals[w] = conv1dSliceAsContraction( - builder, loc, lhsVals[linearIndex(kw, w)], rhsVals[kw], resVals[w]); + resVals[w] = conv1dSliceAsContraction(loc, lhsVals[linearIndex(kw, w)], + rhsVals[kw], resVals[w]); } } @@ -1573,8 +1570,8 @@ } // Create a contraction: lhs{n, w, c} * rhs{c, f} -> res{n, w, f} - Value conv1dSliceAsContraction(OpBuilder &b, Location loc, Value lhs, - Value rhs, Value res) { + Value conv1dSliceAsContraction(Location loc, Value lhs, Value rhs, + Value res) { StringRef par = Par().strRef, red = Red().strRef; AffineExpr n, w, f, c; bindDims(ctx, n, w, f, c); diff --git a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp --- a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp +++ b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp @@ -395,7 +395,7 @@ ValueRange)> bodyBuilderFn, Optional distributionOptions, - ArrayRef distributionTypes) { + ArrayRef) { SmallVector iterArgInitValues = linalgOp.getOutputTensorOperands(); // Create procInfo so it dominates loops, if appropriate. SmallVector procInfo; @@ -450,7 +450,7 @@ template <> void GenerateLoopNest::doit( OpBuilder &b, Location loc, ArrayRef loopRanges, LinalgOp linalgOp, - ArrayRef iteratorTypes, + ArrayRef, function_ref bodyBuilderFn, @@ -485,7 +485,7 @@ function_ref bodyBuilderFn, - Optional distributionOptions, + Optional, ArrayRef distributionTypes) { SmallVector procInfo; SmallVector lbs, ubs, steps; @@ -512,7 +512,7 @@ /// Update the `lb`, `ub` and `step` to get per processor `lb`, `ub` and `step`. void updateBoundsForCyclicDistribution(OpBuilder &b, Location loc, Value procId, - Value nprocs, Value &lb, Value &ub, + Value nprocs, Value &lb, Value &, Value &step) { AffineExpr d0, d1; bindDims(b.getContext(), d0, d1); @@ -653,7 +653,7 @@ ValueRange)> bodyBuilderFn, Optional distributionOptions, - ArrayRef distributionTypes) { + ArrayRef) { SmallVector iterArgInitValues = linalgOp.getOutputTensorOperands(); assert(iterArgInitValues.empty() && "unexpected ParallelOp init values"); // This function may be passed more iterator types than ranges. @@ -844,7 +844,7 @@ return offsets; } -SmallVector computeTileSizes(OpBuilder &b, Location loc, ValueRange ivs, +SmallVector computeTileSizes(OpBuilder &b, Location loc, ValueRange, ValueRange tileSizes, ArrayRef sizeBounds) { SmallVector sizes; diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp --- a/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp +++ b/mlir/lib/Dialect/MemRef/IR/MemRefDialect.cpp @@ -21,11 +21,11 @@ namespace { struct MemRefInlinerInterface : public DialectInlinerInterface { using DialectInlinerInterface::DialectInlinerInterface; - bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned, - BlockAndValueMapping &valueMapping) const final { + bool isLegalToInline(Region *, Region *, bool, + BlockAndValueMapping &) const final { return true; } - bool isLegalToInline(Operation *, Region *, bool wouldBeCloned, + bool isLegalToInline(Operation *, Region *, bool, BlockAndValueMapping &) const final { return true; } diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp --- a/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp +++ b/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp @@ -253,7 +253,7 @@ } void AllocaScopeOp::getSuccessorRegions( - Optional index, ArrayRef operands, + Optional index, ArrayRef, SmallVectorImpl ®ions) { if (index.hasValue()) { regions.push_back(RegionSuccessor(getResults())); @@ -434,7 +434,7 @@ return false; } -OpFoldResult CastOp::fold(ArrayRef operands) { +OpFoldResult CastOp::fold(ArrayRef) { return succeeded(foldMemRefCast(*this)) ? getResult() : Value(); } @@ -442,8 +442,8 @@ // DeallocOp //===----------------------------------------------------------------------===// -LogicalResult DeallocOp::fold(ArrayRef cstOperands, - SmallVectorImpl &results) { +LogicalResult DeallocOp::fold(ArrayRef, + SmallVectorImpl &) { /// dealloc(memrefcast) -> dealloc return foldMemRefCast(*this); } @@ -684,8 +684,8 @@ // DmaStartOp // --------------------------------------------------------------------------- -void DmaStartOp::build(OpBuilder &builder, OperationState &result, - Value srcMemRef, ValueRange srcIndices, Value destMemRef, +void DmaStartOp::build(OpBuilder &, OperationState &result, Value srcMemRef, + ValueRange srcIndices, Value destMemRef, ValueRange destIndices, Value numElements, Value tagMemRef, ValueRange tagIndices, Value stride, Value elementsPerStride) { @@ -848,8 +848,8 @@ return success(); } -LogicalResult DmaStartOp::fold(ArrayRef cstOperands, - SmallVectorImpl &results) { +LogicalResult DmaStartOp::fold(ArrayRef, + SmallVectorImpl &) { /// dma_start(memrefcast) -> dma_start return foldMemRefCast(*this); } @@ -858,8 +858,8 @@ // DmaWaitOp // --------------------------------------------------------------------------- -LogicalResult DmaWaitOp::fold(ArrayRef cstOperands, - SmallVectorImpl &results) { +LogicalResult DmaWaitOp::fold(ArrayRef, + SmallVectorImpl &) { /// dma_wait(memrefcast) -> dma_wait return foldMemRefCast(*this); } @@ -992,7 +992,7 @@ return success(); } -OpFoldResult LoadOp::fold(ArrayRef cstOperands) { +OpFoldResult LoadOp::fold(ArrayRef) { /// load(memrefcast) -> load if (succeeded(foldMemRefCast(*this))) return getResult(); @@ -1063,8 +1063,8 @@ return success(); } -LogicalResult PrefetchOp::fold(ArrayRef cstOperands, - SmallVectorImpl &results) { +LogicalResult PrefetchOp::fold(ArrayRef, + SmallVectorImpl &) { // prefetch(memrefcast) -> prefetch return foldMemRefCast(*this); } @@ -1073,7 +1073,7 @@ // RankOp //===----------------------------------------------------------------------===// -OpFoldResult RankOp::fold(ArrayRef operands) { +OpFoldResult RankOp::fold(ArrayRef) { // Constant fold rank when the rank of the operand is known. auto type = getOperand().getType(); auto shapedType = type.dyn_cast(); @@ -1455,8 +1455,8 @@ return success(); } -LogicalResult StoreOp::fold(ArrayRef cstOperands, - SmallVectorImpl &results) { +LogicalResult StoreOp::fold(ArrayRef, + SmallVectorImpl &) { /// store(memrefcast) -> store return foldMemRefCast(*this, getValueToStore()); } @@ -1684,7 +1684,7 @@ void SubViewOp::build(OpBuilder &b, OperationState &result, MemRefType resultType, Value source, ValueRange offsets, ValueRange sizes, ValueRange strides, - ArrayRef attrs) { + ArrayRef) { SmallVector offsetValues = llvm::to_vector<4>( llvm::map_range(offsets, [](Value v) -> OpFoldResult { return v; })); SmallVector sizeValues = llvm::to_vector<4>( @@ -2017,7 +2017,7 @@ SubViewOpMemRefCastFolder, TrivialSubViewOpFolder>(context); } -OpFoldResult SubViewOp::fold(ArrayRef operands) { +OpFoldResult SubViewOp::fold(ArrayRef) { auto resultShapedType = getResult().getType().cast(); auto sourceShapedType = source().getType().cast(); @@ -2320,7 +2320,7 @@ return success(); } -OpFoldResult AtomicRMWOp::fold(ArrayRef operands) { +OpFoldResult AtomicRMWOp::fold(ArrayRef) { /// atomicrmw(memrefcast) -> atomicrmw if (succeeded(foldMemRefCast(*this, value()))) return getResult(); 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) { // 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, 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 @@ -267,10 +267,11 @@ storageTypeMin, storageTypeMax); } -LogicalResult UniformQuantizedType::verify( - function_ref emitError, unsigned flags, - Type storageType, Type expressedType, double scale, int64_t zeroPoint, - int64_t storageTypeMin, int64_t storageTypeMax) { +LogicalResult +UniformQuantizedType::verify(function_ref emitError, + unsigned flags, Type storageType, + Type expressedType, double scale, int64_t, + int64_t storageTypeMin, int64_t storageTypeMax) { if (failed(QuantizedType::verify(emitError, flags, storageType, expressedType, storageTypeMin, storageTypeMax))) { return failure(); @@ -323,8 +324,8 @@ LogicalResult UniformQuantizedPerAxisType::verify( function_ref emitError, unsigned flags, Type storageType, Type expressedType, ArrayRef scales, - ArrayRef zeroPoints, int32_t quantizedDimension, - int64_t storageTypeMin, int64_t storageTypeMax) { + ArrayRef zeroPoints, int32_t, int64_t storageTypeMin, + int64_t storageTypeMax) { if (failed(QuantizedType::verify(emitError, flags, storageType, expressedType, storageTypeMin, storageTypeMax))) { return failure(); diff --git a/mlir/lib/Dialect/SCF/SCF.cpp b/mlir/lib/Dialect/SCF/SCF.cpp --- a/mlir/lib/Dialect/SCF/SCF.cpp +++ b/mlir/lib/Dialect/SCF/SCF.cpp @@ -31,8 +31,8 @@ using DialectInlinerInterface::DialectInlinerInterface; // We don't have any special restrictions on what can be inlined into // destination regions (e.g. while/conditional bodies). Always allow it. - bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned, - BlockAndValueMapping &valueMapping) const final { + bool isLegalToInline(Region *, Region *, bool, + BlockAndValueMapping &) const final { return true; } // Operations in scf dialect are always legal to inline since they are @@ -240,7 +240,7 @@ //===----------------------------------------------------------------------===// MutableOperandRange -ConditionOp::getMutableSuccessorOperands(Optional index) { +ConditionOp::getMutableSuccessorOperands(Optional) { // Pass all operands except the condition to the successor region. return getArgsMutable(); } @@ -447,8 +447,7 @@ /// during the flow of control. `operands` is a set of optional attributes that /// correspond to a constant value for each operand, or null if that operand is /// not a constant. -void ForOp::getSuccessorRegions(Optional index, - ArrayRef operands, +void ForOp::getSuccessorRegions(Optional index, ArrayRef, SmallVectorImpl ®ions) { // If the predecessor is the ForOp, branch into the body using the iterator // arguments. @@ -516,8 +515,7 @@ for (unsigned i = 0, e = lbs.size(); i < e; ++i) { auto loop = builder.create( currentLoc, lbs[i], ubs[i], steps[i], currentIterArgs, - [&](OpBuilder &nestedBuilder, Location nestedLoc, Value iv, - ValueRange args) { + [&](OpBuilder &, Location nestedLoc, Value iv, ValueRange args) { ivs.push_back(iv); // It is safe to store ValueRange args because it points to block // arguments of a loop operation that we also own. diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp --- a/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp @@ -52,7 +52,7 @@ ? forOp.getIterOperands()[opResult.getResultNumber()] : Value(); }) - .Default([&](auto op) { return Value(); }); + .Default([&](auto) { return Value(); }); } return false; } diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp @@ -399,7 +399,7 @@ } void PointerType::getExtensions(SPIRVType::ExtensionArrayRefVector &extensions, - Optional storage) { + Optional) { // Use this pointer type's storage class because this pointer indicates we are // using the pointee type in that specific storage class. getPointeeType().cast().getExtensions(extensions, @@ -410,8 +410,7 @@ } void PointerType::getCapabilities( - SPIRVType::CapabilityArrayRefVector &capabilities, - Optional storage) { + SPIRVType::CapabilityArrayRefVector &capabilities, Optional) { // Use this pointer type's storage class because this pointer indicates we are // using the pointee type in that specific storage class. getPointeeType().cast().getCapabilities(capabilities, diff --git a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp --- a/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/LowerABIAttributesPass.cpp @@ -168,7 +168,7 @@ } // namespace LogicalResult ProcessInterfaceVarABI::matchAndRewrite( - spirv::FuncOp funcOp, OpAdaptor adaptor, + spirv::FuncOp funcOp, OpAdaptor, ConversionPatternRewriter &rewriter) const { if (!funcOp->getAttrOfType( spirv::getEntryPointABIAttrName())) { diff --git a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp --- a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp @@ -550,7 +550,7 @@ } // namespace LogicalResult -FuncOpConversion::matchAndRewrite(FuncOp funcOp, OpAdaptor adaptor, +FuncOpConversion::matchAndRewrite(FuncOp funcOp, OpAdaptor, ConversionPatternRewriter &rewriter) const { auto fnType = funcOp.getType(); if (fnType.getNumResults() > 1) @@ -690,7 +690,6 @@ /// Returns the pointer type for the push constant storage containing /// `elementCount` 32-bit integer values. static spirv::PointerType getPushConstantStorageType(unsigned elementCount, - Builder &builder, Type indexType) { auto arrayType = spirv::ArrayType::get(indexType, elementCount, /*stride=*/4); @@ -733,7 +732,7 @@ return varOp; auto builder = OpBuilder::atBlockBegin(&block, b.getListener()); - auto type = getPushConstantStorageType(elementCount, builder, indexType); + auto type = getPushConstantStorageType(elementCount, indexType); const char *name = "__push_constant_var__"; return builder.create(loc, type, name, /*initializer=*/nullptr); diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp --- a/mlir/lib/Dialect/Shape/IR/Shape.cpp +++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp @@ -116,7 +116,7 @@ // Returns true if the given region 'src' can be inlined into the region // 'dest' that is attached to an operation registered to the current dialect. - bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned, + bool isLegalToInline(Region *, Region *, bool, BlockAndValueMapping &) const final { return true; } @@ -124,7 +124,7 @@ // Returns true if the given operation 'op', that is registered to this // dialect, can be inlined into the region 'dest' that is attached to an // operation registered to the current dialect. - bool isLegalToInline(Operation *op, Region *dest, bool wouldBeCloned, + bool isLegalToInline(Operation *, Region *, bool, BlockAndValueMapping &) const final { return true; } @@ -366,7 +366,7 @@ // See RegionBranchOpInterface in Interfaces/ControlFlowInterfaces.td void AssumingOp::getSuccessorRegions( - Optional index, ArrayRef operands, + Optional index, ArrayRef, SmallVectorImpl ®ions) { // AssumingOp has unconditional control flow into the region and back to the // parent, so return the correct RegionSuccessor purely based on the index @@ -425,9 +425,8 @@ //===----------------------------------------------------------------------===// LogicalResult mlir::shape::AddOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, - SmallVectorImpl &inferredReturnTypes) { + MLIRContext *context, Optional, ValueRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnTypes) { if (operands[0].getType().isa() || operands[1].getType().isa()) inferredReturnTypes.assign({SizeType::get(context)}); @@ -823,8 +822,8 @@ } LogicalResult mlir::shape::ConstShapeOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, + MLIRContext *context, Optional location, ValueRange, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnTypes) { Builder b(context); auto shape = attributes.getAs("shape"); @@ -1001,9 +1000,8 @@ } LogicalResult mlir::shape::DivOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, - SmallVectorImpl &inferredReturnTypes) { + MLIRContext *context, Optional, ValueRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnTypes) { if (operands[0].getType().isa() || operands[1].getType().isa()) inferredReturnTypes.assign({SizeType::get(context)}); @@ -1159,9 +1157,8 @@ } LogicalResult mlir::shape::GetExtentOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, - SmallVectorImpl &inferredReturnTypes) { + MLIRContext *context, Optional, ValueRange, DictionaryAttr, + RegionRange, SmallVectorImpl &inferredReturnTypes) { inferredReturnTypes.assign({IndexType::get(context)}); return success(); } @@ -1195,9 +1192,8 @@ //===----------------------------------------------------------------------===// LogicalResult mlir::shape::MeetOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, - SmallVectorImpl &inferredReturnTypes) { + MLIRContext *, Optional, ValueRange operands, DictionaryAttr, + RegionRange, SmallVectorImpl &inferredReturnTypes) { inferredReturnTypes.assign({operands[0].getType()}); return success(); } @@ -1283,9 +1279,8 @@ } LogicalResult mlir::shape::RankOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, - SmallVectorImpl &inferredReturnTypes) { + MLIRContext *context, Optional, ValueRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnTypes) { if (operands[0].getType().isa()) inferredReturnTypes.assign({SizeType::get(context)}); else @@ -1317,9 +1312,8 @@ } LogicalResult mlir::shape::NumElementsOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, - SmallVectorImpl &inferredReturnTypes) { + MLIRContext *context, Optional, ValueRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnTypes) { if (operands[0].getType().isa()) inferredReturnTypes.assign({SizeType::get(context)}); else @@ -1337,7 +1331,7 @@ // MaxOp //===----------------------------------------------------------------------===// -OpFoldResult MaxOp::fold(llvm::ArrayRef operands) { +OpFoldResult MaxOp::fold(llvm::ArrayRef) { // If operands are equal, just propagate one. if (getLhs() == getRhs()) return getLhs(); @@ -1345,9 +1339,8 @@ } LogicalResult mlir::shape::MaxOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, - SmallVectorImpl &inferredReturnTypes) { + MLIRContext *context, Optional, ValueRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnTypes) { if (operands[0].getType() == operands[1].getType()) inferredReturnTypes.assign({operands[0].getType()}); else @@ -1369,7 +1362,7 @@ // MinOp //===----------------------------------------------------------------------===// -OpFoldResult MinOp::fold(llvm::ArrayRef operands) { +OpFoldResult MinOp::fold(llvm::ArrayRef) { // If operands are equal, just propagate one. if (getLhs() == getRhs()) return getLhs(); @@ -1377,9 +1370,8 @@ } LogicalResult mlir::shape::MinOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, - SmallVectorImpl &inferredReturnTypes) { + MLIRContext *context, Optional, ValueRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnTypes) { if (operands[0].getType() == operands[1].getType()) inferredReturnTypes.assign({operands[0].getType()}); else @@ -1414,9 +1406,8 @@ } LogicalResult mlir::shape::MulOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, - SmallVectorImpl &inferredReturnTypes) { + MLIRContext *context, Optional, ValueRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnTypes) { if (operands[0].getType().isa() || operands[1].getType().isa()) inferredReturnTypes.assign({SizeType::get(context)}); @@ -1498,9 +1489,8 @@ } LogicalResult mlir::shape::ShapeOfOp::inferReturnTypes( - MLIRContext *context, Optional location, ValueRange operands, - DictionaryAttr attributes, RegionRange regions, - SmallVectorImpl &inferredReturnTypes) { + MLIRContext *context, Optional, ValueRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnTypes) { if (operands[0].getType().isa()) inferredReturnTypes.assign({ShapeType::get(context)}); else { diff --git a/mlir/lib/Dialect/Shape/Transforms/StructuralTypeConversions.cpp b/mlir/lib/Dialect/Shape/Transforms/StructuralTypeConversions.cpp --- a/mlir/lib/Dialect/Shape/Transforms/StructuralTypeConversions.cpp +++ b/mlir/lib/Dialect/Shape/Transforms/StructuralTypeConversions.cpp @@ -20,7 +20,7 @@ using OpConversionPattern::OpConversionPattern; LogicalResult - matchAndRewrite(AssumingOp op, OpAdaptor adaptor, + matchAndRewrite(AssumingOp op, OpAdaptor, ConversionPatternRewriter &rewriter) const final { SmallVector newResultTypes; newResultTypes.reserve(op.getNumResults()); diff --git a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp --- a/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp +++ b/mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp @@ -39,7 +39,7 @@ } } -Attribute SparseTensorEncodingAttr::parse(AsmParser &parser, Type type) { +Attribute SparseTensorEncodingAttr::parse(AsmParser &parser, Type) { if (failed(parser.parseLess())) return {}; // Parse the data as a dictionary. @@ -162,7 +162,7 @@ } LogicalResult SparseTensorEncodingAttr::verifyEncoding( - ArrayRef shape, Type elementType, + ArrayRef shape, Type, function_ref emitError) const { // Check structural integrity. if (failed(verify(emitError, getDimLevelType(), getDimOrdering(), @@ -257,7 +257,7 @@ return op.emitError("unexpected type in convert"); } -OpFoldResult ConvertOp::fold(ArrayRef operands) { +OpFoldResult ConvertOp::fold(ArrayRef) { if (getType() == source().getType()) return source(); return {}; diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp @@ -746,8 +746,8 @@ Type eltType = stp.getElementType(); scf::buildLoopNest( rewriter, op.getLoc(), lo, hi, st, {}, - [&](OpBuilder &builder, Location loc, ValueRange ivs, - ValueRange args) -> scf::ValueVector { + [&](OpBuilder &, Location loc, ValueRange ivs, + ValueRange) -> scf::ValueVector { Value val; if (isCOOConstant) val = genIndexAndValueForSparse(rewriter, loc, indices, values, ind, diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp --- a/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp @@ -466,9 +466,8 @@ /// values are computed and written out. For updates (viz. x(i) += y(i) * z(i)), /// only nonzeroes values are used for the updates and no assumption on the /// original contents of the output buffer is necessary.. -static Value genOutputBuffer(CodeGen &codegen, PatternRewriter &rewriter, - linalg::GenericOp op, MemRefType denseTp, - ArrayRef args) { +static Value genOutputBuffer(PatternRewriter &rewriter, linalg::GenericOp op, + MemRefType denseTp, ArrayRef args) { Location loc = op.getLoc(); Value tensor = op.getOutputOperand(0)->get(); // The output tensor simply could materialize from the buffer that will @@ -553,8 +552,7 @@ codegen.buffers[tensor] = rewriter.create(loc, denseTp, t->get()); else - codegen.buffers[tensor] = - genOutputBuffer(codegen, rewriter, op, denseTp, args); + codegen.buffers[tensor] = genOutputBuffer(rewriter, op, denseTp, args); } else if (t == codegen.sparseOut) { // True sparse output needs a lexIdx array. Value rank = rewriter.create(loc, op.getRank(t)); @@ -986,9 +984,8 @@ } /// Generates an expanded access pattern in innermost dimension. -static void genExpansion(Merger &merger, CodeGen &codegen, - PatternRewriter &rewriter, linalg::GenericOp op, - unsigned at, bool atStart) { +static void genExpansion(CodeGen &codegen, PatternRewriter &rewriter, + linalg::GenericOp op, unsigned at, bool atStart) { OpOperand *lhs = codegen.sparseOut; if (!lhs || codegen.outerParNest != op.getRank(lhs) - 1 || at != codegen.outerParNest) @@ -1101,8 +1098,7 @@ /// dense access patterns in order to avoid cycles (sparse access patterns are /// always placed innermost), but that means dense access has become strided. /// This prevents effective vectorization. -static bool denseUnitStrides(Merger &merger, linalg::GenericOp op, - unsigned idx) { +static bool denseUnitStrides(linalg::GenericOp op, unsigned idx) { for (OpOperand *t : op.getInputAndOutputOperands()) { if (!getSparseTensorEncoding(t->get().getType())) { auto map = op.getTiedIndexingMap(t); @@ -1135,7 +1131,7 @@ bool isSparse = merger.isDim(fb, Dim::kSparse); bool isVector = !codegen.sparseOut && isVectorFor(codegen, isInner, isSparse) && - denseUnitStrides(merger, op, idx); + denseUnitStrides(op, idx); bool isParallel = !codegen.sparseOut && isParallelFor(codegen, isOuter, isReduction, isSparse, isVector); @@ -1461,8 +1457,8 @@ /// Generates end of true branch of if-statement within a while-loop. static void endIf(Merger &merger, CodeGen &codegen, PatternRewriter &rewriter, - linalg::GenericOp op, scf::IfOp ifOp, Operation *loop, - Value redInput, Value cntInput) { + linalg::GenericOp op, scf::IfOp ifOp, Value redInput, + Value cntInput) { SmallVector operands; if (codegen.redVal) { operands.push_back(codegen.redVal); @@ -1493,7 +1489,7 @@ // Emit invariants at this loop sequence level. genInvariants(merger, codegen, rewriter, op, exp, ldx, /*atStart=*/true); // Emit access pattern expansion for sparse tensor output. - genExpansion(merger, codegen, rewriter, op, at, /*atStart=*/true); + genExpansion(codegen, rewriter, op, at, /*atStart=*/true); // Emit further intitialization at this loop sequence level. unsigned l0 = merger.set(lts)[0]; bool needsUniv = @@ -1556,7 +1552,7 @@ // Unmark bookkeeping of invariants and loop index. genInvariants(merger, codegen, rewriter, op, exp, ldx, /*atStart=*/false); // Finalize access pattern expansion for sparse tensor output. - genExpansion(merger, codegen, rewriter, op, at, /*atStart=*/false); + genExpansion(codegen, rewriter, op, at, /*atStart=*/false); } /// Recursively generates code while computing iteration lattices in order @@ -1603,7 +1599,7 @@ scf::IfOp ifOp = genIf(merger, codegen, rewriter, op, idx, merger.lat(lj).simple); genStmt(merger, codegen, rewriter, op, topSort, ej, at + 1); - endIf(merger, codegen, rewriter, op, ifOp, loop, redInput, cntInput); + endIf(merger, codegen, rewriter, op, ifOp, redInput, cntInput); } else { genStmt(merger, codegen, rewriter, op, topSort, ej, at + 1); } @@ -1620,8 +1616,8 @@ } /// Converts the result computed by the sparse kernel into the required form. -static void genResult(Merger &merger, CodeGen &codegen, - PatternRewriter &rewriter, linalg::GenericOp op) { +static void genResult(CodeGen &codegen, PatternRewriter &rewriter, + linalg::GenericOp op) { OpOperand *lhs = op.getOutputOperand(0); Type resType = lhs->get().getType(); Value result; @@ -1692,7 +1688,7 @@ CodeGen codegen(options, numTensors, numLoops, sparseOut, outerParNest); genBuffers(merger, codegen, rewriter, op); genStmt(merger, codegen, rewriter, op, topSort, exp, 0); - genResult(merger, codegen, rewriter, op); + genResult(codegen, rewriter, op); return success(); } 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, 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, 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 @@ -26,9 +26,8 @@ /// Detects the `values` produced by a ConstantIndexOp and places the new /// constant in place of the corresponding sentinel value. -void mlir::canonicalizeSubViewPart( - SmallVectorImpl &values, - llvm::function_ref isDynamic) { +void mlir::canonicalizeSubViewPart(SmallVectorImpl &values, + llvm::function_ref) { for (OpFoldResult &ofr : values) { if (ofr.is()) continue; diff --git a/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp b/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp --- a/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp +++ b/mlir/lib/Dialect/Tensor/IR/TensorDialect.cpp @@ -21,11 +21,11 @@ namespace { struct TensorInlinerInterface : public DialectInlinerInterface { using DialectInlinerInterface::DialectInlinerInterface; - bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned, - BlockAndValueMapping &valueMapping) const final { + bool isLegalToInline(Region *, Region *, bool, + BlockAndValueMapping &) const final { return true; } - bool isLegalToInline(Operation *, Region *, bool wouldBeCloned, + bool isLegalToInline(Operation *, Region *, bool, BlockAndValueMapping &) const final { return true; } diff --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp --- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp +++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp @@ -363,8 +363,8 @@ // FromElementsOp //===----------------------------------------------------------------------===// -void FromElementsOp::build(OpBuilder &builder, OperationState &result, - Type resultType, ValueRange elements) { +void FromElementsOp::build(OpBuilder &, OperationState &result, Type resultType, + ValueRange elements) { result.addOperands(elements); result.addTypes(resultType); } @@ -621,7 +621,7 @@ // RankOp //===----------------------------------------------------------------------===// -OpFoldResult RankOp::fold(ArrayRef operands) { +OpFoldResult RankOp::fold(ArrayRef) { // Constant fold rank when the rank of the operand is known. auto type = getOperand().getType(); auto shapedType = type.dyn_cast(); @@ -828,8 +828,8 @@ /// and the static representation of offsets, sizes and strides. Special /// sentinels encode the dynamic case. RankedTensorType ExtractSliceOp::inferResultType( - RankedTensorType sourceRankedTensorType, ArrayRef staticOffsets, - ArrayRef staticSizes, ArrayRef staticStrides) { + RankedTensorType sourceRankedTensorType, ArrayRef, + ArrayRef staticSizes, ArrayRef) { // An extract_slice op may specify only a leading subset of offset/sizes/ // strides in which case we complete with offset=0, sizes from memref type and // strides=1. @@ -943,7 +943,7 @@ void ExtractSliceOp::build(OpBuilder &b, OperationState &result, RankedTensorType resultType, Value source, ValueRange offsets, ValueRange sizes, - ValueRange strides, ArrayRef attrs) { + ValueRange strides, ArrayRef) { SmallVector offsetValues = llvm::to_vector<4>( llvm::map_range(offsets, [](Value v) -> OpFoldResult { return v; })); SmallVector sizeValues = llvm::to_vector<4>( @@ -1227,7 +1227,7 @@ // Build a InsertSliceOp with dynamic entries. void InsertSliceOp::build(OpBuilder &b, OperationState &result, Value source, Value dest, ValueRange offsets, ValueRange sizes, - ValueRange strides, ArrayRef attrs) { + ValueRange strides, ArrayRef) { SmallVector offsetValues = llvm::to_vector<4>( llvm::map_range(offsets, [](Value v) -> OpFoldResult { return v; })); SmallVector sizeValues = llvm::to_vector<4>( 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,14 @@ //===--------------------------------------------------------------------===// /// All operations can be inlined by default. - bool isLegalToInline(Operation *op, Region *region, bool wouldBeCloned, - BlockAndValueMapping &map) const final { + bool isLegalToInline(Operation *, Region *, bool, + BlockAndValueMapping &) 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 *, bool, + BlockAndValueMapping &) const final { return (isa(dest->getParentOp()) || isa(dest->getParentOp())); } @@ -462,7 +462,7 @@ // Operator Folders. //===----------------------------------------------------------------------===// -OpFoldResult CastOp::fold(ArrayRef operands) { +OpFoldResult CastOp::fold(ArrayRef) { if (input().getType() == getType()) return input(); return {}; @@ -488,7 +488,7 @@ ReduceFolder(ReduceSumOp) #undef ReduceFolder - OpFoldResult ReshapeOp::fold(ArrayRef operands) { + OpFoldResult ReshapeOp::fold(ArrayRef) { auto inputTy = input1().getType().dyn_cast(); auto outputTy = getType().dyn_cast(); @@ -509,7 +509,7 @@ return {}; } -OpFoldResult SliceOp::fold(ArrayRef operands) { +OpFoldResult SliceOp::fold(ArrayRef) { auto inputTy = input().getType().dyn_cast(); auto outputTy = getType().dyn_cast(); @@ -521,7 +521,7 @@ return {}; } -OpFoldResult TileOp::fold(ArrayRef operands) { +OpFoldResult TileOp::fold(ArrayRef) { bool allOnes = true; for (Attribute val : multiples().getValue()) { allOnes = allOnes && val.cast().getValue().getSExtValue() == 1; @@ -796,8 +796,8 @@ } LogicalResult tosa::ArgMaxOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor inputShape = operands.getShape(0); IntegerAttr axis = attributes.get("axis").cast(); @@ -821,8 +821,8 @@ } LogicalResult tosa::ConcatOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { // Infer all dimension sizes by reducing based on inputs. int32_t axis = @@ -878,8 +878,8 @@ } LogicalResult tosa::FullyConnectedOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor inputShape = operands.getShape(0); ShapeAdaptor weightShape = operands.getShape(1); @@ -908,8 +908,8 @@ } LogicalResult tosa::MatMulOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor lhsShape = operands.getShape(0); ShapeAdaptor rhsShape = operands.getShape(1); @@ -935,8 +935,8 @@ } LogicalResult tosa::PadOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor inputShape = operands.getShape(0); ShapeAdaptor paddingShape = operands.getShape(1); @@ -991,8 +991,8 @@ } LogicalResult tosa::SliceOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { ArrayAttr sizes = SliceOpAdaptor(operands, attributes).size(); SmallVector outputShape; @@ -1006,8 +1006,8 @@ } LogicalResult tosa::TableOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor inputShape = operands.getShape(0); @@ -1022,8 +1022,8 @@ } LogicalResult tosa::TileOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { TileOpAdaptor adaptor(operands, attributes); ArrayAttr multiples = adaptor.multiples(); @@ -1056,8 +1056,8 @@ } LogicalResult tosa::ReshapeOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { ReshapeOpAdaptor adaptor(operands, attributes); ShapeAdaptor inputShape = operands.getShape(0); @@ -1095,8 +1095,8 @@ } LogicalResult tosa::TransposeOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnShapes) { ShapeAdaptor inputShape = operands.getShape(0); ShapeAdaptor permsShape = operands.getShape(1); @@ -1162,8 +1162,8 @@ } LogicalResult tosa::GatherOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector outputShape; outputShape.resize(3, ShapedType::kDynamicSize); @@ -1187,8 +1187,8 @@ } LogicalResult tosa::ResizeOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { ResizeOpAdaptor adaptor(operands, attributes); llvm::SmallVector outputShape; @@ -1258,8 +1258,8 @@ } LogicalResult tosa::ScatterOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr, RegionRange, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector outputShape; outputShape.resize(3, ShapedType::kDynamicSize); @@ -1465,8 +1465,8 @@ } LogicalResult Conv2DOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector outputShape(4, ShapedType::kDynamicSize); Conv2DOp::Adaptor adaptor(operands.getValues(), attributes); @@ -1530,8 +1530,8 @@ } LogicalResult Conv3DOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector outputShape(5, ShapedType::kDynamicSize); Conv2DOp::Adaptor adaptor(operands.getValues(), attributes); @@ -1606,22 +1606,22 @@ } LogicalResult AvgPool2dOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { return poolingInferReturnTypes(operands, attributes, inferredReturnShapes); } LogicalResult MaxPool2dOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { return poolingInferReturnTypes(operands, attributes, inferredReturnShapes); } LogicalResult DepthwiseConv2DOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector outputShape(4, ShapedType::kDynamicSize); DepthwiseConv2DOp::Adaptor adaptor(operands.getValues(), attributes); @@ -1698,8 +1698,8 @@ } LogicalResult TransposeConv2DOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange operands, + DictionaryAttr attributes, RegionRange, SmallVectorImpl &inferredReturnShapes) { TransposeConv2DOp::Adaptor adaptor(operands.getValues(), attributes); llvm::SmallVector outputShape; @@ -1766,8 +1766,8 @@ } LogicalResult IfOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange, DictionaryAttr, + RegionRange regions, SmallVectorImpl &inferredReturnShapes) { llvm::SmallVector yieldOps; for (Region *region : regions) { @@ -1810,8 +1810,8 @@ } LogicalResult WhileOp::inferReturnTypeComponents( - MLIRContext *context, ::llvm::Optional location, - ValueShapeRange operands, DictionaryAttr attributes, RegionRange regions, + MLIRContext *, ::llvm::Optional, ValueShapeRange, DictionaryAttr, + 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 @@ -149,8 +149,7 @@ Optional> mlir::composeReassociationIndices( ArrayRef producerReassociations, - ArrayRef consumerReassociations, - MLIRContext *context) { + ArrayRef consumerReassociations, MLIRContext *) { 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 +221,7 @@ } SmallVector mlir::convertReassociationMapsToIndices( - OpBuilder &b, ArrayRef reassociationExprs) { + OpBuilder &, ArrayRef reassociationExprs) { SmallVector reassociationIndices; for (const auto &exprs : reassociationExprs) { ReassociationIndices indices; diff --git a/mlir/lib/Dialect/Vector/VectorOps.cpp b/mlir/lib/Dialect/Vector/VectorOps.cpp --- a/mlir/lib/Dialect/Vector/VectorOps.cpp +++ b/mlir/lib/Dialect/Vector/VectorOps.cpp @@ -180,7 +180,7 @@ printer << ">"; } -Attribute CombiningKindAttr::parse(AsmParser &parser, Type type) { +Attribute CombiningKindAttr::parse(AsmParser &parser, Type) { if (failed(parser.parseLess())) return {}; @@ -201,8 +201,7 @@ return CombiningKindAttr::get(kind.getValue(), parser.getContext()); } -Attribute VectorDialect::parseAttribute(DialectAsmParser &parser, - Type type) const { +Attribute VectorDialect::parseAttribute(DialectAsmParser &parser, Type) const { StringRef attrKind; if (parser.parseKeyword(&attrKind)) return {}; @@ -291,7 +290,7 @@ return success(); } -OpFoldResult MultiDimReductionOp::fold(ArrayRef operands) { +OpFoldResult MultiDimReductionOp::fold(ArrayRef) { // Single parallel dim, this is a noop. if (getSourceVectorType().getRank() == 1 && !isReducedDim(0)) return source(); @@ -836,13 +835,13 @@ // ExtractElementOp //===----------------------------------------------------------------------===// -void vector::ExtractElementOp::build(OpBuilder &builder, OperationState &result, +void vector::ExtractElementOp::build(OpBuilder &, OperationState &result, Value source) { result.addOperands({source}); result.addTypes(source.getType().cast().getElementType()); } -void vector::ExtractElementOp::build(OpBuilder &builder, OperationState &result, +void vector::ExtractElementOp::build(OpBuilder &, OperationState &result, Value source, Value position) { result.addOperands({source, position}); result.addTypes(source.getType().cast().getElementType()); @@ -1331,7 +1330,7 @@ return success(); } -OpFoldResult ExtractMapOp::fold(ArrayRef operands) { +OpFoldResult ExtractMapOp::fold(ArrayRef) { auto insert = vector().getDefiningOp(); if (insert == nullptr || getType() != insert.vector().getType() || ids() != insert.ids()) @@ -1557,14 +1556,14 @@ // InsertElementOp //===----------------------------------------------------------------------===// -void InsertElementOp::build(OpBuilder &builder, OperationState &result, - Value source, Value dest) { +void InsertElementOp::build(OpBuilder &, OperationState &result, Value source, + Value dest) { result.addOperands({source, dest}); result.addTypes(dest.getType()); } -void InsertElementOp::build(OpBuilder &builder, OperationState &result, - Value source, Value dest, Value position) { +void InsertElementOp::build(OpBuilder &, OperationState &result, Value source, + Value dest, Value position) { result.addOperands({source, dest, position}); result.addTypes(dest.getType()); } @@ -1663,7 +1662,7 @@ // Eliminates insert operations that produce values identical to their source // value. This happens when the source and destination vectors have identical // sizes. -OpFoldResult vector::InsertOp::fold(ArrayRef operands) { +OpFoldResult vector::InsertOp::fold(ArrayRef) { if (position().empty()) return source(); return {}; @@ -1843,7 +1842,7 @@ return success(); } -OpFoldResult InsertStridedSliceOp::fold(ArrayRef operands) { +OpFoldResult InsertStridedSliceOp::fold(ArrayRef) { if (getSourceVectorType() == getDestVectorType()) return source(); return {}; @@ -1854,8 +1853,8 @@ //===----------------------------------------------------------------------===// /// Build an op without mask, use the type of `acc` as the return type. -void OuterProductOp::build(OpBuilder &builder, OperationState &result, - Value lhs, Value rhs, Value acc) { +void OuterProductOp::build(OpBuilder &, OperationState &result, Value lhs, + Value rhs, Value acc) { result.addOperands({lhs, rhs, acc}); result.addTypes(acc.getType()); } @@ -2153,7 +2152,7 @@ return failure(); } -OpFoldResult ExtractStridedSliceOp::fold(ArrayRef operands) { +OpFoldResult ExtractStridedSliceOp::fold(ArrayRef) { if (getVectorType() == getResult().getType()) return vector(); if (succeeded(foldExtractStridedOpFromInsertChain(*this))) @@ -3133,7 +3132,7 @@ public: using OpRewritePattern::OpRewritePattern; LogicalResult matchAndRewrite(TransferWriteOp writeOp, - PatternRewriter &rewriter) const override { + PatternRewriter &) const override { if (!writeOp.getShapedType().isa()) return failure(); vector::TransferWriteOp writeToModify = writeOp; @@ -3316,8 +3315,8 @@ return success(); } -LogicalResult StoreOp::fold(ArrayRef operands, - SmallVectorImpl &results) { +LogicalResult StoreOp::fold(ArrayRef, + SmallVectorImpl &) { return foldMemRefCast(*this); } @@ -3420,8 +3419,8 @@ results.add(context); } -LogicalResult MaskedStoreOp::fold(ArrayRef operands, - SmallVectorImpl &results) { +LogicalResult MaskedStoreOp::fold(ArrayRef, + SmallVectorImpl &) { return foldMemRefCast(*this); } @@ -3688,7 +3687,7 @@ return success(); } -OpFoldResult ShapeCastOp::fold(ArrayRef operands) { +OpFoldResult ShapeCastOp::fold(ArrayRef) { // Nop shape cast. if (source().getType() == result().getType()) return source(); @@ -3832,8 +3831,7 @@ /// Build the canonical memRefType with a single vector. /// E.g. memref<4 x 5 x vector<6 x f32>> -> memref>. -void TypeCastOp::build(OpBuilder &builder, OperationState &result, - Value source) { +void TypeCastOp::build(OpBuilder &, OperationState &result, Value source) { result.addOperands(source); MemRefType memRefType = source.getType().cast(); VectorType vectorType = @@ -3887,7 +3885,7 @@ // Eliminates transpose operations, which produce values identical to their // input values. This happens when the dimensions of the input vector remain in // their original order after the transpose operation. -OpFoldResult vector::TransposeOp::fold(ArrayRef operands) { +OpFoldResult vector::TransposeOp::fold(ArrayRef) { SmallVector transp; getTransp(transp); diff --git a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp --- a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp @@ -250,7 +250,7 @@ // Callback to create the object layer with symbol resolution to current // process and dynamically linked libraries. auto objectLinkingLayerCreator = [&](ExecutionSession &session, - const Triple &tt) { + const Triple &) { auto objectLayer = std::make_unique( session, []() { return std::make_unique(); }); diff --git a/mlir/lib/IR/AffineExpr.cpp b/mlir/lib/IR/AffineExpr.cpp --- a/mlir/lib/IR/AffineExpr.cpp +++ b/mlir/lib/IR/AffineExpr.cpp @@ -1138,7 +1138,7 @@ } } -void SimpleAffineExprFlattener::visitAddExpr(AffineBinaryOpExpr expr) { +void SimpleAffineExprFlattener::visitAddExpr(AffineBinaryOpExpr) { assert(operandExprStack.size() >= 2); const auto &rhs = operandExprStack.back(); auto &lhs = operandExprStack[operandExprStack.size() - 2]; @@ -1363,7 +1363,7 @@ // function of other identifiers, coefficients of which are specified in // dividend and with respect to a positive constant divisor. localExpr is the // simplified tree expression (AffineExpr) corresponding to the quantifier. -void SimpleAffineExprFlattener::addLocalFloorDivId(ArrayRef dividend, +void SimpleAffineExprFlattener::addLocalFloorDivId(ArrayRef, int64_t divisor, AffineExpr localExpr) { assert(divisor > 0 && "positive constant divisor expected"); diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -395,7 +395,7 @@ private: /// Print the given operation in the generic form. - void printGenericOp(Operation *op, bool printOpName = true) override { + void printGenericOp(Operation *op, bool = true) override { // Consider nested operations for aliases. if (op->getNumRegions() != 0) { for (Region ®ion : op->getRegions()) @@ -446,8 +446,7 @@ /// Print the given region. void printRegion(Region ®ion, bool printEntryBlockArgs, - bool printBlockTerminators, - bool printEmptyBlock = false) override { + bool printBlockTerminators, bool = false) override { if (region.empty()) return; @@ -457,8 +456,8 @@ print(&b); } - void printRegionArgument(BlockArgument arg, ArrayRef argAttrs, - bool omitType) override { + void printRegionArgument(BlockArgument arg, ArrayRef, + bool) override { printType(arg.getType()); // Visit the argument location. if (printerFlags.shouldPrintDebugInfo()) @@ -1343,7 +1342,7 @@ .Case([&](OpaqueLoc loc) { printLocationInternal(loc.getFallbackLocation(), pretty); }) - .Case([&](UnknownLoc loc) { + .Case([&](UnknownLoc) { if (pretty) os << "[unknown]"; else @@ -2919,7 +2918,7 @@ void Block::dump() { print(llvm::errs()); } /// Print out the name of the block without printing its body. -void Block::printAsOperand(raw_ostream &os, bool printType) { +void Block::printAsOperand(raw_ostream &os, bool) { Operation *parentOp = getParentOp(); if (!parentOp) { os << "<>\n"; diff --git a/mlir/lib/IR/BuiltinAttributes.cpp b/mlir/lib/IR/BuiltinAttributes.cpp --- a/mlir/lib/IR/BuiltinAttributes.cpp +++ b/mlir/lib/IR/BuiltinAttributes.cpp @@ -47,8 +47,7 @@ //===----------------------------------------------------------------------===// void ArrayAttr::walkImmediateSubElements( - function_ref walkAttrsFn, - function_ref walkTypesFn) const { + function_ref walkAttrsFn, function_ref) const { for (Attribute attr : getValue()) walkAttrsFn(attr); } @@ -220,8 +219,7 @@ } void DictionaryAttr::walkImmediateSubElements( - function_ref walkAttrsFn, - function_ref walkTypesFn) const { + function_ref walkAttrsFn, function_ref) const { for (const NamedAttribute &attr : getValue()) walkAttrsFn(attr.getValue()); } @@ -1245,8 +1243,7 @@ LogicalResult OpaqueElementsAttr::verify(function_ref emitError, - StringAttr dialect, StringRef value, - ShapedType type) { + StringAttr dialect, StringRef, ShapedType) { if (!Dialect::isValidNamespace(dialect.strref())) return emitError() << "invalid dialect namespace '" << dialect << "'"; return success(); @@ -1372,7 +1369,6 @@ //===----------------------------------------------------------------------===// void TypeAttr::walkImmediateSubElements( - function_ref walkAttrsFn, - function_ref walkTypesFn) const { + function_ref, function_ref walkTypesFn) const { walkTypesFn(getValue()); } diff --git a/mlir/lib/IR/BuiltinDialect.cpp b/mlir/lib/IR/BuiltinDialect.cpp --- a/mlir/lib/IR/BuiltinDialect.cpp +++ b/mlir/lib/IR/BuiltinDialect.cpp @@ -286,7 +286,7 @@ //===----------------------------------------------------------------------===// LogicalResult -UnrealizedConversionCastOp::fold(ArrayRef attrOperands, +UnrealizedConversionCastOp::fold(ArrayRef, SmallVectorImpl &foldResults) { OperandRange operands = inputs(); ResultRange results = outputs(); @@ -313,8 +313,7 @@ return success(); } -bool UnrealizedConversionCastOp::areCastCompatible(TypeRange inputs, - TypeRange outputs) { +bool UnrealizedConversionCastOp::areCastCompatible(TypeRange, TypeRange) { // `UnrealizedConversionCastOp` is agnostic of the input/output types. return true; } diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp --- a/mlir/lib/IR/BuiltinTypes.cpp +++ b/mlir/lib/IR/BuiltinTypes.cpp @@ -70,8 +70,7 @@ /// Verify the construction of an integer type. LogicalResult IntegerType::verify(function_ref emitError, - unsigned width, - SignednessSemantics signedness) { + unsigned width, SignednessSemantics) { if (width > IntegerType::kMaxWidth) { return emitError() << "integer bitwidth is limited to " << IntegerType::kMaxWidth << " bits"; @@ -240,8 +239,7 @@ } void FunctionType::walkImmediateSubElements( - function_ref walkAttrsFn, - function_ref walkTypesFn) const { + function_ref, function_ref walkTypesFn) const { for (Type type : llvm::concat(getInputs(), getResults())) walkTypesFn(type); } @@ -442,7 +440,7 @@ LogicalResult VectorType::verify(function_ref emitError, ArrayRef shape, Type elementType, - unsigned numScalableDims) { + unsigned) { if (!isValidElementType(elementType)) return emitError() << "vector elements must be int/index/float type but got " @@ -469,8 +467,7 @@ } void VectorType::walkImmediateSubElements( - function_ref walkAttrsFn, - function_ref walkTypesFn) const { + function_ref, function_ref walkTypesFn) const { walkTypesFn(getElementType()); } @@ -533,8 +530,7 @@ } void UnrankedTensorType::walkImmediateSubElements( - function_ref walkAttrsFn, - function_ref walkTypesFn) const { + function_ref, function_ref walkTypesFn) const { walkTypesFn(getElementType()); } @@ -1008,8 +1004,7 @@ size_t TupleType::size() const { return getImpl()->size(); } void TupleType::walkImmediateSubElements( - function_ref walkAttrsFn, - function_ref walkTypesFn) const { + function_ref, function_ref walkTypesFn) const { for (Type type : getTypes()) walkTypesFn(type); } diff --git a/mlir/lib/IR/Dialect.cpp b/mlir/lib/IR/Dialect.cpp --- a/mlir/lib/IR/Dialect.cpp +++ b/mlir/lib/IR/Dialect.cpp @@ -145,7 +145,7 @@ } /// Parse an attribute registered to this dialect. -Attribute Dialect::parseAttribute(DialectAsmParser &parser, Type type) const { +Attribute Dialect::parseAttribute(DialectAsmParser &parser, Type) const { parser.emitError(parser.getNameLoc()) << "dialect '" << getNamespace() << "' provides no attribute parsing hook"; @@ -165,8 +165,7 @@ return Type(); } -Optional -Dialect::getParseOperationHook(StringRef opName) const { +Optional Dialect::getParseOperationHook(StringRef) const { return None; } diff --git a/mlir/lib/IR/FunctionImplementation.cpp b/mlir/lib/IR/FunctionImplementation.cpp --- a/mlir/lib/IR/FunctionImplementation.cpp +++ b/mlir/lib/IR/FunctionImplementation.cpp @@ -337,7 +337,7 @@ /// if all attributes are elided. Assumes `op` has the `FunctionLike` trait and /// passed the verification. void mlir::function_like_impl::printFunctionAttributes( - OpAsmPrinter &p, Operation *op, unsigned numInputs, unsigned numResults, + OpAsmPrinter &p, Operation *op, unsigned, unsigned, ArrayRef elided) { // Print out function attributes, if present. SmallVector ignoredAttrs = { diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp --- a/mlir/lib/IR/Operation.cpp +++ b/mlir/lib/IR/Operation.cpp @@ -707,7 +707,7 @@ return type; } -LogicalResult OpTrait::impl::verifyIsIdempotent(Operation *op) { +LogicalResult OpTrait::impl::verifyIsIdempotent(Operation *) { // FIXME: Add back check for no side effects on operation. // Currently adding it would cause the shared library build // to fail since there would be a dependency of IR on SideEffectInterfaces @@ -715,7 +715,7 @@ return success(); } -LogicalResult OpTrait::impl::verifyIsInvolution(Operation *op) { +LogicalResult OpTrait::impl::verifyIsInvolution(Operation *) { // FIXME: Add back check for no side effects on operation. // Currently adding it would cause the shared library build // to fail since there would be a dependency of IR on SideEffectInterfaces @@ -1131,7 +1131,7 @@ // These functions are out-of-line implementations of the methods in BinaryOp, // which avoids them being template instantiated/duplicated. -void impl::buildBinaryOp(OpBuilder &builder, OperationState &result, Value lhs, +void impl::buildBinaryOp(OpBuilder &, OperationState &result, Value lhs, Value rhs) { assert(lhs.getType() == rhs.getType()); result.addOperands({lhs, rhs}); @@ -1192,7 +1192,7 @@ /// Attempt to fold the given cast operation. LogicalResult -impl::foldCastInterfaceOp(Operation *op, ArrayRef attrOperands, +impl::foldCastInterfaceOp(Operation *op, ArrayRef, SmallVectorImpl &foldResults) { OperandRange operands = op->getOperands(); if (operands.empty()) @@ -1232,7 +1232,7 @@ return success(); } -void impl::buildCastOp(OpBuilder &builder, OperationState &result, Value source, +void impl::buildCastOp(OpBuilder &, OperationState &result, Value source, Type destType) { result.addOperands(source); result.addTypes(destType); diff --git a/mlir/lib/IR/OperationSupport.cpp b/mlir/lib/IR/OperationSupport.cpp --- a/mlir/lib/IR/OperationSupport.cpp +++ b/mlir/lib/IR/OperationSupport.cpp @@ -617,7 +617,7 @@ llvm::hash_code OperationEquivalence::computeHash( Operation *op, function_ref hashOperands, - function_ref hashResults, Flags flags) { + function_ref hashResults, Flags) { // Hash operations based upon their: // - Operation Name // - Attributes diff --git a/mlir/lib/IR/PatternMatch.cpp b/mlir/lib/IR/PatternMatch.cpp --- a/mlir/lib/IR/PatternMatch.cpp +++ b/mlir/lib/IR/PatternMatch.cpp @@ -40,14 +40,14 @@ //===----------------------------------------------------------------------===// // MatchAnyOpTypeTag Root Constructors -Pattern::Pattern(MatchAnyOpTypeTag tag, PatternBenefit benefit, +Pattern::Pattern(MatchAnyOpTypeTag, PatternBenefit benefit, MLIRContext *context, ArrayRef generatedNames) : Pattern(nullptr, RootKind::Any, generatedNames, benefit, context) {} //===----------------------------------------------------------------------===// // MatchInterfaceOpTypeTag Root Constructors -Pattern::Pattern(MatchInterfaceOpTypeTag tag, TypeID interfaceID, +Pattern::Pattern(MatchInterfaceOpTypeTag, TypeID interfaceID, PatternBenefit benefit, MLIRContext *context, ArrayRef generatedNames) : Pattern(interfaceID.getAsOpaquePointer(), RootKind::InterfaceID, @@ -56,9 +56,8 @@ //===----------------------------------------------------------------------===// // MatchTraitOpTypeTag Root Constructors -Pattern::Pattern(MatchTraitOpTypeTag tag, TypeID traitID, - PatternBenefit benefit, MLIRContext *context, - ArrayRef generatedNames) +Pattern::Pattern(MatchTraitOpTypeTag, TypeID traitID, PatternBenefit benefit, + MLIRContext *context, ArrayRef generatedNames) : Pattern(traitID.getAsOpaquePointer(), RootKind::TraitID, generatedNames, benefit, context) {} @@ -83,12 +82,12 @@ // RewritePattern //===----------------------------------------------------------------------===// -void RewritePattern::rewrite(Operation *op, PatternRewriter &rewriter) const { +void RewritePattern::rewrite(Operation *, PatternRewriter &) const { llvm_unreachable("need to implement either matchAndRewrite or one of the " "rewrite functions!"); } -LogicalResult RewritePattern::match(Operation *op) const { +LogicalResult RewritePattern::match(Operation *) const { llvm_unreachable("need to implement either match or matchAndRewrite!"); } diff --git a/mlir/lib/IR/SymbolTable.cpp b/mlir/lib/IR/SymbolTable.cpp --- a/mlir/lib/IR/SymbolTable.cpp +++ b/mlir/lib/IR/SymbolTable.cpp @@ -1041,7 +1041,7 @@ : symbolTable(symbolTable) { // Walk each of the symbol tables looking for discardable callgraph nodes. SmallVector symbols; - auto walkFn = [&](Operation *symbolTableOp, bool allUsesVisible) { + auto walkFn = [&](Operation *symbolTableOp, bool) { for (Operation &nestedOp : symbolTableOp->getRegion(0).getOps()) { auto symbolUses = SymbolTable::getSymbolUses(&nestedOp); assert(symbolUses && "expected uses to be valid"); diff --git a/mlir/lib/Interfaces/ControlFlowInterfaces.cpp b/mlir/lib/Interfaces/ControlFlowInterfaces.cpp --- a/mlir/lib/Interfaces/ControlFlowInterfaces.cpp +++ b/mlir/lib/Interfaces/ControlFlowInterfaces.cpp @@ -201,8 +201,7 @@ << " operands mismatch between return-like terminators"; } - auto inputTypesFromRegion = - [&](Optional regionNo) -> Optional { + auto inputTypesFromRegion = [&](Optional) -> Optional { // If there is no return-like terminator, the op itself should verify // type consistency. if (!regionReturnOperands) diff --git a/mlir/lib/Interfaces/ViewLikeInterface.cpp b/mlir/lib/Interfaces/ViewLikeInterface.cpp --- a/mlir/lib/Interfaces/ViewLikeInterface.cpp +++ b/mlir/lib/Interfaces/ViewLikeInterface.cpp @@ -90,14 +90,14 @@ } void mlir::printOperandsOrIntegersOffsetsOrStridesList(OpAsmPrinter &p, - Operation *op, + Operation *, OperandRange values, ArrayAttr integers) { return printOperandsOrIntegersListImpl( p, values, integers); } -void mlir::printOperandsOrIntegersSizesList(OpAsmPrinter &p, Operation *op, +void mlir::printOperandsOrIntegersSizesList(OpAsmPrinter &p, Operation *, OperandRange values, ArrayAttr integers) { return printOperandsOrIntegersListImpl(p, values, diff --git a/mlir/lib/Parser/AttributeParser.cpp b/mlir/lib/Parser/AttributeParser.cpp --- a/mlir/lib/Parser/AttributeParser.cpp +++ b/mlir/lib/Parser/AttributeParser.cpp @@ -445,15 +445,14 @@ private: /// Get the parsed elements for an integer attribute. - ParseResult getIntAttrElements(llvm::SMLoc loc, Type eltTy, - std::vector &intValues); + ParseResult getIntAttrElements(Type eltTy, std::vector &intValues); /// Get the parsed elements for a float attribute. - ParseResult getFloatAttrElements(llvm::SMLoc loc, FloatType eltTy, + ParseResult getFloatAttrElements(FloatType eltTy, std::vector &floatValues); /// Build a Dense String attribute for the given type. - DenseElementsAttr getStringAttr(llvm::SMLoc loc, ShapedType type, Type eltTy); + DenseElementsAttr getStringAttr(ShapedType type); /// Build a Dense attribute with hex data for the given type. DenseElementsAttr getHexAttr(llvm::SMLoc loc, ShapedType type); @@ -539,7 +538,7 @@ // Handle integer and index types. if (eltType.isIntOrIndex()) { std::vector intValues; - if (failed(getIntAttrElements(loc, eltType, intValues))) + if (failed(getIntAttrElements(eltType, intValues))) return nullptr; if (isComplex) { // If this is a complex, treat the parsed values as complex values. @@ -553,7 +552,7 @@ // Handle floating point types. if (FloatType floatTy = eltType.dyn_cast()) { std::vector floatValues; - if (failed(getFloatAttrElements(loc, floatTy, floatValues))) + if (failed(getFloatAttrElements(floatTy, floatValues))) return nullptr; if (isComplex) { // If this is a complex, treat the parsed values as complex values. @@ -566,12 +565,12 @@ } // Other types are assumed to be string representations. - return getStringAttr(loc, type, type.getElementType()); + return getStringAttr(type); } /// Build a Dense Integer attribute for the given type. ParseResult -TensorLiteralParser::getIntAttrElements(llvm::SMLoc loc, Type eltTy, +TensorLiteralParser::getIntAttrElements(Type eltTy, std::vector &intValues) { intValues.reserve(storage.size()); bool isUintType = eltTy.isUnsignedInteger(); @@ -615,7 +614,7 @@ /// Build a Dense Float attribute for the given type. ParseResult -TensorLiteralParser::getFloatAttrElements(llvm::SMLoc loc, FloatType eltTy, +TensorLiteralParser::getFloatAttrElements(FloatType eltTy, std::vector &floatValues) { floatValues.reserve(storage.size()); for (const auto &signAndToken : storage) { @@ -656,9 +655,7 @@ } /// Build a Dense String attribute for the given type. -DenseElementsAttr TensorLiteralParser::getStringAttr(llvm::SMLoc loc, - ShapedType type, - Type eltTy) { +DenseElementsAttr TensorLiteralParser::getStringAttr(ShapedType type) { if (hexStorage.hasValue()) { auto stringValue = hexStorage.getValue().getStringValue(); return DenseStringElementsAttr::get(type, {stringValue}); diff --git a/mlir/lib/Pass/PassCrashRecovery.cpp b/mlir/lib/Pass/PassCrashRecovery.cpp --- a/mlir/lib/Pass/PassCrashRecovery.cpp +++ b/mlir/lib/Pass/PassCrashRecovery.cpp @@ -354,7 +354,7 @@ generator.removeLastReproducerFor(pass, op); } - void runAfterPassFailed(Pass *pass, Operation *op) override { + void runAfterPassFailed(Pass *, Operation *op) override { generator.finalize(op, /*executionResult=*/failure()); } diff --git a/mlir/lib/Pass/PassRegistry.cpp b/mlir/lib/Pass/PassRegistry.cpp --- a/mlir/lib/Pass/PassRegistry.cpp +++ b/mlir/lib/Pass/PassRegistry.cpp @@ -51,7 +51,7 @@ /// Utility to print the help string for a specific option. static void printOptionHelp(StringRef arg, StringRef desc, size_t indent, - size_t descIndent, bool isTopLevel) { + size_t descIndent) { size_t numSpaces = descIndent - indent - 4; llvm::outs().indent(indent) << "--" << llvm::left_justify(arg, numSpaces) << "- " << desc << '\n'; @@ -65,8 +65,7 @@ /// description, and any pass options. `descIndent` is the indent that the /// descriptions should be aligned. void PassRegistryEntry::printHelpStr(size_t indent, size_t descIndent) const { - printOptionHelp(getPassArgument(), getPassDescription(), indent, descIndent, - /*isTopLevel=*/true); + printOptionHelp(getPassArgument(), getPassDescription(), indent, descIndent); // If this entry has options, print the help for those as well. optHandler([=](const PassOptions &options) { options.printHelp(indent, descIndent); @@ -615,7 +614,7 @@ // Print the top-level pipeline argument. printOptionHelp(passPipelineArg, "A textual description of a pass pipeline to run", - /*indent=*/4, globalWidth, /*isTopLevel=*/!opt.hasArgStr()); + /*indent=*/4, globalWidth); // Functor used to print the ordered entries of a registration map. auto printOrderedEntries = [&](StringRef header, auto &map) { diff --git a/mlir/lib/Support/DebugCounter.cpp b/mlir/lib/Support/DebugCounter.cpp --- a/mlir/lib/Support/DebugCounter.cpp +++ b/mlir/lib/Support/DebugCounter.cpp @@ -62,8 +62,7 @@ } // Register a counter with the specified name. -FailureOr DebugCounter::shouldExecute(StringRef tag, - StringRef description) { +FailureOr DebugCounter::shouldExecute(StringRef tag, StringRef) { auto counterIt = counters.find(tag); if (counterIt == counters.end()) return true; diff --git a/mlir/lib/Support/MlirOptMain.cpp b/mlir/lib/Support/MlirOptMain.cpp --- a/mlir/lib/Support/MlirOptMain.cpp +++ b/mlir/lib/Support/MlirOptMain.cpp @@ -45,9 +45,8 @@ /// This typically parses the main source file, runs zero or more optimization /// passes, then prints the output. /// -static LogicalResult performActions(raw_ostream &os, bool verifyDiagnostics, - bool verifyPasses, SourceMgr &sourceMgr, - MLIRContext *context, +static LogicalResult performActions(raw_ostream &os, bool verifyPasses, + SourceMgr &sourceMgr, MLIRContext *context, PassPipelineFn passManagerSetupFn) { DefaultTimingManager tm; applyDefaultTimingManagerCLOptions(tm); @@ -116,8 +115,8 @@ // otherwise just perform the actions without worrying about it. if (!verifyDiagnostics) { SourceMgrDiagnosticHandler sourceMgrHandler(sourceMgr, &context); - return performActions(os, verifyDiagnostics, verifyPasses, sourceMgr, - &context, passManagerSetupFn); + return performActions(os, verifyPasses, sourceMgr, &context, + passManagerSetupFn); } SourceMgrDiagnosticVerifierHandler sourceMgrHandler(sourceMgr, &context); @@ -125,7 +124,7 @@ // Do any processing requested by command line flags. We don't care whether // these actions succeed or fail, we only care what diagnostics they produce // and whether they match our expectations. - (void)performActions(os, verifyDiagnostics, verifyPasses, sourceMgr, &context, + (void)performActions(os, verifyPasses, sourceMgr, &context, passManagerSetupFn); // Verify the diagnostic handler to make sure that each of the diagnostics diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp --- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp @@ -212,8 +212,8 @@ // TODO: Perform appropriate actions according to the data-sharing // attribute (shared, private, firstprivate, ...) of variables. // Currently defaults to shared. - auto privCB = [&](InsertPointTy allocaIP, InsertPointTy codeGenIP, - llvm::Value &, llvm::Value &vPtr, + auto privCB = [&](InsertPointTy, InsertPointTy codeGenIP, llvm::Value &, + llvm::Value &vPtr, llvm::Value *&replacementValue) -> InsertPointTy { replacementValue = &vPtr; @@ -254,7 +254,7 @@ // relying on captured variables. LogicalResult bodyGenStatus = success(); - auto bodyGenCB = [&](InsertPointTy allocaIP, InsertPointTy codeGenIP, + auto bodyGenCB = [&](InsertPointTy, InsertPointTy codeGenIP, llvm::BasicBlock &continuationBlock) { // MasterOp has only one region associated with it. auto ®ion = cast(opInst).getRegion(); @@ -284,7 +284,7 @@ // relying on captured variables. LogicalResult bodyGenStatus = success(); - auto bodyGenCB = [&](InsertPointTy allocaIP, InsertPointTy codeGenIP, + auto bodyGenCB = [&](InsertPointTy, InsertPointTy codeGenIP, llvm::BasicBlock &continuationBlock) { // CriticalOp has only one region associated with it. auto ®ion = cast(opInst).getRegion(); @@ -526,7 +526,7 @@ // relying on captured variables. LogicalResult bodyGenStatus = success(); - auto bodyGenCB = [&](InsertPointTy allocaIP, InsertPointTy codeGenIP, + auto bodyGenCB = [&](InsertPointTy, InsertPointTy codeGenIP, llvm::BasicBlock &continuationBlock) { // OrderedOp has only one region associated with it. auto ®ion = cast(opInst).getRegion(); @@ -577,9 +577,9 @@ continue; Region ®ion = sectionOp.region(); - auto sectionCB = [®ion, &builder, &moduleTranslation, &bodyGenStatus]( - InsertPointTy allocaIP, InsertPointTy codeGenIP, - llvm::BasicBlock &finiBB) { + auto sectionCB = [®ion, &builder, &moduleTranslation, + &bodyGenStatus](InsertPointTy, InsertPointTy codeGenIP, + llvm::BasicBlock &finiBB) { builder.restoreIP(codeGenIP); builder.CreateBr(&finiBB); convertOmpOpRegions(region, "omp.section.region", *codeGenIP.getBlock(), @@ -1037,7 +1037,7 @@ return convertOmpSections(*op, builder, moduleTranslation); }) .Case([](auto op) { + omp::CriticalDeclareOp>([](auto) { // `yield` and `terminator` can be just omitted. The block structure // was created in the region that handles their parent operation. // `reduction.declare` will be used by reductions and is not diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp --- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -354,8 +354,7 @@ /// Get the SSA value passed to the current block from the terminator operation /// of its predecessor. -static Value getPHISourceValue(Block *current, Block *pred, - unsigned numArguments, unsigned index) { +static Value getPHISourceValue(Block *current, Block *pred, unsigned index) { Operation &terminator = *pred->getTerminator(); if (isa(terminator)) return terminator.getOperand(index); @@ -415,7 +414,7 @@ state.lookupBranch(pred->getTerminator()); assert(terminator && "missing the mapping for a terminator"); phiNode.addIncoming( - state.lookupValue(getPHISourceValue(bb, pred, numArguments, index)), + state.lookupValue(getPHISourceValue(bb, pred, index)), terminator->getParent()); } } diff --git a/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp b/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp --- a/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp +++ b/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp @@ -75,7 +75,7 @@ LLVM::LLVMFixedVectorType, LLVM::LLVMScalableVectorType, VectorType>( [this](auto type) { return this->translate(type); }) - .Default([](Type t) -> llvm::Type * { + .Default([](Type) -> llvm::Type * { llvm_unreachable("unknown LLVM dialect type"); }); diff --git a/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp b/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp --- a/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp +++ b/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp @@ -531,7 +531,7 @@ } spirv::SpecConstantOp -spirv::Deserializer::createSpecConstant(Location loc, uint32_t resultID, +spirv::Deserializer::createSpecConstant(Location, uint32_t resultID, Attribute defaultValue) { auto symName = opBuilder.getStringAttr(getSpecConstantSymbol(resultID)); auto op = opBuilder.create(unknownLoc, symName, @@ -1335,7 +1335,7 @@ } Value spirv::Deserializer::materializeSpecConstantOperation( - uint32_t resultID, spirv::Opcode enclosedOpcode, uint32_t resultTypeID, + uint32_t, spirv::Opcode enclosedOpcode, uint32_t resultTypeID, ArrayRef enclosedOpOperands) { Type resultType = getType(resultTypeID); diff --git a/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp b/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp --- a/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp +++ b/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp @@ -261,7 +261,7 @@ template <> LogicalResult Serializer::processTypeDecoration( - Location loc, spirv::ArrayType type, uint32_t resultID) { + Location, spirv::ArrayType type, uint32_t resultID) { if (unsigned stride = type.getArrayStride()) { // OpDecorate %arrayTypeSSA ArrayStride strideLiteral return emitDecoration(resultID, spirv::Decoration::ArrayStride, {stride}); @@ -271,7 +271,7 @@ template <> LogicalResult Serializer::processTypeDecoration( - Location loc, spirv::RuntimeArrayType type, uint32_t resultID) { + Location, spirv::RuntimeArrayType type, uint32_t resultID) { if (unsigned stride = type.getArrayStride()) { // OpDecorate %arrayTypeSSA ArrayStride strideLiteral return emitDecoration(resultID, spirv::Decoration::ArrayStride, {stride}); diff --git a/mlir/lib/Tools/PDLL/Parser/Parser.cpp b/mlir/lib/Tools/PDLL/Parser/Parser.cpp --- a/mlir/lib/Tools/PDLL/Parser/Parser.cpp +++ b/mlir/lib/Tools/PDLL/Parser/Parser.cpp @@ -136,8 +136,7 @@ /// existing constraints that have already been parsed for the same entity /// that will be constrained by this constraint. FailureOr - parseConstraint(Optional &typeConstraint, - ArrayRef existingConstraints); + parseConstraint(Optional &typeConstraint); //===--------------------------------------------------------------------===// // Exprs @@ -231,9 +230,7 @@ Optional name, MutableArrayRef results); LogicalResult - validateOperationOperandsOrResults(llvm::SMRange loc, - Optional name, - MutableArrayRef values, + validateOperationOperandsOrResults(MutableArrayRef values, ast::Type singleTy, ast::Type rangeTy); FailureOr createTupleExpr(llvm::SMRange loc, ArrayRef elements, @@ -710,8 +707,7 @@ SmallVectorImpl &constraints) { Optional typeConstraint; auto parseSingleConstraint = [&] { - FailureOr constraint = - parseConstraint(typeConstraint, constraints); + FailureOr constraint = parseConstraint(typeConstraint); if (failed(constraint)) return failure(); constraints.push_back(*constraint); @@ -730,8 +726,7 @@ } FailureOr -Parser::parseConstraint(Optional &typeConstraint, - ArrayRef existingConstraints) { +Parser::parseConstraint(Optional &typeConstraint) { auto parseTypeConstraint = [&](ast::Expr *&typeExpr) -> LogicalResult { if (typeConstraint) return emitErrorAndNote( @@ -1568,21 +1563,19 @@ LogicalResult Parser::validateOperationOperands(llvm::SMRange loc, Optional name, MutableArrayRef operands) { - return validateOperationOperandsOrResults(loc, name, operands, valueTy, - valueRangeTy); + return validateOperationOperandsOrResults(operands, valueTy, valueRangeTy); } LogicalResult Parser::validateOperationResults(llvm::SMRange loc, Optional name, MutableArrayRef results) { - return validateOperationOperandsOrResults(loc, name, results, typeTy, - typeRangeTy); + return validateOperationOperandsOrResults(results, typeTy, typeRangeTy); } -LogicalResult Parser::validateOperationOperandsOrResults( - llvm::SMRange loc, Optional name, - MutableArrayRef values, ast::Type singleTy, - ast::Type rangeTy) { +LogicalResult +Parser::validateOperationOperandsOrResults(MutableArrayRef values, + ast::Type singleTy, + ast::Type rangeTy) { // All operation types accept a single range parameter. if (values.size() == 1) { if (failed(convertExpressionTo(values[0], rangeTy))) diff --git a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp --- a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp +++ b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp @@ -282,8 +282,7 @@ // Hover //===--------------------------------------------------------------------===// - Optional findHover(const lsp::URIForFile &uri, - const lsp::Position &hoverPos); + Optional findHover(const lsp::Position &hoverPos); Optional buildHoverForOperation(llvm::SMRange hoverRange, const AsmParserState::OperationDefinition &op); @@ -437,8 +436,7 @@ // MLIRDocument: Hover //===----------------------------------------------------------------------===// -Optional MLIRDocument::findHover(const lsp::URIForFile &uri, - const lsp::Position &hoverPos) { +Optional MLIRDocument::findHover(const lsp::Position &hoverPos) { llvm::SMLoc posLoc = getPosFromLoc(sourceMgr, hoverPos); llvm::SMRange hoverRange; @@ -795,7 +793,7 @@ Optional MLIRTextFile::findHover(const lsp::URIForFile &uri, lsp::Position hoverPos) { MLIRTextFileChunk &chunk = getChunkFor(hoverPos); - Optional hoverInfo = chunk.document.findHover(uri, hoverPos); + Optional hoverInfo = chunk.document.findHover(hoverPos); // Adjust any locations within this file for the offset of this chunk. if (chunk.lineOffset != 0 && hoverInfo && hoverInfo->range) diff --git a/mlir/lib/Tools/mlir-lsp-server/lsp/Logging.cpp b/mlir/lib/Tools/mlir-lsp-server/lsp/Logging.cpp --- a/mlir/lib/Tools/mlir-lsp-server/lsp/Logging.cpp +++ b/mlir/lib/Tools/mlir-lsp-server/lsp/Logging.cpp @@ -21,7 +21,7 @@ return logger; } -void Logger::log(Level logLevel, const char *fmt, +void Logger::log(Level logLevel, const char *, const llvm::formatv_object_base &message) { Logger &logger = get(); diff --git a/mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.cpp b/mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.cpp --- a/mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.cpp +++ b/mlir/lib/Tools/mlir-lsp-server/lsp/Protocol.cpp @@ -273,7 +273,7 @@ //===----------------------------------------------------------------------===// bool mlir::lsp::fromJSON(const llvm::json::Value &value, TraceLevel &result, - llvm::json::Path path) { + llvm::json::Path) { if (Optional str = value.getAsString()) { if (*str == "off") { result = TraceLevel::Off; diff --git a/mlir/lib/Transforms/BufferOptimizations.cpp b/mlir/lib/Transforms/BufferOptimizations.cpp --- a/mlir/lib/Transforms/BufferOptimizations.cpp +++ b/mlir/lib/Transforms/BufferOptimizations.cpp @@ -399,7 +399,7 @@ explicit PromoteBuffersToStackPass(std::function isSmallAlloc) : isSmallAlloc(std::move(isSmallAlloc)) {} - LogicalResult initialize(MLIRContext *context) override { + LogicalResult initialize(MLIRContext *) override { if (isSmallAlloc == nullptr) { isSmallAlloc = [=](Value alloc) { return defaultIsSmallAlloc(alloc, maxAllocSizeInBytes, diff --git a/mlir/lib/Transforms/Inliner.cpp b/mlir/lib/Transforms/Inliner.cpp --- a/mlir/lib/Transforms/Inliner.cpp +++ b/mlir/lib/Transforms/Inliner.cpp @@ -165,7 +165,7 @@ void CGUseList::dropCallUses(CallGraphNode *userNode, Operation *callOp, CallGraph &cg) { auto &userRefs = nodeUses[userNode].innerUses; - auto walkFn = [&](CallGraphNode *node, Operation *user) { + auto walkFn = [&](CallGraphNode *node, Operation *) { auto parentIt = userRefs.find(node); if (parentIt == userRefs.end()) return; diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp --- a/mlir/lib/Transforms/Utils/DialectConversion.cpp +++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp @@ -542,7 +542,6 @@ /// survives the conversion process. LogicalResult materializeLiveConversions(ConversionValueMapping &mapping, - OpBuilder &builder, function_ref findLiveUser); //===--------------------------------------------------------------------===// @@ -674,7 +673,7 @@ } LogicalResult ArgConverter::materializeLiveConversions( - ConversionValueMapping &mapping, OpBuilder &builder, + ConversionValueMapping &mapping, function_ref findLiveUser) { for (auto &info : conversionInfo) { Block *newBlock = info.first; @@ -1250,9 +1249,8 @@ } LogicalResult ConversionPatternRewriterImpl::remapValues( - StringRef valueDiagTag, Optional inputLoc, - PatternRewriter &rewriter, ValueRange values, - SmallVectorImpl &remapped) { + StringRef valueDiagTag, Optional inputLoc, PatternRewriter &, + ValueRange values, SmallVectorImpl &remapped) { remapped.reserve(llvm::size(values)); SmallVector legalTypes; @@ -1447,7 +1445,7 @@ } void ConversionPatternRewriterImpl::notifyRegionIsBeingInlinedBefore( - Region ®ion, Region &parent, Region::iterator before) { + Region ®ion, Region &, Region::iterator) { if (region.empty()) return; Block *laterBlock = ®ion.back(); @@ -1495,8 +1493,8 @@ ConversionPatternRewriter::~ConversionPatternRewriter() = default; void ConversionPatternRewriter::replaceOpWithIf( - Operation *op, ValueRange newValues, bool *allUsesReplaced, - llvm::unique_function functor) { + Operation *, ValueRange, bool *, + llvm::unique_function) { // TODO: To support this we will need to rework a bit of how replacements are // tracked, given that this isn't guranteed to replace all of the uses of an // operation. The main change is that now an operation can be replaced @@ -1743,7 +1741,7 @@ ConversionPatternRewriter &rewriter); /// Legalize the resultant IR after successfully applying the given pattern. - LogicalResult legalizePatternResult(Operation *op, const Pattern &pattern, + LogicalResult legalizePatternResult(Operation *op, ConversionPatternRewriter &rewriter, RewriterState &curState); @@ -1972,7 +1970,7 @@ // Functor that performs additional legalization when a pattern is // successfully applied. auto onSuccess = [&](const Pattern &pattern) { - auto result = legalizePatternResult(op, pattern, rewriter, curState); + auto result = legalizePatternResult(op, rewriter, curState); appliedPatterns.erase(&pattern); if (failed(result)) rewriterImpl.resetState(curState); @@ -2007,7 +2005,7 @@ } LogicalResult -OperationLegalizer::legalizePatternResult(Operation *op, const Pattern &pattern, +OperationLegalizer::legalizePatternResult(Operation *op, ConversionPatternRewriter &rewriter, RewriterState &curState) { auto &impl = rewriter.getImpl(); @@ -2539,7 +2537,7 @@ return liveUserIt == val.user_end() ? nullptr : *liveUserIt; }; return rewriterImpl.argConverter.materializeLiveConversions( - rewriterImpl.mapping, rewriter, findLiveUser); + rewriterImpl.mapping, findLiveUser); } /// Replace the results of a materialization operation with the given values. @@ -2574,7 +2572,6 @@ /// conversion process, and require inserting a proper user materialization for. static void computeNecessaryMaterializations( DenseMap &materializationOps, - ConversionPatternRewriter &rewriter, ConversionPatternRewriterImpl &rewriterImpl, DenseMap> &inverseMapping, SetVector &necessaryMaterializations) { @@ -2811,7 +2808,7 @@ // expect to persist beyond the conversion process. DenseMap materializationOps; SetVector necessaryMaterializations; - computeNecessaryMaterializations(materializationOps, rewriter, rewriterImpl, + computeNecessaryMaterializations(materializationOps, rewriterImpl, *inverseMapping, necessaryMaterializations); // Once computed, legalize any necessary materializations. @@ -3063,7 +3060,7 @@ /// Hook to implement combined matching and rewriting for FunctionLike ops. LogicalResult - matchAndRewrite(Operation *op, ArrayRef operands, + matchAndRewrite(Operation *op, ArrayRef, ConversionPatternRewriter &rewriter) const override { FunctionType type = function_like_impl::getFunctionType(op); diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp --- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp +++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp @@ -238,10 +238,10 @@ }); return true; }; - auto onFailure = [&](const Pattern &pattern) { + auto onFailure = [&](const Pattern &) { LLVM_DEBUG(logResult("failure", "pattern failed to match")); }; - auto onSuccess = [&](const Pattern &pattern) { + auto onSuccess = [&](const Pattern &) { LLVM_DEBUG(logResult("success", "pattern applied successfully")); return success(); }; @@ -412,7 +412,7 @@ protected: /// If an operation is about to be removed, mark it so that we can let clients /// know. - void notifyOperationRemoved(Operation *op) override { + void notifyOperationRemoved(Operation *) override { opErasedViaPatternRewrites = true; } diff --git a/mlir/lib/Transforms/Utils/LoopFusionUtils.cpp b/mlir/lib/Transforms/Utils/LoopFusionUtils.cpp --- a/mlir/lib/Transforms/Utils/LoopFusionUtils.cpp +++ b/mlir/lib/Transforms/Utils/LoopFusionUtils.cpp @@ -429,7 +429,7 @@ /// Fuses 'srcForOp' into 'dstForOp' with destination loop block insertion point /// and source slice loop bounds specified in 'srcSlice'. -void mlir::fuseLoops(AffineForOp srcForOp, AffineForOp dstForOp, +void mlir::fuseLoops(AffineForOp srcForOp, AffineForOp, const ComputationSliceState &srcSlice, bool isInnermostSiblingInsertion) { // Clone 'srcForOp' into 'dstForOp' at 'srcSlice->insertPoint'. 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, 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) { 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 &) { 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, 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 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) { 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) { int widthOfSomething; Type oneType; SmallVector arrayOfInts; @@ -129,7 +129,7 @@ LogicalResult TestAttrWithFormatAttr::verify(function_ref emitError, - int64_t one, std::string two, IntegerAttr three, + int64_t one, std::string, IntegerAttr, ArrayRef four) { if (four.size() != static_cast(one)) return emitError() << "expected 'one' to equal 'four.size()'"; @@ -162,7 +162,7 @@ //===----------------------------------------------------------------------===// Attribute TestSubElementsAccessAttr::parse(::mlir::AsmParser &parser, - ::mlir::Type type) { + ::mlir::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) 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 @@ -17,14 +17,14 @@ // Trait Folder. //===----------------------------------------------------------------------===// -OpFoldResult TestInvolutionTraitFailingOperationFolderOp::fold( - ArrayRef operands) { +OpFoldResult +TestInvolutionTraitFailingOperationFolderOp::fold(ArrayRef) { // This failure should cause the trait fold to run instead. return {}; } -OpFoldResult TestInvolutionTraitSuccesfulOperationFolderOp::fold( - ArrayRef operands) { +OpFoldResult +TestInvolutionTraitSuccesfulOperationFolderOp::fold(ArrayRef) { 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 @@ -120,10 +120,9 @@ //===----------------------------------------------------------------------===// // Example type validity checker. -LogicalResult -TestIntegerType::verify(function_ref emitError, - unsigned width, - TestIntegerType::SignednessSemantics ss) { +LogicalResult TestIntegerType::verify(function_ref, + unsigned width, + TestIntegerType::SignednessSemantics) { if (width > 8) return failure(); return success(); @@ -153,19 +152,19 @@ } unsigned -TestTypeWithLayoutType::getTypeSizeInBits(const DataLayout &dataLayout, +TestTypeWithLayoutType::getTypeSizeInBits(const DataLayout &, DataLayoutEntryListRef params) const { return extractKind(params, "size"); } unsigned -TestTypeWithLayoutType::getABIAlignment(const DataLayout &dataLayout, +TestTypeWithLayoutType::getABIAlignment(const DataLayout &, DataLayoutEntryListRef params) const { return extractKind(params, "alignment"); } unsigned TestTypeWithLayoutType::getPreferredAlignment( - const DataLayout &dataLayout, DataLayoutEntryListRef params) const { + const DataLayout &, DataLayoutEntryListRef params) const { return extractKind(params, "preferred"); } @@ -177,7 +176,7 @@ LogicalResult TestTypeWithLayoutType::verifyEntries(DataLayoutEntryListRef params, - Location loc) const { + Location) 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,8 @@ using namespace mlir; /// Custom constraint invoked from PDL. -static LogicalResult customSingleEntityConstraint(PDLValue value, - ArrayAttr constantParams, - PatternRewriter &rewriter) { +static LogicalResult customSingleEntityConstraint(PDLValue value, ArrayAttr, + PatternRewriter &) { Operation *rootOp = value.cast(); return success(rootOp->getName().getStringRef() == "test.op"); } @@ -25,9 +24,8 @@ return customSingleEntityConstraint(values[1], constantParams, rewriter); } static LogicalResult -customMultiEntityVariadicConstraint(ArrayRef values, - ArrayAttr constantParams, - PatternRewriter &rewriter) { +customMultiEntityVariadicConstraint(ArrayRef values, ArrayAttr, + PatternRewriter &) { if (llvm::any_of(values, [](const PDLValue &value) { return !value; })) return failure(); ValueRange operandValues = values[0].cast(); @@ -38,20 +36,19 @@ } // Custom creator invoked from PDL. -static void customCreate(ArrayRef args, ArrayAttr constantParams, +static void customCreate(ArrayRef args, ArrayAttr, 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, +static void customVariadicResultCreate(ArrayRef args, ArrayAttr, + PatternRewriter &, 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, ArrayAttr, PatternRewriter &rewriter, PDLResultList &results) { results.push_back(rewriter.getF32Type()); @@ -59,7 +56,7 @@ /// Custom rewriter invoked from PDL. static void customRewriter(ArrayRef args, ArrayAttr constantParams, - PatternRewriter &rewriter, PDLResultList &results) { + PatternRewriter &rewriter, PDLResultList &) { 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,8 +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 loopDepth, + unsigned, unsigned, unsigned loopDepth, unsigned maxLoopDepth) { for (unsigned d = loopDepth + 1; d <= maxLoopDepth; ++d) { mlir::ComputationSliceState sliceUnion; 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) { body << formatv(typeParserCode, "::mlir::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) { 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 @@ -687,8 +687,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")) @@ -958,8 +957,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")) @@ -1155,8 +1153,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/unittests/Dialect/Quant/QuantizationUtilsTest.cpp b/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp --- a/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp +++ b/mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp @@ -25,7 +25,7 @@ public: TestUniformQuantizedValueConverter(UniformQuantizedType type) : UniformQuantizedValueConverter(type), qtype(type) {} - APInt quantizeFloatToInt(APFloat expressedValue) const override { + APInt quantizeFloatToInt(APFloat) const override { return APInt(qtype.getStorageType().cast().getWidth(), 5L); } diff --git a/mlir/unittests/Interfaces/ControlFlowInterfacesTest.cpp b/mlir/unittests/Interfaces/ControlFlowInterfacesTest.cpp --- a/mlir/unittests/Interfaces/ControlFlowInterfacesTest.cpp +++ b/mlir/unittests/Interfaces/ControlFlowInterfacesTest.cpp @@ -51,8 +51,7 @@ static StringRef getOperationName() { return "cftest.sequential_regions_op"; } // Region 0 has Region 1 as a successor. - void getSuccessorRegions(Optional index, - ArrayRef operands, + void getSuccessorRegions(Optional index, ArrayRef, SmallVectorImpl ®ions) { assert(index.hasValue() && "expected index"); if (*index == 0) {