<div dir="ltr"><div>Hi Phillip, </div><div><br></div><div>Thanks for your comments! They do make a lot of sense. </div><div><br></div><div>I wasn't here when the addrspacecast instruction was added. Maybe Matt can provide more context on why addrspacecast is a superset of bitcast. However, I don't see too much value of including the semantics of bitcast besides making bitcode more compact. </div>
<div><br></div><div>With that, I would be more than happy to work on having clang emitting both of them. But even with changes in clang, I think instcombine would still need this canonicalization to handle IR not directly generated by clang. </div>
<div><br></div><div>Best,</div><div>Jingyue</div><div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 4, 2014 at 10:59 AM, Philip Reames <span dir="ltr"><<a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm reading this commit out of context, so this question might not make a lot of sense. If that's the case, please ignore.<br>
<br>
If we are canonicalizing addrspacecasts to only convert between address spaces and not types, is there any value in having addrspacecast be a superset of bitcast to begin with? Why not have the frontend emit both the addrspacecast and the bitcast itself?<br>
<br>
Philip<div><div class="h5"><br>
<br>
<br>
On 06/03/2014 06:48 PM, Matt Arsenault wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
LGTM<br>
<br>
================<br>
Comment at: lib/Transforms/InstCombine/<u></u>InstCombineCasts.cpp:1925-1926<br>
@@ +1924,4 @@<br>
+<br>
+ // Putting bitcast before addrspacecast helps NVPTXFavorNonGenericAddrSpaces<br>
+ // to fold the addrspacecast into load/store.<br>
+ Value *NewBitCast = Builder->CreateBitCast(Src, MidTy);<br>
----------------<br>
I would remove the comment about a specific target pass<br>
<br>
<a href="http://reviews.llvm.org/D4013" target="_blank">http://reviews.llvm.org/D4013</a><br>
<br>
<br>
<br></div></div>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">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/<u></u>mailman/listinfo/llvm-commits</a><br>
</blockquote>
<br>
</blockquote></div><br></div>