<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 20, 2016 at 9:01 PM, Justin Lebar <span dir="ltr"><<a href="mailto:jlebar@google.com" target="_blank">jlebar@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Matt, I thought about making this pass generic, but as written it doesn't make much sense if you don't follow it with the equivalent of the NVPTX address space inference pass.</p>
<p dir="ltr">David, I will meditate on this...</p></blockquote><div><br></div><div>If you want, you could treat this as a data flow problem (treat loads/stores/cmpxchgs/atomicrmws of your addrspacecast'd GEP as sources, propagate that information across CFG edges, etc.).  Then you can know if a block is dominated by blocks where the transform is known to be safe.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br><div class="gmail_quote">On Aug 20, 2016 8:40 PM, "Matt Arsenault" <<a href="mailto:Matthew.Arsenault@amd.com" target="_blank">Matthew.Arsenault@amd.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">arsenm added a subscriber: arsenm.<br>
<br>
================<br>
Comment at: llvm/lib/Target/NVPTX/NVPTXHoi<wbr>stAddrSpaceCast.cpp:156-160<br>
@@ +155,7 @@<br>
+    if (AddrSpaceCastInst *ASC = dyn_cast<AddrSpaceCastInst>(&I<wbr>))<br>
+      if (ASC->getSrcAddressSpace() == AddressSpace::ADDRESS_SPACE_GE<wbr>NERIC &&<br>
+          ASC->getDestAddressSpace() != AddressSpace::ADDRESS_SPACE_GE<wbr>NERIC &&<br>
+          ASC->getSrcTy()->getPointerEle<wbr>mentType() ==<br>
+              ASC->getDestTy()->getPointerEl<wbr>ementType())<br>
+        Worklist.push_back(ASC);<br>
+<br>
----------------<br>
Can you put this into a TTI hook?<br>
<br>
<br>
<a href="https://reviews.llvm.org/D23749" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2374<wbr>9</a><br>
<br>
<br>
<br>
</blockquote></div></div>
</div></div></blockquote></div><br></div></div>