diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2020-09-29 09:33:55 -0400 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2020-10-16 11:05:02 -0400 |
commit | 0a7cd99a702595ccf73c957be0127af9f25fb9a2 (patch) | |
tree | 01837b082bd0229afc320b4371fe3558b1a9758f /llvm/lib/Transforms/Utils/ValueMapper.cpp | |
parent | 97533b10b27db058cc77c81a4f964b66392871c6 (diff) | |
download | llvm-0a7cd99a702595ccf73c957be0127af9f25fb9a2.zip llvm-0a7cd99a702595ccf73c957be0127af9f25fb9a2.tar.gz llvm-0a7cd99a702595ccf73c957be0127af9f25fb9a2.tar.bz2 |
Reapply "OpaquePtr: Add type to sret attribute"
This reverts commit eb9f7c28e5fe6d75fed3587023e17f2997c8024b.
Previously this was incorrectly handling linking of the contained
type, so this merges the fixes from D88973.
Diffstat (limited to 'llvm/lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index f1b3fe8e..b2cb8cb 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -900,14 +900,13 @@ void Mapper::remapInstruction(Instruction *I) { LLVMContext &C = CB->getContext(); AttributeList Attrs = CB->getAttributes(); for (unsigned i = 0; i < Attrs.getNumAttrSets(); ++i) { - if (Attrs.hasAttribute(i, Attribute::ByVal)) { - Type *Ty = Attrs.getAttribute(i, Attribute::ByVal).getValueAsType(); - if (!Ty) - continue; - - Attrs = Attrs.removeAttribute(C, i, Attribute::ByVal); - Attrs = Attrs.addAttribute( - C, i, Attribute::getWithByValType(C, TypeMapper->remapType(Ty))); + for (Attribute::AttrKind TypedAttr : + {Attribute::ByVal, Attribute::StructRet}) { + if (Type *Ty = Attrs.getAttribute(i, TypedAttr).getValueAsType()) { + Attrs = Attrs.replaceAttributeType(C, i, TypedAttr, + TypeMapper->remapType(Ty)); + break; + } } } CB->setAttributes(Attrs); |