diff options
author | Teresa Johnson <tejohnson@google.com> | 2019-11-05 14:00:58 -0800 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2019-11-05 16:32:48 -0800 |
commit | b36e3a8bac3ee95a5a67ab0acb6ef2a2602226a7 (patch) | |
tree | 8ed01fd3bbd81173898f3d07a7083f192674fa0a /llvm/lib/Linker | |
parent | e0dd8f36ce49f47099e56e317207de5304a1ccbb (diff) | |
download | bcm5719-llvm-b36e3a8bac3ee95a5a67ab0acb6ef2a2602226a7.tar.gz bcm5719-llvm-b36e3a8bac3ee95a5a67ab0acb6ef2a2602226a7.zip |
[IRMover] Set Address Space for moved global values
Summary:
Set Address Space when creating a new function (from another).
Fix PR41154.
Patch by Ehud Katz <ehudkatz@gmail.com>
Reviewers: tejohnson, chandlerc
Reviewed By: tejohnson
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69361
Diffstat (limited to 'llvm/lib/Linker')
-rw-r--r-- | llvm/lib/Linker/IRMover.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp index 1cef0e84a30..1b17d825b98 100644 --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -654,9 +654,9 @@ AttributeList IRLinker::mapAttributeTypes(LLVMContext &C, AttributeList Attrs) { Function *IRLinker::copyFunctionProto(const Function *SF) { // If there is no linkage to be performed or we are linking from the source, // bring SF over. - auto *F = - Function::Create(TypeMap.get(SF->getFunctionType()), - GlobalValue::ExternalLinkage, SF->getName(), &DstM); + auto *F = Function::Create(TypeMap.get(SF->getFunctionType()), + GlobalValue::ExternalLinkage, + SF->getAddressSpace(), SF->getName(), &DstM); F->copyAttributesFrom(SF); F->setAttributes(mapAttributeTypes(F->getContext(), F->getAttributes())); return F; @@ -695,7 +695,8 @@ GlobalValue *IRLinker::copyGlobalValueProto(const GlobalValue *SGV, else if (SGV->getValueType()->isFunctionTy()) NewGV = Function::Create(cast<FunctionType>(TypeMap.get(SGV->getValueType())), - GlobalValue::ExternalLinkage, SGV->getName(), &DstM); + GlobalValue::ExternalLinkage, SGV->getAddressSpace(), + SGV->getName(), &DstM); else NewGV = new GlobalVariable(DstM, TypeMap.get(SGV->getValueType()), |