diff options
author | Andy Kaylor <andrew.kaylor@intel.com> | 2021-09-03 18:24:09 -0700 |
---|---|---|
committer | Andy Kaylor <andrew.kaylor@intel.com> | 2021-09-07 11:41:43 -0700 |
commit | 34528c32d23f98312434bb8d67510bef616e5b44 (patch) | |
tree | b1fd0ba1de0815dcc908db31ad2184864a00a033 /llvm/lib/Transforms/Utils/ValueMapper.cpp | |
parent | abd80ecf6ed8f013b8c78fb00a2637dfc81e50cb (diff) | |
download | llvm-34528c32d23f98312434bb8d67510bef616e5b44.zip llvm-34528c32d23f98312434bb8d67510bef616e5b44.tar.gz llvm-34528c32d23f98312434bb8d67510bef616e5b44.tar.bz2 |
Copy Elementtype Attribute to IR at Link step
Copying IR during linking causes a type mismatch due to the field being missing in IRMover/Valuemapper. Adds the full range of typed attributes including elementtype attribute in the copy functions.
Patch by Chenyang Liu
Differential Revision: https://reviews.llvm.org/D108796
Diffstat (limited to 'llvm/lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index c3093be..468c044 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -944,9 +944,9 @@ void Mapper::remapInstruction(Instruction *I) { LLVMContext &C = CB->getContext(); AttributeList Attrs = CB->getAttributes(); for (unsigned i = 0; i < Attrs.getNumAttrSets(); ++i) { - for (Attribute::AttrKind TypedAttr : - {Attribute::ByVal, Attribute::StructRet, Attribute::ByRef, - Attribute::InAlloca}) { + for (int AttrIdx = Attribute::FirstTypeAttr; + AttrIdx <= Attribute::LastTypeAttr; AttrIdx++) { + Attribute::AttrKind TypedAttr = (Attribute::AttrKind)AttrIdx; if (Type *Ty = Attrs.getAttributeAtIndex(i, TypedAttr).getValueAsType()) { Attrs = Attrs.replaceAttributeTypeAtIndex(C, i, TypedAttr, |