Skip to content

Commit 51911a6

Browse files
committed
Apply clang-tidy fixes for performance-unnecessary-value-param in IntRangeOptimizations.cpp (NFC)
1 parent 2140260 commit 51911a6

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include <utility>
10+
911
#include "mlir/Dialect/Arith/Transforms/Passes.h"
1012

1113
#include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h"
@@ -23,20 +25,21 @@ using namespace mlir::arith;
2325
using namespace mlir::dataflow;
2426

2527
/// Returns true if 2 integer ranges have intersection.
26-
static bool intersects(ConstantIntRanges lhs, ConstantIntRanges rhs) {
28+
static bool intersects(const ConstantIntRanges &lhs,
29+
const ConstantIntRanges &rhs) {
2730
return !((lhs.smax().slt(rhs.smin()) || lhs.smin().sgt(rhs.smax())) &&
2831
(lhs.umax().ult(rhs.umin()) || lhs.umin().ugt(rhs.umax())));
2932
}
3033

3134
static FailureOr<bool> handleEq(ConstantIntRanges lhs, ConstantIntRanges rhs) {
32-
if (!intersects(lhs, rhs))
35+
if (!intersects(std::move(lhs), std::move(rhs)))
3336
return false;
3437

3538
return failure();
3639
}
3740

3841
static FailureOr<bool> handleNe(ConstantIntRanges lhs, ConstantIntRanges rhs) {
39-
if (!intersects(lhs, rhs))
42+
if (!intersects(std::move(lhs), std::move(rhs)))
4043
return true;
4144

4245
return failure();
@@ -63,11 +66,11 @@ static FailureOr<bool> handleSle(ConstantIntRanges lhs, ConstantIntRanges rhs) {
6366
}
6467

6568
static FailureOr<bool> handleSgt(ConstantIntRanges lhs, ConstantIntRanges rhs) {
66-
return handleSlt(rhs, lhs);
69+
return handleSlt(std::move(rhs), std::move(lhs));
6770
}
6871

6972
static FailureOr<bool> handleSge(ConstantIntRanges lhs, ConstantIntRanges rhs) {
70-
return handleSle(rhs, lhs);
73+
return handleSle(std::move(rhs), std::move(lhs));
7174
}
7275

7376
static FailureOr<bool> handleUlt(ConstantIntRanges lhs, ConstantIntRanges rhs) {
@@ -91,11 +94,11 @@ static FailureOr<bool> handleUle(ConstantIntRanges lhs, ConstantIntRanges rhs) {
9194
}
9295

9396
static FailureOr<bool> handleUgt(ConstantIntRanges lhs, ConstantIntRanges rhs) {
94-
return handleUlt(rhs, lhs);
97+
return handleUlt(std::move(rhs), std::move(lhs));
9598
}
9699

97100
static FailureOr<bool> handleUge(ConstantIntRanges lhs, ConstantIntRanges rhs) {
98-
return handleUle(rhs, lhs);
101+
return handleUle(std::move(rhs), std::move(lhs));
99102
}
100103

101104
namespace {

0 commit comments

Comments
 (0)