[Mlir-commits] [mlir] 56c7fba - [mlir] Use DenseMapBase::lookup (NFC)

Kazu Hirata llvmlistbot at llvm.org
Wed Jun 14 22:04:54 PDT 2023


Author: Kazu Hirata
Date: 2023-06-14T22:04:37-07:00
New Revision: 56c7fba4a7cfb023f2471daf131cecd34c8c781e

URL: https://github.com/llvm/llvm-project/commit/56c7fba4a7cfb023f2471daf131cecd34c8c781e
DIFF: https://github.com/llvm/llvm-project/commit/56c7fba4a7cfb023f2471daf131cecd34c8c781e.diff

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

Added: 
    

Modified: 
    mlir/lib/IR/MLIRContext.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp
index def85a52c6888..cf355703aaf47 100644
--- a/mlir/lib/IR/MLIRContext.cpp
+++ b/mlir/lib/IR/MLIRContext.cpp
@@ -718,10 +718,7 @@ const AbstractAttribute &AbstractAttribute::lookup(TypeID typeID,
 AbstractAttribute *AbstractAttribute::lookupMutable(TypeID typeID,
                                                     MLIRContext *context) {
   auto &impl = context->getImpl();
-  auto it = impl.registeredAttributes.find(typeID);
-  if (it == impl.registeredAttributes.end())
-    return nullptr;
-  return it->second;
+  return impl.registeredAttributes.lookup(typeID);
 }
 
 //===----------------------------------------------------------------------===//
@@ -930,10 +927,7 @@ const AbstractType &AbstractType::lookup(TypeID typeID, MLIRContext *context) {
 
 AbstractType *AbstractType::lookupMutable(TypeID typeID, MLIRContext *context) {
   auto &impl = context->getImpl();
-  auto it = impl.registeredTypes.find(typeID);
-  if (it == impl.registeredTypes.end())
-    return nullptr;
-  return it->second;
+  return impl.registeredTypes.lookup(typeID);
 }
 
 //===----------------------------------------------------------------------===//


        


More information about the Mlir-commits mailing list