[PATCH] D54947: [OpenCL][CodeGen] Fix replacing memcpy with addrspacecast

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 29 09:01:37 PST 2018


Anastasia added inline comments.


================
Comment at: lib/CodeGen/CGCall.cpp:3972
+          // we don't want to perform address space cast for it, since that
+          // leads to casting __private * (default addr space in OpenCL) to
+          // __global * which is not valid. Create memcpy call instead.
----------------
sidorovd wrote:
> Anastasia wrote:
> > This statement is incorrect. Private is only default AS in CL versions before 2.0.
> > 
> > I feel this can be expressed simpler. I guess the observation here is that if addr space mismatches it has to generate a copy because even if it would be a generic we can't get what the original specific addr space was? So it's safe to generate a copy.
> > This statement is incorrect. Private is only default AS in CL versions before 2.0.
> You are right, thanks!
> 
> Still I want to leave the comment almost as is, since it creates a link with a previous one on lines 3928-3935.
I feel it doesn't add much value, but rather exactly says what code does. At least this is definitely obvious from this code:
  Create memcpy call if RV is located in an address space different than that of


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54947/new/

https://reviews.llvm.org/D54947





More information about the cfe-commits mailing list