[PATCH] D78859: [IR] Use map for string attributes (NFC)
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 25 10:04:50 PDT 2020
nikic marked an inline comment as done.
nikic added inline comments.
================
Comment at: lib/IR/AttributeImpl.h:185
+ DenseMap<StringRef, Attribute> StringAttrs;
+
----------------
arsenm wrote:
> Is StringMap any better?
I believe StringMap is only useful if the map needs to own the string. In this case the string is already owned by the Attribute. (StringMap allocates each map entry separately, as strings are variable-length.)
There's also CachedHashStringRef that can be used here, but I don't think that's useful either, because the map is immutable, so we do not need to worry about rehashing overhead.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78859/new/
https://reviews.llvm.org/D78859
More information about the llvm-commits
mailing list