[Mlir-commits] [mlir] 4f41521 - Apply clang-tidy fixes for performance-unnecessary-value-param to MLIR (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Sun Jan 2 14:38:17 PST 2022
Author: Mehdi Amini
Date: 2022-01-02T22:37:13Z
New Revision: 4f415216ca812fc81fddeefe48623474c35009c9
URL: https://github.com/llvm/llvm-project/commit/4f415216ca812fc81fddeefe48623474c35009c9
DIFF: https://github.com/llvm/llvm-project/commit/4f415216ca812fc81fddeefe48623474c35009c9.diff
LOG: Apply clang-tidy fixes for performance-unnecessary-value-param to MLIR (NFC)
Added:
Modified:
mlir/lib/Bindings/Python/IRCore.cpp
mlir/lib/Bindings/Python/IRModule.h
mlir/lib/Conversion/TosaToLinalg/TosaToLinalgNamed.cpp
mlir/lib/Reducer/ReductionNode.cpp
mlir/lib/Target/Cpp/TranslateToCpp.cpp
mlir/unittests/Dialect/SparseTensor/MergerTest.cpp
Removed:
################################################################################
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<py::dict> attributes,
- llvm::Optional<std::vector<PyBlock *>> successors,
- llvm::Optional<int> regions,
- DefaultingPyLocation location, py::object maybeIp) {
+py::object PyOpView::buildGeneric(
+ const py::object &cls, py::list resultTypeList, py::list operandList,
+ llvm::Optional<py::dict> attributes,
+ llvm::Optional<std::vector<PyBlock *>> successors,
+ llvm::Optional<int> regions, DefaultingPyLocation location,
+ const py::object &maybeIp) {
PyMlirContextRef context = location->getContext();
// Class level operation construction metadata.
std::string name = py::cast<std::string>(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<pybind11::dict> attributes,
llvm::Optional<std::vector<PyBlock *>> successors,
llvm::Optional<int> 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<int64_t> pad,
.result();
}
-static SmallVector<Value> filterDynamicDims(SmallVector<Value> dynDims) {
+static SmallVector<Value> filterDynamicDims(const SmallVector<Value> &dynDims) {
SmallVector<Value> 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 *> ReductionNode::generateNewVariants() {
int oldNumVariant = getVariants().size();
- auto createNewNode = [this](std::vector<Range> ranges) {
+ auto createNewNode = [this](const std::vector<Range> &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<DenseFPElementsAttr>()) {
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<IntegerType>()) {
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<IndexType>()) {
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> pattern,
- llvm::BitVector bits) {
+ const std::shared_ptr<Pattern> &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> pattern,
- llvm::BitVector bits) {
+ void expectLatPoint(unsigned s, unsigned p,
+ const std::shared_ptr<Pattern> &pattern,
+ const llvm::BitVector &bits) {
EXPECT_TRUE(latPointWithinRange(s, p, 1, pattern, bits));
}
More information about the Mlir-commits
mailing list