[PATCH] D115798: Provide SmallAttrBuilder as a lightweight alternative to AttrBuilder

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 09:14:21 PST 2021


rnk added a comment.

I would really prefer to avoid adding a new variant of AttrBuilder. What is the main blocker to making AttrBuilder more efficient? It just needs an `LLVMContext`, right? Would that be feasible instead? Most AttrBuilders are constructed from existing AttributeLists, which have a context.

> Internally it maintains two SmallVector of sorted Attributes, which turns out to
> be more efficient than temporary hashmap and bitfields as used by AttrBuilder.

Surely the bitset is more efficient than a vector of attributes. I think it's the `std::map<SmallString, SmallString>` that's slow. I think replacing that with a sorted vector of hashed string attributes would be just as efficient.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115798/new/

https://reviews.llvm.org/D115798



More information about the llvm-commits mailing list