[PATCH] D69361: [IRMover] Set Address Space for moved global values
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 5 16:36:42 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb36e3a8bac3e: [IRMover] Set Address Space for moved global values (authored by tejohnson).
Changed prior to commit:
https://reviews.llvm.org/D69361?vs=226845&id=227983#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69361/new/
https://reviews.llvm.org/D69361
Files:
llvm/lib/Linker/IRMover.cpp
llvm/test/Linker/addrspace.ll
Index: llvm/test/Linker/addrspace.ll
===================================================================
--- /dev/null
+++ llvm/test/Linker/addrspace.ll
@@ -0,0 +1,12 @@
+; RUN: llvm-link %s -S | FileCheck %s
+
+ at G = addrspace(2) global i32 256
+; CHECK: @G = addrspace(2) global i32
+
+ at GA = alias i32, i32 addrspace(2)* @G
+; CHECK: @GA = alias i32, i32 addrspace(2)* @G
+
+define void @foo() addrspace(3) {
+; CHECK: define void @foo() addrspace(3)
+ ret void
+}
Index: llvm/lib/Linker/IRMover.cpp
===================================================================
--- llvm/lib/Linker/IRMover.cpp
+++ llvm/lib/Linker/IRMover.cpp
@@ -654,9 +654,9 @@
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 @@
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()),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69361.227983.patch
Type: text/x-patch
Size: 1768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191106/07c0e4bd/attachment.bin>
More information about the llvm-commits
mailing list