diff --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp --- a/mlir/lib/IR/MLIRContext.cpp +++ b/mlir/lib/IR/MLIRContext.cpp @@ -24,7 +24,6 @@ #include "mlir/IR/OpImplementation.h" #include "mlir/IR/Types.h" #include "mlir/Support/DebugAction.h" -#include "mlir/Support/ThreadLocalCache.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SetVector.h" @@ -275,10 +274,6 @@ llvm::StringMap, llvm::BumpPtrAllocator &> identifiers; - /// A thread local cache of identifiers to reduce lock contention. - ThreadLocalCache> *>> - localIdentifierCache; /// An allocator used for AbstractAttribute and AbstractType objects. llvm::BumpPtrAllocator abstractDialectSymbolAllocator; @@ -811,26 +806,18 @@ return Identifier(&*insertedIt.first); } - // Check for an existing instance in the local cache. - auto *&localEntry = (*impl.localIdentifierCache)[str]; - if (localEntry) - return Identifier(localEntry); - // Check for an existing identifier in read-only mode. { llvm::sys::SmartScopedReader contextLock(impl.identifierMutex); auto it = impl.identifiers.find(str); - if (it != impl.identifiers.end()) { - localEntry = &*it; - return Identifier(localEntry); - } + if (it != impl.identifiers.end()) + return Identifier(&*it); } // Acquire a writer-lock so that we can safely create the new instance. llvm::sys::SmartScopedWriter contextLock(impl.identifierMutex); auto it = impl.identifiers.insert({str, getDialectOrContext()}).first; - localEntry = &*it; - return Identifier(localEntry); + return Identifier(&*it); } Dialect *Identifier::getDialect() {