[Mlir-commits] [mlir] e96214d - Fix some clang-tidy reports in MLIR (NFC)

Mehdi Amini llvmlistbot at llvm.org
Sat Nov 13 12:09:30 PST 2021


Author: Mehdi Amini
Date: 2021-11-13T20:09:21Z
New Revision: e96214ddefb98d18c4448604a746657dba1da91f

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

LOG: Fix some clang-tidy reports in MLIR (NFC)

Mostly replace uses of `container.size()` with `container.empty()` in
conditionals when applicable.

Added: 
    

Modified: 
    mlir/lib/Transforms/LoopFusion.cpp
    mlir/lib/Transforms/NormalizeMemRefs.cpp
    mlir/lib/Transforms/ParallelLoopCollapsing.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Transforms/LoopFusion.cpp b/mlir/lib/Transforms/LoopFusion.cpp
index 6a456ea84b350..24ef03ba730a3 100644
--- a/mlir/lib/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Transforms/LoopFusion.cpp
@@ -1565,7 +1565,7 @@ struct GreedyFusion {
             // producer scenarios will still go through profitability analysis
             // if only one of the stores is involved the producer-consumer
             // relationship of the candidate loops.
-            assert(producerStores.size() > 0 && "Expected producer store");
+            assert(!producerStores.empty() && "Expected producer store");
             if (producerStores.size() > 1)
               LLVM_DEBUG(llvm::dbgs() << "Skipping profitability analysis. Not "
                                          "supported for this case\n");

diff  --git a/mlir/lib/Transforms/NormalizeMemRefs.cpp b/mlir/lib/Transforms/NormalizeMemRefs.cpp
index 4a4deb5d3586f..c3fa7fe412bea 100644
--- a/mlir/lib/Transforms/NormalizeMemRefs.cpp
+++ b/mlir/lib/Transforms/NormalizeMemRefs.cpp
@@ -460,7 +460,6 @@ void NormalizeMemRefs::normalizeFuncOpMemRefs(FuncOp funcOp,
       MemRefType newMemRefType = normalizeMemRefType(memrefType, b,
                                                      /*numSymbolicOperands=*/0);
       resultTypes.push_back(newMemRefType);
-      continue;
     }
 
     FunctionType newFuncType =

diff  --git a/mlir/lib/Transforms/ParallelLoopCollapsing.cpp b/mlir/lib/Transforms/ParallelLoopCollapsing.cpp
index 72070a9e291f1..2c3329cde2218 100644
--- a/mlir/lib/Transforms/ParallelLoopCollapsing.cpp
+++ b/mlir/lib/Transforms/ParallelLoopCollapsing.cpp
@@ -28,11 +28,11 @@ struct ParallelLoopCollapsing
       // The common case for GPU dialect will be simplifying the ParallelOp to 3
       // arguments, so we do that here to simplify things.
       llvm::SmallVector<std::vector<unsigned>, 3> combinedLoops;
-      if (clCollapsedIndices0.size())
+      if (!clCollapsedIndices0.empty())
         combinedLoops.push_back(clCollapsedIndices0);
-      if (clCollapsedIndices1.size())
+      if (!clCollapsedIndices1.empty())
         combinedLoops.push_back(clCollapsedIndices1);
-      if (clCollapsedIndices2.size())
+      if (!clCollapsedIndices2.empty())
         combinedLoops.push_back(clCollapsedIndices2);
       collapseParallelLoops(op, combinedLoops);
     });


        


More information about the Mlir-commits mailing list