<html><body><div>I don't know Matt's intent here, but some GPUs support accessing local memory via a memory mapping inside global memory, in addition to via direct access.  This has the nice benefit of still allowing direct access (which might be more efficient) while simplifying the programming model by allowing precompiled functions with pointer parameters not to have to be specialized for each address space.<br><br>--Owen<br><br>On Jan 14, 2014, at 04:15 PM, Rafael Espíndola <rafael.espindola@gmail.com> wrote:<br><br></div><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch">Sorry I missed this before.<br> <br> Why do you need this? Aliases are just another name for a given<br> position, so it seems strange to have the same position being in two<br> address spaces.<br> <br> How do you see this interacting with the proposed solution for<br> <a href="http://llvm.org/bugs/show_bug.cgi?id=10367" data-mce-href="http://llvm.org/bugs/show_bug.cgi?id=10367">http://llvm.org/bugs/show_bug.cgi?id=10367</a>?<br> <br> On 2 January 2014 12:55, Matt Arsenault <<a href="mailto:Matthew.Arsenault@amd.com" data-mce-href="mailto:Matthew.Arsenault@amd.com">Matthew.Arsenault@amd.com</a>> wrote:<br><blockquote class="quoted-plain-text" type="cite">Author: arsenm</blockquote><blockquote class="quoted-plain-text" type="cite">Date: Thu Jan 2 14:55:01 2014</blockquote><blockquote class="quoted-plain-text" type="cite">New Revision: 198349</blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=198349&view=rev" data-mce-href="http://llvm.org/viewvc/llvm-project?rev=198349&view=rev">http://llvm.org/viewvc/llvm-project?rev=198349&view=rev</a></blockquote><blockquote class="quoted-plain-text" type="cite">Log:</blockquote><blockquote class="quoted-plain-text" type="cite">Allow addrspacecast in global aliases</blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">Added:</blockquote><blockquote class="quoted-plain-text" type="cite">llvm/trunk/test/Assembler/addrspacecast-alias.ll</blockquote><blockquote class="quoted-plain-text" type="cite">Modified:</blockquote><blockquote class="quoted-plain-text" type="cite">llvm/trunk/lib/IR/Globals.cpp</blockquote><blockquote class="quoted-plain-text" type="cite">llvm/trunk/lib/IR/Verifier.cpp</blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">Modified: llvm/trunk/lib/IR/Globals.cpp</blockquote><blockquote class="quoted-plain-text" type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Globals.cpp?rev=198349&r1=198348&r2=198349&view=diff" data-mce-href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Globals.cpp?rev=198349&r1=198348&r2=198349&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Globals.cpp?rev=198349&r1=198348&r2=198349&view=diff</a></blockquote><blockquote class="quoted-plain-text" type="cite">==============================================================================</blockquote><blockquote class="quoted-plain-text" type="cite">--- llvm/trunk/lib/IR/Globals.cpp (original)</blockquote><blockquote class="quoted-plain-text" type="cite">+++ llvm/trunk/lib/IR/Globals.cpp Thu Jan 2 14:55:01 2014</blockquote><blockquote class="quoted-plain-text" type="cite">@@ -237,7 +237,8 @@ GlobalValue *GlobalAlias::getAliasedGlob</blockquote><blockquote class="quoted-plain-text" type="cite">return GV;</blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">ConstantExpr *CE = cast<ConstantExpr>(C);</blockquote><blockquote class="quoted-plain-text" type="cite">- assert((CE->getOpcode() == Instruction::BitCast ||</blockquote><blockquote class="quoted-plain-text" type="cite">+ assert((CE->getOpcode() == Instruction::BitCast ||</blockquote><blockquote class="quoted-plain-text" type="cite">+ CE->getOpcode() == Instruction::AddrSpaceCast ||</blockquote><blockquote class="quoted-plain-text" type="cite">CE->getOpcode() == Instruction::GetElementPtr) &&</blockquote><blockquote class="quoted-plain-text" type="cite">"Unsupported aliasee");</blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">Modified: llvm/trunk/lib/IR/Verifier.cpp</blockquote><blockquote class="quoted-plain-text" type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=198349&r1=198348&r2=198349&view=diff" data-mce-href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=198349&r1=198348&r2=198349&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=198349&r1=198348&r2=198349&view=diff</a></blockquote><blockquote class="quoted-plain-text" type="cite">==============================================================================</blockquote><blockquote class="quoted-plain-text" type="cite">--- llvm/trunk/lib/IR/Verifier.cpp (original)</blockquote><blockquote class="quoted-plain-text" type="cite">+++ llvm/trunk/lib/IR/Verifier.cpp Thu Jan 2 14:55:01 2014</blockquote><blockquote class="quoted-plain-text" type="cite">@@ -550,9 +550,11 @@ void Verifier::visitGlobalAlias(GlobalAl</blockquote><blockquote class="quoted-plain-text" type="cite">ConstantExpr *CE = dyn_cast<ConstantExpr>(Aliasee);</blockquote><blockquote class="quoted-plain-text" type="cite">Assert1(CE &&</blockquote><blockquote class="quoted-plain-text" type="cite">(CE->getOpcode() == Instruction::BitCast ||</blockquote><blockquote class="quoted-plain-text" type="cite">+ CE->getOpcode() == Instruction::AddrSpaceCast ||</blockquote><blockquote class="quoted-plain-text" type="cite">CE->getOpcode() == Instruction::GetElementPtr) &&</blockquote><blockquote class="quoted-plain-text" type="cite">isa<GlobalValue>(CE->getOperand(0)),</blockquote><blockquote class="quoted-plain-text" type="cite">- "Aliasee should be either GlobalValue or bitcast of GlobalValue",</blockquote><blockquote class="quoted-plain-text" type="cite">+ "Aliasee should be either GlobalValue, bitcast or "</blockquote><blockquote class="quoted-plain-text" type="cite">+ "addrspacecast of GlobalValue",</blockquote><blockquote class="quoted-plain-text" type="cite">&GA);</blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">if (CE->getOpcode() == Instruction::BitCast) {</blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">Added: llvm/trunk/test/Assembler/addrspacecast-alias.ll</blockquote><blockquote class="quoted-plain-text" type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/addrspacecast-alias.ll?rev=198349&view=auto" data-mce-href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/addrspacecast-alias.ll?rev=198349&view=auto">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/addrspacecast-alias.ll?rev=198349&view=auto</a></blockquote><blockquote class="quoted-plain-text" type="cite">==============================================================================</blockquote><blockquote class="quoted-plain-text" type="cite">--- llvm/trunk/test/Assembler/addrspacecast-alias.ll (added)</blockquote><blockquote class="quoted-plain-text" type="cite">+++ llvm/trunk/test/Assembler/addrspacecast-alias.ll Thu Jan 2 14:55:01 2014</blockquote><blockquote class="quoted-plain-text" type="cite">@@ -0,0 +1,6 @@</blockquote><blockquote class="quoted-plain-text" type="cite">+; RUN: llvm-as -disable-output %s</blockquote><blockquote class="quoted-plain-text" type="cite">+</blockquote><blockquote class="quoted-plain-text" type="cite">+; Test that global aliases are allowed to be constant addrspacecast</blockquote><blockquote class="quoted-plain-text" type="cite">+</blockquote><blockquote class="quoted-plain-text" type="cite">+@i = internal addrspace(1) global i8 42</blockquote><blockquote class="quoted-plain-text" type="cite">+@ia = alias internal i8 addrspace(2)* addrspacecast (i8 addrspace(1)* @i to i8 addrspace(2)*)</blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite"></blockquote><blockquote class="quoted-plain-text" type="cite">_______________________________________________</blockquote><blockquote class="quoted-plain-text" type="cite">llvm-commits mailing list</blockquote><blockquote class="quoted-plain-text" type="cite"><a href="mailto:llvm-commits@cs.uiuc.edu" data-mce-href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a></blockquote><blockquote class="quoted-plain-text" type="cite"><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" data-mce-href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></blockquote>_______________________________________________<br> llvm-commits mailing list<br> <a href="mailto:llvm-commits@cs.uiuc.edu" data-mce-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" data-mce-href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></div></div></blockquote></div></body></html>