Pawel,<div><br></div><div>Can we get this merged into 3.2? I'm not sure who the code owner for the LL parser is.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 16, 2012 at 4:03 PM, Justin Holewinski <span dir="ltr"><<a href="mailto:jholewinski@nvidia.com" target="_blank">jholewinski@nvidia.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jholewinski<br>
Date: Fri Nov 16 15:03:47 2012<br>
New Revision: 168197<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=168197&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=168197&view=rev</a><br>
Log:<br>
Preserve address space of forward-referenced global variables in the LL parser<br>
<br>
Before, the parser would assert on the following code:<br>
<br>
@a2 = global i8 addrspace(1)* @a<br>
@a = addrspace(1) global i8 0<br>
<br>
because the type of @a was "i8*" instead of "i8 addrspace(1)*" when parsing<br>
the initializer for @a2.<br>
<br>
Added:<br>
llvm/trunk/test/Assembler/global-addrspace-forwardref.ll<br>
Modified:<br>
llvm/trunk/lib/AsmParser/LLParser.cpp<br>
<br>
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=168197&r1=168196&r2=168197&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=168197&r1=168196&r2=168197&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)<br>
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Fri Nov 16 15:03:47 2012<br>
@@ -779,7 +779,9 @@<br>
FwdVal = Function::Create(FT, GlobalValue::ExternalWeakLinkage, Name, M);<br>
else<br>
FwdVal = new GlobalVariable(*M, PTy->getElementType(), false,<br>
- GlobalValue::ExternalWeakLinkage, 0, Name);<br>
+ GlobalValue::ExternalWeakLinkage, 0, Name,<br>
+ 0, GlobalVariable::NotThreadLocal,<br>
+ PTy->getAddressSpace());<br>
<br>
ForwardRefVals[Name] = std::make_pair(FwdVal, Loc);<br>
return FwdVal;<br>
<br>
Added: llvm/trunk/test/Assembler/global-addrspace-forwardref.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/global-addrspace-forwardref.ll?rev=168197&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/global-addrspace-forwardref.ll?rev=168197&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/Assembler/global-addrspace-forwardref.ll (added)<br>
+++ llvm/trunk/test/Assembler/global-addrspace-forwardref.ll Fri Nov 16 15:03:47 2012<br>
@@ -0,0 +1,8 @@<br>
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s<br>
+<br>
+; Make sure the address space of forward decls is preserved<br>
+<br>
+; CHECK: @a2 = global i8 addrspace(1)* @a<br>
+; CHECK: @a = addrspace(1) global i8 0<br>
+@a2 = global i8 addrspace(1)* @a<br>
+@a = addrspace(1) global i8 0<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div><br>
</div>