[Mlir-commits] [mlir] e1f389a - Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)

Mehdi Amini llvmlistbot at llvm.org
Mon Mar 7 02:42:12 PST 2022


Author: Mehdi Amini
Date: 2022-03-07T10:41:45Z
New Revision: e1f389a89fd17b7ac586ace5bd7cbe368cfe7c2b

URL: https://github.com/llvm/llvm-project/commit/e1f389a89fd17b7ac586ace5bd7cbe368cfe7c2b
DIFF: https://github.com/llvm/llvm-project/commit/e1f389a89fd17b7ac586ace5bd7cbe368cfe7c2b.diff

LOG: Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)

Added: 
    

Modified: 
    mlir/lib/IR/AffineExpr.cpp
    mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/AffineExpr.cpp b/mlir/lib/IR/AffineExpr.cpp
index 2a3b9819b320f..44bf53bc32b9b 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<AffineConstantExpr>().getValue())
-      return false;
-    return true;
+    return expr.cast<AffineConstantExpr>().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 7fdc185946e15..2a2603ad2b18d 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<ShapedType>();
         constexpr int64_t kConstantFoldingMaxNumElements = 1024;
-        if (resultType.getNumElements() > kConstantFoldingMaxNumElements)
-          return false;
-
-        return true;
+        return resultType.getNumElements() <= kConstantFoldingMaxNumElements;
       };
 
   tensor::populateFoldConstantExtractSlicePatterns(patterns, controlFn);


        


More information about the Mlir-commits mailing list