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

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 15 06:25:56 PST 2021


nikic added a comment.

I like the general direction. A possible reframing would be SmallAttrBuilder -> MutableAttributeSet. I think my main question here would be in which contexts we still use / want to use the old AttrBuilder?



================
Comment at: llvm/include/llvm/IR/Attributes.h:974
+  SmallVector<Attribute> EnumAttrs;
+  SmallVector<Attribute> StringAttrs;
+  using iterator = typename SmallVector<Attribute>::iterator;
----------------
Just wondering if storing both in one vector would make sense? Would allow reusing the normal comparison on attributes and generally simplify the code. Or is that noticeably less efficient?


================
Comment at: llvm/include/llvm/IR/Attributes.h:1125
+  }
+  std::pair<ArrayRef<Attribute>, ArrayRef<Attribute>> uniquify() const {
+    return std::make_pair(ArrayRef<Attribute>(EnumAttrs),
----------------
What is uniquify() supposed to mean in this context?


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

https://reviews.llvm.org/D115798



More information about the cfe-commits mailing list