[Mlir-commits] [mlir] a393f20 - [MLIR] Apply clang-tidy fixes for readability-simplify-boolean-expr in TosaOps.cpp (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Wed Sep 17 00:57:50 PDT 2025
Author: Mehdi Amini
Date: 2025-09-17T00:54:53-07:00
New Revision: a393f20e4085521165a5e8de82869f1355f8cc55
URL: https://github.com/llvm/llvm-project/commit/a393f20e4085521165a5e8de82869f1355f8cc55
DIFF: https://github.com/llvm/llvm-project/commit/a393f20e4085521165a5e8de82869f1355f8cc55.diff
LOG: [MLIR] Apply clang-tidy fixes for readability-simplify-boolean-expr in TosaOps.cpp (NFC)
Added:
Modified:
mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index b4c87a34a0e5a..1c0a6a618fcd2 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -3056,7 +3056,7 @@ static LogicalResult verifyReduceOp(T op) {
int64_t inputRank = inputType.getRank();
// We allow for a special case where the input/output shape has rank 0 and
// axis is also 0.
- if (reduceAxis >= inputRank && !(reduceAxis == 0 && inputRank == 0)) {
+ if (reduceAxis >= inputRank && (reduceAxis != 0 || inputRank != 0)) {
op.emitOpError("expect input tensor rank (")
<< inputRank << ") to be larger than reduce axis (" << reduceAxis
<< ")";
@@ -3070,7 +3070,7 @@ static LogicalResult verifyReduceOp(T op) {
"expect output tensor rank to be equal to input tensor rank");
return failure();
}
- if (reduceAxis >= outputRank && !(reduceAxis == 0 && outputRank == 0)) {
+ if (reduceAxis >= outputRank && (reduceAxis != 0 || outputRank != 0)) {
op.emitOpError("expect output tensor rank (")
<< outputRank << ") to be larger than reduce axis (" << reduceAxis
<< ")";
@@ -4105,7 +4105,7 @@ LogicalResult ReverseOp::verify() {
int64_t inputRank = inputType.getRank();
// We allow for a special case where the input/output shape has rank 0 and
// axis is also 0.
- if (reverseAxis >= inputRank && !(reverseAxis == 0 && inputRank == 0))
+ if (reverseAxis >= inputRank && (reverseAxis != 0 || inputRank != 0))
return emitOpError("expect input tensor rank (")
<< inputRank << ") to be larger than reverse axis (" << reverseAxis
<< ")";
@@ -4115,7 +4115,7 @@ LogicalResult ReverseOp::verify() {
if (inputType.hasRank() && outputRank != inputType.getRank())
return emitOpError(
"expect output tensor rank to be equal to input tensor rank");
- if (reverseAxis >= outputRank && !(reverseAxis == 0 && outputRank == 0))
+ if (reverseAxis >= outputRank && (reverseAxis != 0 || outputRank != 0))
return emitOpError("expect output tensor rank (")
<< outputRank << ") to be larger than reverse axis ("
<< reverseAxis << ")";
@@ -4330,7 +4330,7 @@ LogicalResult tosa::ConstShapeOp::verify() {
// check that number of elements in values attr equal to rank of result shape
auto count = getValues().getNumElements();
auto rank = (cast<tosa::shapeType>(getResult().getType())).getRank();
- if (!(count == rank || (count == 1 && rank == 0))) {
+ if (count != rank && (count != 1 || rank != 0)) {
return emitOpError("expect number of elements in attribute values (")
<< count << ") to be equal to the rank (" << rank
<< ") for the result shape type";
More information about the Mlir-commits
mailing list