Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/llvm-remove-addrspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ bool removeAddrspaces(Module &M, AddrspaceRemapFunction ASRemapper)
Name,
(GlobalVariable *)nullptr,
GV->getThreadLocalMode(),
GV->getType()->getAddressSpace());
cast<PointerType>(TypeRemapper.remapType(GV->getType()))->getAddressSpace());
NGV->copyAttributesFrom(GV);
VMap[GV] = NGV;
}
Expand All @@ -276,7 +276,7 @@ bool removeAddrspaces(Module &M, AddrspaceRemapFunction ASRemapper)

auto *NGA = GlobalAlias::create(
TypeRemapper.remapType(GA->getValueType()),
GA->getType()->getPointerAddressSpace(),
cast<PointerType>(TypeRemapper.remapType(GA->getType()))->getAddressSpace(),
GA->getLinkage(),
Name,
&M);
Expand Down
10 changes: 10 additions & 0 deletions test/llvmpasses/remove-addrspaces.ll
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

; RUN: opt --load-pass-plugin=libjulia-codegen%shlibext -passes='RemoveJuliaAddrspaces' -S %s | FileCheck %s --check-prefixes=CHECK,OPAQUE

; COM: check that the addrspace of the global itself is removed
; OPAQUE: @ejl_enz_runtime_exc = external global {}
@ejl_enz_runtime_exc = external addrspace(10) global {}

; COM: check that package image fptrs work
@pjlsys_BoundsError_32 = internal global {} addrspace(10)* ({}***, {} addrspace(10)*, [1 x i64] addrspace(11)*)* null
Expand Down Expand Up @@ -111,6 +114,13 @@ define void @byval_type([1 x {} addrspace(10)*] addrspace(11)* byval([1 x {} add
}


define private fastcc void @diffejulia__mapreduce_97() {
L6:
; OPAQUE: store atomic ptr @ejl_enz_runtime_exc, ptr null unordered
store atomic {} addrspace(10)* @ejl_enz_runtime_exc, {} addrspace(10)* addrspace(10)* null unordered, align 8
unreachable
}

; COM: check that function attributes are preserved on declarations too
declare void @convergent_function() #0
attributes #0 = { convergent }
Expand Down