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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Oct 6 19:33:22 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/111328.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp (+3-2) 


``````````diff
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);

``````````

</details>


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


More information about the Mlir-commits mailing list