[PATCH] D79744: clang: Add address space to indirect abi info and use it for kernels

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 13 15:16:53 PDT 2020


arsenm added a comment.

In D79744#2035109 <https://reviews.llvm.org/D79744#2035109>, @arsenm wrote:

>




>> Unfortunately, I think `byval` just doesn't match what you want because of the mutability — the frontend *has* to have a copy into a local to get IR with correct semantics, because `byval` is assumed to be locally mutable by both IR-generation and (potentially) LLVM optimization.  And I don't think you really want non-`byval` indirect.  So I guess the question is what we can do in the frontend to get the optimizer behavior you need.
> 
> You are allowed to have readonly on a byval pointer argument, in which case optimizations wouldn't be allowed to write into it. Is just adding readonly parameter attributes sufficient? It would be somewhat contrived, but could also define byval as constant if it's not in the alloca address space.

Another option is to add a form of indirect argument passing that just from a constant offset from an intrinsic call. We would still need to leave an unused struct argument in the function argument list for size keeping, and lose the ability to add an explicit alignment. We would also be mixing multiple ways of accessing arguments which is gross but survivable.


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

https://reviews.llvm.org/D79744





More information about the cfe-commits mailing list