[Mlir-commits] [mlir] [Linalg] Avoid repeated hash lookups (NFC) (PR #111328)

Kazu Hirata llvmlistbot at llvm.org
Sun Oct 6 19:32:50 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/111328

None

>From d8698249b2cbd93605712768627540fac8f57fab Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 6 Oct 2024 09:28:01 -0700
Subject: [PATCH] [Linalg] Avoid repeated hash lookups (NFC)

---
 mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
index 0b5191664a9e2f..40795879c3026d 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp
@@ -521,8 +521,9 @@ struct ConvAccessExprWalker
         unConvolvedDims.erase(dimPos);
         // If a duplicate dim is marked as convolved, the pair of the duplicate
         // dim must be removed from the map as well.
-        if (convolvedDimMapping.contains(dimPos)) {
-          int64_t pairedDim = convolvedDimMapping[dimPos];
+        auto it = convolvedDimMapping.find(dimPos);
+        if (it != convolvedDimMapping.end()) {
+          int64_t pairedDim = it->second;
           convolvedDims.erase(pairedDim);
           unConvolvedDims.erase(pairedDim);
           strideAndDilationMapping.erase(pairedDim);



More information about the Mlir-commits mailing list