diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp index b9d31b27b6bce..6861532272036 100644 --- a/mlir/lib/Bindings/Python/IRCore.cpp +++ b/mlir/lib/Bindings/Python/IRCore.cpp @@ -1107,13 +1107,12 @@ void PyOperation::erase() { // PyOpView //------------------------------------------------------------------------------ -py::object -PyOpView::buildGeneric(const py::object &cls, py::list resultTypeList, - py::list operandList, - llvm::Optional attributes, - llvm::Optional> successors, - llvm::Optional regions, - DefaultingPyLocation location, py::object maybeIp) { +py::object PyOpView::buildGeneric( + const py::object &cls, py::list resultTypeList, py::list operandList, + llvm::Optional attributes, + llvm::Optional> successors, + llvm::Optional regions, DefaultingPyLocation location, + const py::object &maybeIp) { PyMlirContextRef context = location->getContext(); // Class level operation construction metadata. std::string name = py::cast(cls.attr("OPERATION_NAME")); diff --git a/mlir/lib/Bindings/Python/IRModule.h b/mlir/lib/Bindings/Python/IRModule.h index df4aaebf30360..117435d633b16 100644 --- a/mlir/lib/Bindings/Python/IRModule.h +++ b/mlir/lib/Bindings/Python/IRModule.h @@ -539,7 +539,7 @@ class PyOpView : public PyOperationBase { llvm::Optional attributes, llvm::Optional> successors, llvm::Optional regions, DefaultingPyLocation location, - pybind11::object maybeIp); + const pybind11::object &maybeIp); private: PyOperation &operation; // For efficient, cast-free access from C++ diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp index 90220ef44e974..a9c525f43aa37 100644 --- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp +++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp @@ -82,7 +82,7 @@ static mlir::Value applyPad(Location loc, Value input, ArrayRef pad, .result(); } -static SmallVector filterDynamicDims(SmallVector dynDims) { +static SmallVector filterDynamicDims(const SmallVector &dynDims) { SmallVector filteredDims; for (auto dim : dynDims) if (dim) diff --git a/mlir/lib/Reducer/ReductionNode.cpp b/mlir/lib/Reducer/ReductionNode.cpp index 1555bce333252..2288b0ac0be15 100644 --- a/mlir/lib/Reducer/ReductionNode.cpp +++ b/mlir/lib/Reducer/ReductionNode.cpp @@ -52,7 +52,7 @@ LogicalResult ReductionNode::initialize(ModuleOp parentModule, ArrayRef ReductionNode::generateNewVariants() { int oldNumVariant = getVariants().size(); - auto createNewNode = [this](std::vector ranges) { + auto createNewNode = [this](const std::vector &ranges) { return new (allocator.Allocate()) ReductionNode(this, ranges, allocator); }; diff --git a/mlir/lib/Target/Cpp/TranslateToCpp.cpp b/mlir/lib/Target/Cpp/TranslateToCpp.cpp index a51bf16e3c8ae..1fc120a7dcd96 100644 --- a/mlir/lib/Target/Cpp/TranslateToCpp.cpp +++ b/mlir/lib/Target/Cpp/TranslateToCpp.cpp @@ -736,7 +736,7 @@ LogicalResult CppEmitter::emitAttribute(Location loc, Attribute attr) { } if (auto dense = attr.dyn_cast()) { os << '{'; - interleaveComma(dense, os, [&](APFloat val) { printFloat(val); }); + interleaveComma(dense, os, [&](const APFloat &val) { printFloat(val); }); os << '}'; return success(); } @@ -758,7 +758,7 @@ LogicalResult CppEmitter::emitAttribute(Location loc, Attribute attr) { .getElementType() .dyn_cast()) { os << '{'; - interleaveComma(dense, os, [&](APInt val) { + interleaveComma(dense, os, [&](const APInt &val) { printInt(val, shouldMapToUnsigned(iType.getSignedness())); }); os << '}'; @@ -769,7 +769,8 @@ LogicalResult CppEmitter::emitAttribute(Location loc, Attribute attr) { .getElementType() .dyn_cast()) { os << '{'; - interleaveComma(dense, os, [&](APInt val) { printInt(val, false); }); + interleaveComma(dense, os, + [&](const APInt &val) { printInt(val, false); }); os << '}'; return success(); } diff --git a/mlir/unittests/Dialect/SparseTensor/MergerTest.cpp b/mlir/unittests/Dialect/SparseTensor/MergerTest.cpp index fe69878c82839..6ea9960428f0e 100644 --- a/mlir/unittests/Dialect/SparseTensor/MergerTest.cpp +++ b/mlir/unittests/Dialect/SparseTensor/MergerTest.cpp @@ -99,14 +99,15 @@ class MergerTestBase : public ::testing::Test { /// Wrapper over latPointWithinRange for readability of tests. void expectLatPointWithinRange(unsigned s, unsigned p, unsigned n, - std::shared_ptr pattern, - llvm::BitVector bits) { + const std::shared_ptr &pattern, + const llvm::BitVector &bits) { EXPECT_TRUE(latPointWithinRange(s, p, n, pattern, bits)); } /// Wrapper over expectLatPointWithinRange for a single lat point. - void expectLatPoint(unsigned s, unsigned p, std::shared_ptr pattern, - llvm::BitVector bits) { + void expectLatPoint(unsigned s, unsigned p, + const std::shared_ptr &pattern, + const llvm::BitVector &bits) { EXPECT_TRUE(latPointWithinRange(s, p, 1, pattern, bits)); }