[all-commits] [llvm/llvm-project] 8f4c78: [IR] Use map for string attributes (NFC)
Nikita Popov via All-commits
all-commits at lists.llvm.org
Sun Apr 26 00:41:22 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 8f4c78dcf8a454a2a8a0fa04fe34e2162efd4a5c
https://github.com/llvm/llvm-project/commit/8f4c78dcf8a454a2a8a0fa04fe34e2162efd4a5c
Author: Nikita Popov <nikita.ppv at gmail.com>
Date: 2020-04-26 (Sun, 26 Apr 2020)
Changed paths:
M llvm/lib/IR/AttributeImpl.h
M llvm/lib/IR/Attributes.cpp
Log Message:
-----------
[IR] Use map for string attributes (NFC)
Attributes are currently stored as a simple list. Enum attributes
additionally use a bitset to allow quickly determining whether an
attribute is set. String attributes on the other hand require a
full scan of the list. As functions tend to have a lot of string
attributes (at least when clang is used), this is a noticeable
performance issue.
This patch adds an additional name => attribute map to the
AttributeSetNode, which allows querying string attributes quickly.
This results in a 3% reduction in instructions retired on CTMark.
Changes to memory usage seem to be in the noise (attribute sets are
uniqued, and we don't tend to have more than a few dozen or hundred
unique attribute sets, so adding an extra map does not have a
noticeable cost.)
Differential Revision: https://reviews.llvm.org/D78859
More information about the All-commits
mailing list