From 51911a62e4053c95155f5350ae9d27871e9c1988 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Sat, 14 Jan 2023 04:52:46 +0000 Subject: [PATCH] Apply clang-tidy fixes for performance-unnecessary-value-param in IntRangeOptimizations.cpp (NFC) --- .../Dialect/Arith/Transforms/IntRangeOptimizations.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp b/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp index 7f34c0a..04a560c 100644 --- a/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp +++ b/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +#include + #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 handleEq(ConstantIntRanges lhs, ConstantIntRanges rhs) { - if (!intersects(lhs, rhs)) + if (!intersects(std::move(lhs), std::move(rhs))) return false; return failure(); } static FailureOr 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 handleSle(ConstantIntRanges lhs, ConstantIntRanges rhs) { } static FailureOr handleSgt(ConstantIntRanges lhs, ConstantIntRanges rhs) { - return handleSlt(rhs, lhs); + return handleSlt(std::move(rhs), std::move(lhs)); } static FailureOr handleSge(ConstantIntRanges lhs, ConstantIntRanges rhs) { - return handleSle(rhs, lhs); + return handleSle(std::move(rhs), std::move(lhs)); } static FailureOr handleUlt(ConstantIntRanges lhs, ConstantIntRanges rhs) { @@ -91,11 +94,11 @@ static FailureOr handleUle(ConstantIntRanges lhs, ConstantIntRanges rhs) { } static FailureOr handleUgt(ConstantIntRanges lhs, ConstantIntRanges rhs) { - return handleUlt(rhs, lhs); + return handleUlt(std::move(rhs), std::move(lhs)); } static FailureOr handleUge(ConstantIntRanges lhs, ConstantIntRanges rhs) { - return handleUle(rhs, lhs); + return handleUle(std::move(rhs), std::move(lhs)); } namespace { -- 2.7.4