llvm.org GIT mirror llvm / 00dace8
Merging r168197: into 3.2 release branch Preserve address space of forward-referenced global variables in the LL parser Before, the parser would assert on the following code: @a2 = global i8 addrspace(1)* @a @a = addrspace(1) global i8 0 because the type of @a was "i8*" instead of "i8 addrspace(1)*" when parsing the initializer for @a2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168435 91177308-0d34-0410-b5e6-96231b3b80d8 Pawel Wodnicki 6 years ago
2 changed file(s) with 11 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
778778 FwdVal = Function::Create(FT, GlobalValue::ExternalWeakLinkage, Name, M);
779779 else
780780 FwdVal = new GlobalVariable(*M, PTy->getElementType(), false,
781 GlobalValue::ExternalWeakLinkage, 0, Name);
781 GlobalValue::ExternalWeakLinkage, 0, Name,
782 0, GlobalVariable::NotThreadLocal,
783 PTy->getAddressSpace());
782784
783785 ForwardRefVals[Name] = std::make_pair(FwdVal, Loc);
784786 return FwdVal;
0 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
1
2 ; Make sure the address space of forward decls is preserved
3
4 ; CHECK: @a2 = global i8 addrspace(1)* @a
5 ; CHECK: @a = addrspace(1) global i8 0
6 @a2 = global i8 addrspace(1)* @a
7 @a = addrspace(1) global i8 0