Skip to content

Commit d0fb4de

Browse files
committed
Comment why we don't use a DenseMap of StringAttr
1 parent b6e0cfc commit d0fb4de

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mlir/lib/IR/MLIRContext.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ class MLIRContextImpl {
214214

215215
/// This is a mapping from type name to the abstract type describing it.
216216
/// It is used by `AbstractType::lookup` to get an `AbstractType` from a name.
217+
/// As this map needs to be populated before `StringAttr` is loaded, we
218+
/// cannot use `StringAttr` as the key, which would avoid string duplication.
217219
llvm::StringMap<AbstractType *> nameToType;
218220

219221
/// Cached Type Instances.
@@ -243,6 +245,8 @@ class MLIRContextImpl {
243245
/// This is a mapping from attribute name to the abstract attribute describing
244246
/// it. It is used by `AbstractType::lookup` to get an `AbstractType` from a
245247
/// name.
248+
/// As this map needs to be populated before `StringAttr` is loaded, we
249+
/// cannot use `StringAttr` as the key, which would avoid string duplication.
246250
llvm::StringMap<AbstractAttribute *> nameToAttribute;
247251

248252
/// Cached Attribute Instances.

0 commit comments

Comments
 (0)