[Mlir-commits] [mlir] 51911a6 - Apply clang-tidy fixes for performance-unnecessary-value-param in IntRangeOptimizations.cpp (NFC)

Mehdi Amini llvmlistbot at llvm.org
Sat Jan 14 05:01:38 PST 2023


Author: Mehdi Amini
Date: 2023-01-14T13:01:30Z
New Revision: 51911a62e4053c95155f5350ae9d27871e9c1988

URL: https://github.com/llvm/llvm-project/commit/51911a62e4053c95155f5350ae9d27871e9c1988
DIFF: https://github.com/llvm/llvm-project/commit/51911a62e4053c95155f5350ae9d27871e9c1988.diff

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

Added: 
    

Modified: 
    mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp b/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp
index 7f34c0a20d517..04a560ce474f1 100644
--- a/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp
@@ -6,6 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <utility>
+
 #include "mlir/Dialect/Arith/Transforms/Passes.h"
 
 #include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
@@ -23,20 +25,21 @@ using namespace mlir::arith;
 using namespace mlir::dataflow;
 
 /// Returns true if 2 integer ranges have intersection.
-static bool intersects(ConstantIntRanges lhs, ConstantIntRanges rhs) {
+static bool intersects(const ConstantIntRanges &lhs,
+                       const ConstantIntRanges &rhs) {
   return !((lhs.smax().slt(rhs.smin()) || lhs.smin().sgt(rhs.smax())) &&
            (lhs.umax().ult(rhs.umin()) || lhs.umin().ugt(rhs.umax())));
 }
 
 static FailureOr<bool> handleEq(ConstantIntRanges lhs, ConstantIntRanges rhs) {
-  if (!intersects(lhs, rhs))
+  if (!intersects(std::move(lhs), std::move(rhs)))
     return false;
 
   return failure();
 }
 
 static FailureOr<bool> handleNe(ConstantIntRanges lhs, ConstantIntRanges rhs) {
-  if (!intersects(lhs, rhs))
+  if (!intersects(std::move(lhs), std::move(rhs)))
     return true;
 
   return failure();
@@ -63,11 +66,11 @@ static FailureOr<bool> handleSle(ConstantIntRanges lhs, ConstantIntRanges rhs) {
 }
 
 static FailureOr<bool> handleSgt(ConstantIntRanges lhs, ConstantIntRanges rhs) {
-  return handleSlt(rhs, lhs);
+  return handleSlt(std::move(rhs), std::move(lhs));
 }
 
 static FailureOr<bool> handleSge(ConstantIntRanges lhs, ConstantIntRanges rhs) {
-  return handleSle(rhs, lhs);
+  return handleSle(std::move(rhs), std::move(lhs));
 }
 
 static FailureOr<bool> handleUlt(ConstantIntRanges lhs, ConstantIntRanges rhs) {
@@ -91,11 +94,11 @@ static FailureOr<bool> handleUle(ConstantIntRanges lhs, ConstantIntRanges rhs) {
 }
 
 static FailureOr<bool> handleUgt(ConstantIntRanges lhs, ConstantIntRanges rhs) {
-  return handleUlt(rhs, lhs);
+  return handleUlt(std::move(rhs), std::move(lhs));
 }
 
 static FailureOr<bool> handleUge(ConstantIntRanges lhs, ConstantIntRanges rhs) {
-  return handleUle(rhs, lhs);
+  return handleUle(std::move(rhs), std::move(lhs));
 }
 
 namespace {


        


More information about the Mlir-commits mailing list