[PATCH] D36327: [OpenCL] Allow targets emit optimized pipe functions for power of 2 type sizes

Alexey Bader via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 07:43:30 PDT 2017

bader added a comment.

In https://reviews.llvm.org/D36327#840616, @yaxunl wrote:

> In https://reviews.llvm.org/D36327#839809, @rjmccall wrote:
> > Could you just implement this in SimplifyLibCalls?  I assume there's some way to fill in TargetLibraryInfo appropriately for a platform.  Is that too late for your linking requirements?
> Both the optimized and generic versions of __read_pipe function contains call of other library functions and are complicate enough not to be generated programmatically. amdgpu target does not have the capability to link in library code after LLVM codegen. The linking has to be done before SimplifyLibCalls.

If I understand correctly, SimplifyLibCalls is LLVM IR transformation, so it works before linking and LLVM codegen (e.g. InstCombine passes run this transformation). This pass is doing something similar to what you are trying to achieve for __read_pipe builti-ins: pow(2.0, x) -> llvm.exp2(x).


More information about the cfe-commits mailing list