Skip to content

Commit e1f389a

Browse files
committed
Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)
1 parent 03e6d10 commit e1f389a

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

mlir/lib/IR/AffineExpr.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,7 @@ static bool isDivisibleBySymbol(AffineExpr expr, unsigned symbolPos,
328328
"unexpected opKind");
329329
switch (expr.getKind()) {
330330
case AffineExprKind::Constant:
331-
if (expr.cast<AffineConstantExpr>().getValue())
332-
return false;
333-
return true;
331+
return expr.cast<AffineConstantExpr>().getValue() == 0;
334332
case AffineExprKind::DimId:
335333
return false;
336334
case AffineExprKind::SymbolId:

mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ static void applyFoldConstantExtractSlicePatterns(FuncOp funcOp) {
6565

6666
auto resultType = op.result().getType().cast<ShapedType>();
6767
constexpr int64_t kConstantFoldingMaxNumElements = 1024;
68-
if (resultType.getNumElements() > kConstantFoldingMaxNumElements)
69-
return false;
70-
71-
return true;
68+
return resultType.getNumElements() <= kConstantFoldingMaxNumElements;
7269
};
7370

7471
tensor::populateFoldConstantExtractSlicePatterns(patterns, controlFn);

0 commit comments

Comments
 (0)