[Mlir-commits] [mlir] 51c9f12 - [mlir] Use StringMap::lookup (NFC)

Kazu Hirata llvmlistbot at llvm.org
Sat Aug 19 00:05:38 PDT 2023


Author: Kazu Hirata
Date: 2023-08-19T00:05:32-07:00
New Revision: 51c9f12a520ecab39f735c280fd3675c85801a68

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

LOG: [mlir] Use StringMap::lookup (NFC)

Added: 
    

Modified: 
    mlir/include/mlir/IR/ExtensibleDialect.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/ExtensibleDialect.h b/mlir/include/mlir/IR/ExtensibleDialect.h
index 9a35077017e436..e4d8d2d6000fc6 100644
--- a/mlir/include/mlir/IR/ExtensibleDialect.h
+++ b/mlir/include/mlir/IR/ExtensibleDialect.h
@@ -545,10 +545,7 @@ class ExtensibleDialect : public mlir::Dialect {
 
   /// Returns nullptr if the definition was not found.
   DynamicTypeDefinition *lookupTypeDefinition(StringRef name) const {
-    auto it = nameToDynTypes.find(name);
-    if (it == nameToDynTypes.end())
-      return nullptr;
-    return it->second;
+    return nameToDynTypes.lookup(name);
   }
 
   /// Returns nullptr if the definition was not found.
@@ -561,10 +558,7 @@ class ExtensibleDialect : public mlir::Dialect {
 
   /// Returns nullptr if the definition was not found.
   DynamicAttrDefinition *lookupAttrDefinition(StringRef name) const {
-    auto it = nameToDynAttrs.find(name);
-    if (it == nameToDynAttrs.end())
-      return nullptr;
-    return it->second;
+    return nameToDynAttrs.lookup(name);
   }
 
   /// Returns nullptr if the definition was not found.


        


More information about the Mlir-commits mailing list