[Mlir-commits] [mlir] a4819d6 - [mlir] Simplify code with StringMap::operator[] (NFC) (#115427)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Nov 8 07:34:36 PST 2024


Author: Kazu Hirata
Date: 2024-11-08T07:34:31-08:00
New Revision: a4819d6aa30f849770c258abba67a4b721642ebf

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

LOG: [mlir] Simplify code with StringMap::operator[] (NFC) (#115427)

Added: 
    

Modified: 
    mlir/lib/IR/MLIRContext.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp
index d33340f4aefc85..b9e745fdf4a13e 100644
--- a/mlir/lib/IR/MLIRContext.cpp
+++ b/mlir/lib/IR/MLIRContext.cpp
@@ -986,8 +986,7 @@ void RegisteredOperationName::insert(
   }
   StringRef name = impl->getName().strref();
   // Insert the operation info if it doesn't exist yet.
-  auto it = ctxImpl.operations.insert({name, nullptr});
-  it.first->second = std::move(ownedImpl);
+  ctxImpl.operations[name] = std::move(ownedImpl);
 
   // Update the registered info for this operation.
   auto emplaced = ctxImpl.registeredOperations.try_emplace(


        


More information about the Mlir-commits mailing list