[Mlir-commits] [mlir] aef4ec0 - Change the identifier table in MLIRContext to use StringSet instead of

Chris Lattner llvmlistbot at llvm.org
Sat Apr 11 22:07:46 PDT 2020


Author: Chris Lattner
Date: 2020-04-11T22:07:39-07:00
New Revision: aef4ec00f996b6b7e5174443ca7db465eb0fae52

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

LOG: Change the identifier table in MLIRContext to use StringSet instead of
StringMap<char>, saving a byte due to the StringMapEntry specialization
for a value of NoneType.  NFC.

Added: 
    

Modified: 
    mlir/lib/IR/MLIRContext.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/MLIRContext.cpp b/mlir/lib/IR/MLIRContext.cpp
index a3534bc62ace..b53b8b4e4782 100644
--- a/mlir/lib/IR/MLIRContext.cpp
+++ b/mlir/lib/IR/MLIRContext.cpp
@@ -28,7 +28,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/SetVector.h"
-#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/CommandLine.h"
@@ -210,7 +210,7 @@ class MLIRContextImpl {
   DenseMap<TypeID, Dialect *> registeredDialectSymbols;
 
   /// These are identifiers uniqued into this MLIRContext.
-  llvm::StringMap<char, llvm::BumpPtrAllocator &> identifiers;
+  llvm::StringSet<llvm::BumpPtrAllocator &> identifiers;
 
   //===--------------------------------------------------------------------===//
   // Affine uniquing
@@ -511,7 +511,7 @@ Identifier Identifier::get(StringRef str, MLIRContext *context) {
 
   // Acquire a writer-lock so that we can safely create the new instance.
   llvm::sys::SmartScopedWriter<true> contextLock(impl.identifierMutex);
-  auto it = impl.identifiers.insert({str, char()}).first;
+  auto it = impl.identifiers.insert(str).first;
   return Identifier(it->getKeyData());
 }
 


        


More information about the Mlir-commits mailing list