[PATCH] D108796: Copy Elementtype Attribute to IR at Link step

Chenyang Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 27 10:51:12 PDT 2021


chenyang.liu added inline comments.


================
Comment at: llvm/lib/Linker/IRMover.cpp:653
          {Attribute::ByVal, Attribute::StructRet, Attribute::ByRef,
-          Attribute::InAlloca}) {
+          Attribute::InAlloca, Attribute::ElementType}) {
       if (Attrs.hasAttribute(i, TypedAttr)) {
----------------
nikic wrote:
> You can use FirstTypeAttr and LastTypeAttr to generalize this.
I can do it like this if you think it's ok:

    for (unsigned i = 0; i < Attrs.getNumAttrSets(); ++i) {
      auto Attr = Attrs.getAttribute(i);
      if (Attr.isTypeAttribute()) {
        auto TypedAttr = Attr.getKindAsEnum();
        if (Type *Ty = Attrs.getAttribute(i, TypedAttr).getValueAsType()) {
          Attrs = Attrs.replaceAttributeType(C, i, TypedAttr, TypeMap.get(Ty));
          break;


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108796



More information about the llvm-commits mailing list