Skip to content

Commit a393f20

Browse files
committed
[MLIR] Apply clang-tidy fixes for readability-simplify-boolean-expr in TosaOps.cpp (NFC)
1 parent 2ef58b6 commit a393f20

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mlir/lib/Dialect/Tosa/IR/TosaOps.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,7 +3056,7 @@ static LogicalResult verifyReduceOp(T op) {
30563056
int64_t inputRank = inputType.getRank();
30573057
// We allow for a special case where the input/output shape has rank 0 and
30583058
// axis is also 0.
3059-
if (reduceAxis >= inputRank && !(reduceAxis == 0 && inputRank == 0)) {
3059+
if (reduceAxis >= inputRank && (reduceAxis != 0 || inputRank != 0)) {
30603060
op.emitOpError("expect input tensor rank (")
30613061
<< inputRank << ") to be larger than reduce axis (" << reduceAxis
30623062
<< ")";
@@ -3070,7 +3070,7 @@ static LogicalResult verifyReduceOp(T op) {
30703070
"expect output tensor rank to be equal to input tensor rank");
30713071
return failure();
30723072
}
3073-
if (reduceAxis >= outputRank && !(reduceAxis == 0 && outputRank == 0)) {
3073+
if (reduceAxis >= outputRank && (reduceAxis != 0 || outputRank != 0)) {
30743074
op.emitOpError("expect output tensor rank (")
30753075
<< outputRank << ") to be larger than reduce axis (" << reduceAxis
30763076
<< ")";
@@ -4105,7 +4105,7 @@ LogicalResult ReverseOp::verify() {
41054105
int64_t inputRank = inputType.getRank();
41064106
// We allow for a special case where the input/output shape has rank 0 and
41074107
// axis is also 0.
4108-
if (reverseAxis >= inputRank && !(reverseAxis == 0 && inputRank == 0))
4108+
if (reverseAxis >= inputRank && (reverseAxis != 0 || inputRank != 0))
41094109
return emitOpError("expect input tensor rank (")
41104110
<< inputRank << ") to be larger than reverse axis (" << reverseAxis
41114111
<< ")";
@@ -4115,7 +4115,7 @@ LogicalResult ReverseOp::verify() {
41154115
if (inputType.hasRank() && outputRank != inputType.getRank())
41164116
return emitOpError(
41174117
"expect output tensor rank to be equal to input tensor rank");
4118-
if (reverseAxis >= outputRank && !(reverseAxis == 0 && outputRank == 0))
4118+
if (reverseAxis >= outputRank && (reverseAxis != 0 || outputRank != 0))
41194119
return emitOpError("expect output tensor rank (")
41204120
<< outputRank << ") to be larger than reverse axis ("
41214121
<< reverseAxis << ")";
@@ -4330,7 +4330,7 @@ LogicalResult tosa::ConstShapeOp::verify() {
43304330
// check that number of elements in values attr equal to rank of result shape
43314331
auto count = getValues().getNumElements();
43324332
auto rank = (cast<tosa::shapeType>(getResult().getType())).getRank();
4333-
if (!(count == rank || (count == 1 && rank == 0))) {
4333+
if (count != rank && (count != 1 || rank != 0)) {
43344334
return emitOpError("expect number of elements in attribute values (")
43354335
<< count << ") to be equal to the rank (" << rank
43364336
<< ") for the result shape type";

0 commit comments

Comments
 (0)