[Mlir-commits] [mlir] 69ffd49 - [mlir] Use {DenseSet, DenseMap, SemallDenseSet}::contains (NFC)

Kazu Hirata llvmlistbot at llvm.org
Sun Aug 27 13:23:42 PDT 2023


Author: Kazu Hirata
Date: 2023-08-27T13:23:36-07:00
New Revision: 69ffd49c434f795af5dd5d39e102c41afeab1d16

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

LOG: [mlir] Use {DenseSet,DenseMap,SemallDenseSet}::contains (NFC)

Added: 
    

Modified: 
    mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
    mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
    mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
index b23a2cce35cee3..072e858220feae 100644
--- a/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/SuperVectorize.cpp
@@ -929,8 +929,7 @@ isVectorizableLoopPtrFactory(const DenseSet<Operation *> &parallelLoops,
                              int fastestVaryingMemRefDimension) {
   return [&parallelLoops, fastestVaryingMemRefDimension](Operation &forOp) {
     auto loop = cast<AffineForOp>(forOp);
-    auto parallelIt = parallelLoops.find(loop);
-    if (parallelIt == parallelLoops.end())
+    if (!parallelLoops.contains(loop))
       return false;
     int memRefDim = -1;
     auto vectorizableBody =

diff  --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
index db7550d7d99fa7..cc1c78595a16e2 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
@@ -812,7 +812,7 @@ void AsyncToAsyncRuntimePass::runOnOperation() {
   runtimeTarget.addDynamicallyLegalOp<cf::AssertOp>(
       [&](cf::AssertOp op) -> bool {
         auto func = op->getParentOfType<func::FuncOp>();
-        return coros->find(func) == coros->end();
+        return !coros->contains(func);
       });
 
   if (failed(applyPartialConversion(module, runtimeTarget,
@@ -842,7 +842,7 @@ void mlir::populateAsyncFuncToAsyncRuntimeConversionPatterns(
       [coros](Operation *op) {
         auto exec = op->getParentOfType<ExecuteOp>();
         auto func = op->getParentOfType<func::FuncOp>();
-        return exec || coros->find(func) == coros->end();
+        return exec || !coros->contains(func);
       });
 }
 

diff  --git a/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp b/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp
index 1a6f868cf21df2..f467123f9b33de 100644
--- a/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp
+++ b/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp
@@ -49,7 +49,7 @@ getInputsOfCluster(const llvm::SmallVector<Operation *, 8> &cluster) {
   for (Operation *op : cluster) {
     for (Value operand : op->getOperands()) {
       Operation *operandOp = operand.getDefiningOp();
-      if (opSet.find(operandOp) != opSet.end()) {
+      if (opSet.contains(operandOp)) {
         // Skip if defining op is in the cluster.
         continue;
       }


        


More information about the Mlir-commits mailing list