[llvm-commits] [llvm] r168197 - in /llvm/trunk: lib/AsmParser/LLParser.cpp test/Assembler/global-addrspace-forwardref.ll
Justin Holewinski
justin.holewinski at gmail.com
Fri Nov 16 16:46:38 PST 2012
Pawel,
Can we get this merged into 3.2? I'm not sure who the code owner for the
LL parser is.
On Fri, Nov 16, 2012 at 4:03 PM, Justin Holewinski
<jholewinski at nvidia.com>wrote:
> Author: jholewinski
> Date: Fri Nov 16 15:03:47 2012
> New Revision: 168197
>
> URL: http://llvm.org/viewvc/llvm-project?rev=168197&view=rev
> Log:
> 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.
>
> Added:
> llvm/trunk/test/Assembler/global-addrspace-forwardref.ll
> Modified:
> llvm/trunk/lib/AsmParser/LLParser.cpp
>
> Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=168197&r1=168196&r2=168197&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
> +++ llvm/trunk/lib/AsmParser/LLParser.cpp Fri Nov 16 15:03:47 2012
> @@ -779,7 +779,9 @@
> FwdVal = Function::Create(FT, GlobalValue::ExternalWeakLinkage, Name,
> M);
> else
> FwdVal = new GlobalVariable(*M, PTy->getElementType(), false,
> - GlobalValue::ExternalWeakLinkage, 0,
> Name);
> + GlobalValue::ExternalWeakLinkage, 0, Name,
> + 0, GlobalVariable::NotThreadLocal,
> + PTy->getAddressSpace());
>
> ForwardRefVals[Name] = std::make_pair(FwdVal, Loc);
> return FwdVal;
>
> Added: llvm/trunk/test/Assembler/global-addrspace-forwardref.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/global-addrspace-forwardref.ll?rev=168197&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/Assembler/global-addrspace-forwardref.ll (added)
> +++ llvm/trunk/test/Assembler/global-addrspace-forwardref.ll Fri Nov 16
> 15:03:47 2012
> @@ -0,0 +1,8 @@
> +; RUN: llvm-as < %s | llvm-dis | FileCheck %s
> +
> +; Make sure the address space of forward decls is preserved
> +
> +; CHECK: @a2 = global i8 addrspace(1)* @a
> +; CHECK: @a = addrspace(1) global i8 0
> + at a2 = global i8 addrspace(1)* @a
> + at a = addrspace(1) global i8 0
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
--
Thanks,
Justin Holewinski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121116/69aea843/attachment.html>
More information about the llvm-commits
mailing list