[PATCH] D116032: Avoid useless AttrBuilder conversion

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 20 05:52:41 PST 2021


nikic added inline comments.


================
Comment at: llvm/include/llvm/IR/Attributes.h:455
+                           AttributeSet AS);
   static AttributeList get(LLVMContext &C, unsigned Index,
                            ArrayRef<Attribute::AttrKind> Kinds,
----------------
Duplicate declaration with a few lines below, due to a similar change I landed earlier today (https://github.com/llvm/llvm-project/commit/6e30cb7673df293fd294acef7eadca8050b5a71e).


================
Comment at: llvm/include/llvm/IR/Attributes.h:490
+                                                    unsigned Index,
+                                                    AttributeSet AS) const;
 
----------------
I'm not sure I understand the benefit of this method, and similar ones below. In the end, won't we still convert this AttributeSet into an AttrBuilder for merging?

I think the only case where this could make a difference is if the Index is currently unused, in which case the original attribute set can be directly used. Is this the case being optimized?


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

https://reviews.llvm.org/D116032



More information about the llvm-commits mailing list