[Mlir-commits] [mlir] [mlir] Avoid repeated map lookups (NFC) (PR #113074)

Kazu Hirata llvmlistbot at llvm.org
Sun Oct 20 08:51:14 PDT 2024


================
@@ -1160,9 +1160,8 @@ bool mlir::sparse_tensor::isBlockSparsity(AffineMap dimToLvl) {
     } else if (auto dimOp = dyn_cast<AffineDimExpr>(result)) {
       auto pos = dimOp.getPosition();
       // Expect dim to be unset.
-      if (coeffientMap.find(pos) != coeffientMap.end())
+      if (!coeffientMap.try_emplace(pos).second)
----------------
kazutakahirata wrote:

Done.  Thanks!

https://github.com/llvm/llvm-project/pull/113074


More information about the Mlir-commits mailing list