From e1f389a89fd17b7ac586ace5bd7cbe368cfe7c2b Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Mon, 7 Mar 2022 10:12:48 +0000 Subject: [PATCH] Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC) --- mlir/lib/IR/AffineExpr.cpp | 4 +--- mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/mlir/lib/IR/AffineExpr.cpp b/mlir/lib/IR/AffineExpr.cpp index 2a3b981..44bf53b 100644 --- a/mlir/lib/IR/AffineExpr.cpp +++ b/mlir/lib/IR/AffineExpr.cpp @@ -328,9 +328,7 @@ static bool isDivisibleBySymbol(AffineExpr expr, unsigned symbolPos, "unexpected opKind"); switch (expr.getKind()) { case AffineExprKind::Constant: - if (expr.cast().getValue()) - return false; - return true; + return expr.cast().getValue() == 0; case AffineExprKind::DimId: return false; case AffineExprKind::SymbolId: diff --git a/mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp b/mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp index 7fdc185..2a2603a 100644 --- a/mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp +++ b/mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp @@ -65,10 +65,7 @@ static void applyFoldConstantExtractSlicePatterns(FuncOp funcOp) { auto resultType = op.result().getType().cast(); constexpr int64_t kConstantFoldingMaxNumElements = 1024; - if (resultType.getNumElements() > kConstantFoldingMaxNumElements) - return false; - - return true; + return resultType.getNumElements() <= kConstantFoldingMaxNumElements; }; tensor::populateFoldConstantExtractSlicePatterns(patterns, controlFn); -- 2.7.4