[Mlir-commits] [mlir] 8e5f112 - Apply clang-tidy fixes for performance-move-const-arg to MLIR (NFC)

Mehdi Amini llvmlistbot at llvm.org
Thu Jan 13 18:28:05 PST 2022


Author: Mehdi Amini
Date: 2022-01-14T02:26:27Z
New Revision: 8e5f112c05a884ec91c23f9e5cb03db308bd904a

URL: https://github.com/llvm/llvm-project/commit/8e5f112c05a884ec91c23f9e5cb03db308bd904a
DIFF: https://github.com/llvm/llvm-project/commit/8e5f112c05a884ec91c23f9e5cb03db308bd904a.diff

LOG: Apply clang-tidy fixes for performance-move-const-arg to MLIR (NFC)

Added: 
    

Modified: 
    mlir/examples/toy/Ch7/include/toy/Parser.h
    mlir/include/mlir/ExecutionEngine/MemRefUtils.h
    mlir/include/mlir/IR/BuiltinAttributeInterfaces.h
    mlir/include/mlir/IR/BuiltinAttributes.h
    mlir/include/mlir/Support/Timing.h
    mlir/include/mlir/TableGen/Format.h
    mlir/include/mlir/Transforms/DialectConversion.h

Removed: 
    


################################################################################
diff  --git a/mlir/examples/toy/Ch7/include/toy/Parser.h b/mlir/examples/toy/Ch7/include/toy/Parser.h
index bbca92e957fb1..e6df5581c6f1c 100644
--- a/mlir/examples/toy/Ch7/include/toy/Parser.h
+++ b/mlir/examples/toy/Ch7/include/toy/Parser.h
@@ -253,11 +253,11 @@ class Parser {
       if (args.size() != 1)
         return parseError<ExprAST>("<single arg>", "as argument to print()");
 
-      return std::make_unique<PrintExprAST>(std::move(loc), std::move(args[0]));
+      return std::make_unique<PrintExprAST>(loc, std::move(args[0]));
     }
 
     // Call to a user-defined function
-    return std::make_unique<CallExprAST>(std::move(loc), std::string(name),
+    return std::make_unique<CallExprAST>(loc, std::string(name),
                                          std::move(args));
   }
 

diff  --git a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
index 13778e9af1e72..6ab2dc1ae3c27 100644
--- a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
+++ b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
@@ -198,7 +198,7 @@ class OwningMemRef {
   DescriptorType &operator*() { return descriptor; }
   DescriptorType *operator->() { return &descriptor; }
   T &operator[](std::initializer_list<int64_t> indices) {
-    return descriptor[std::move(indices)];
+    return descriptor[indices];
   }
 
 private:

diff  --git a/mlir/include/mlir/IR/BuiltinAttributeInterfaces.h b/mlir/include/mlir/IR/BuiltinAttributeInterfaces.h
index 37635687c4d46..80ff95eca3ca8 100644
--- a/mlir/include/mlir/IR/BuiltinAttributeInterfaces.h
+++ b/mlir/include/mlir/IR/BuiltinAttributeInterfaces.h
@@ -38,7 +38,7 @@ struct ElementsAttrIndexer {
   ElementsAttrIndexer(ElementsAttrIndexer &&rhs)
       : isContiguous(rhs.isContiguous), isSplat(rhs.isSplat) {
     if (isContiguous)
-      conState = std::move(rhs.conState);
+      conState = rhs.conState;
     else
       new (&nonConState) NonContiguousState(std::move(rhs.nonConState));
   }

diff  --git a/mlir/include/mlir/IR/BuiltinAttributes.h b/mlir/include/mlir/IR/BuiltinAttributes.h
index 0852678888246..5399718f67582 100644
--- a/mlir/include/mlir/IR/BuiltinAttributes.h
+++ b/mlir/include/mlir/IR/BuiltinAttributes.h
@@ -900,8 +900,7 @@ auto SparseElementsAttr::value_begin() const -> iterator<T> {
   auto valueIt = getValues().value_begin<T>();
   const std::vector<ptr
diff _t> flatSparseIndices(getFlattenedSparseIndices());
   std::function<T(ptr
diff _t)> mapFn =
-      [flatSparseIndices{std::move(flatSparseIndices)},
-       valueIt{std::move(valueIt)},
+      [flatSparseIndices{flatSparseIndices}, valueIt{std::move(valueIt)},
        zeroValue{std::move(zeroValue)}](ptr
diff _t index) {
         // Try to map the current index to one of the sparse indices.
         for (unsigned i = 0, e = flatSparseIndices.size(); i != e; ++i)

diff  --git a/mlir/include/mlir/Support/Timing.h b/mlir/include/mlir/Support/Timing.h
index 1fcd8293f3422..8c48536fe8695 100644
--- a/mlir/include/mlir/Support/Timing.h
+++ b/mlir/include/mlir/Support/Timing.h
@@ -228,8 +228,7 @@ class Timer {
   ///
   /// The `nameBuilder` function is not guaranteed to be called.
   Timer nest(const void *id, function_ref<std::string()> nameBuilder) {
-    return tm ? Timer(*tm, tm->nestTimer(handle, id, std::move(nameBuilder)))
-              : Timer();
+    return tm ? Timer(*tm, tm->nestTimer(handle, id, nameBuilder)) : Timer();
   }
 
   /// See above.

diff  --git a/mlir/include/mlir/TableGen/Format.h b/mlir/include/mlir/TableGen/Format.h
index 1772a90926ee3..726a8416d03ed 100644
--- a/mlir/include/mlir/TableGen/Format.h
+++ b/mlir/include/mlir/TableGen/Format.h
@@ -152,7 +152,7 @@ class FmtObjectBase {
   FmtObjectBase(const FmtObjectBase &that) = delete;
 
   FmtObjectBase(FmtObjectBase &&that)
-      : fmt(std::move(that.fmt)), context(that.context),
+      : fmt(that.fmt), context(that.context),
         adapters(), // adapters are initialized by FmtObject
         replacements(std::move(that.replacements)) {}
 

diff  --git a/mlir/include/mlir/Transforms/DialectConversion.h b/mlir/include/mlir/Transforms/DialectConversion.h
index 63892418f4cf4..e73b3f95b116a 100644
--- a/mlir/include/mlir/Transforms/DialectConversion.h
+++ b/mlir/include/mlir/Transforms/DialectConversion.h
@@ -778,7 +778,7 @@ class ConversionTarget {
                                   StringRef name, Names... names) {
     SmallVector<StringRef, 2> dialectNames({name, names...});
     setDialectAction(dialectNames, LegalizationAction::Dynamic);
-    setLegalityCallback(dialectNames, std::move(callback));
+    setLegalityCallback(dialectNames, callback);
   }
   template <typename... Args>
   void addDynamicallyLegalDialect(DynamicLegalityCallbackFn callback) {


        


More information about the Mlir-commits mailing list