[LLVMdev] Example for usage of LLVM/Clang/libclc

Dan Liew dan at su-root.co.uk
Thu Feb 5 05:50:05 PST 2015


Hi,

> which works but it produces LLVM IR code for all OpenCL intrinsics
> implemented by libclc along with the kernel I am interested in, is their a
> possibility to avoid this ? and only produce the llvm code for the kernel
> required ?

Mark all functions apart from the kernel entry points with the
internal attribute and then run global dead code elimination (it
should remove most of the unused functions).

You can use the opt tool to do this.

e.g. if you had kernel entry points foo and bar you could run the following

$ opt -internalize-public-api-list=foo,bar -globaldce your_program.bc
> transformed_program.bc

Hope that helps.



More information about the llvm-dev mailing list