[Mlir-commits] [mlir] 89b0f1e - Apply clang-tidy fixes for performance-unnecessary-value-param in IRInterfaces.cpp (NFC)

Mehdi Amini llvmlistbot at llvm.org
Sat Nov 18 15:38:40 PST 2023


Author: Mehdi Amini
Date: 2023-11-18T15:38:21-08:00
New Revision: 89b0f1ee340b31f09d148ca542a41a9870fb0fad

URL: https://github.com/llvm/llvm-project/commit/89b0f1ee340b31f09d148ca542a41a9870fb0fad
DIFF: https://github.com/llvm/llvm-project/commit/89b0f1ee340b31f09d148ca542a41a9870fb0fad.diff

LOG: Apply clang-tidy fixes for performance-unnecessary-value-param in IRInterfaces.cpp (NFC)

Added: 
    

Modified: 
    mlir/lib/Bindings/Python/IRInterfaces.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bindings/Python/IRInterfaces.cpp b/mlir/lib/Bindings/Python/IRInterfaces.cpp
index 136bb1b2b136cc2..c3aac0b092bc797 100644
--- a/mlir/lib/Bindings/Python/IRInterfaces.cpp
+++ b/mlir/lib/Bindings/Python/IRInterfaces.cpp
@@ -281,8 +281,9 @@ class PyInferTypeOpInterface
                    std::optional<std::vector<PyRegion>> regions,
                    DefaultingPyMlirContext context,
                    DefaultingPyLocation location) {
-    llvm::SmallVector<MlirValue> mlirOperands = wrapOperands(operandList);
-    llvm::SmallVector<MlirRegion> mlirRegions = wrapRegions(regions);
+    llvm::SmallVector<MlirValue> mlirOperands =
+        wrapOperands(std::move(operandList));
+    llvm::SmallVector<MlirRegion> mlirRegions = wrapRegions(std::move(regions));
 
     std::vector<PyType> inferredTypes;
     PyMlirContext &pyContext = context.resolve();
@@ -319,10 +320,10 @@ class PyShapedTypeComponents {
 public:
   PyShapedTypeComponents(MlirType elementType) : elementType(elementType) {}
   PyShapedTypeComponents(py::list shape, MlirType elementType)
-      : shape(shape), elementType(elementType), ranked(true) {}
+      : shape(std::move(shape)), elementType(elementType), ranked(true) {}
   PyShapedTypeComponents(py::list shape, MlirType elementType,
                          MlirAttribute attribute)
-      : shape(shape), elementType(elementType), attribute(attribute),
+      : shape(std::move(shape)), elementType(elementType), attribute(attribute),
         ranked(true) {}
   PyShapedTypeComponents(PyShapedTypeComponents &) = delete;
   PyShapedTypeComponents(PyShapedTypeComponents &&other)
@@ -347,14 +348,15 @@ class PyShapedTypeComponents {
         .def_static(
             "get",
             [](py::list shape, PyType &elementType) {
-              return PyShapedTypeComponents(shape, elementType);
+              return PyShapedTypeComponents(std::move(shape), elementType);
             },
             py::arg("shape"), py::arg("element_type"),
             "Create a ranked shaped type components object.")
         .def_static(
             "get",
             [](py::list shape, PyType &elementType, PyAttribute &attribute) {
-              return PyShapedTypeComponents(shape, elementType, attribute);
+              return PyShapedTypeComponents(std::move(shape), elementType,
+                                            attribute);
             },
             py::arg("shape"), py::arg("element_type"), py::arg("attribute"),
             "Create a ranked shaped type components object with attribute.")
@@ -438,8 +440,9 @@ class PyInferShapedTypeOpInterface
       std::optional<PyAttribute> attributes, void *properties,
       std::optional<std::vector<PyRegion>> regions,
       DefaultingPyMlirContext context, DefaultingPyLocation location) {
-    llvm::SmallVector<MlirValue> mlirOperands = wrapOperands(operandList);
-    llvm::SmallVector<MlirRegion> mlirRegions = wrapRegions(regions);
+    llvm::SmallVector<MlirValue> mlirOperands =
+        wrapOperands(std::move(operandList));
+    llvm::SmallVector<MlirRegion> mlirRegions = wrapRegions(std::move(regions));
 
     std::vector<PyShapedTypeComponents> inferredShapedTypeComponents;
     PyMlirContext &pyContext = context.resolve();


        


More information about the Mlir-commits mailing list