[PATCH] D58277: [OpenCL] Change type of block pointer for OpenCL

Alexey Sotkin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 15 03:46:41 PST 2019


AlexeySotkin created this revision.
AlexeySotkin added reviewers: Anastasia, yaxunl, svenvh.
Herald added a project: clang.

For some reason OpenCL blocks in LLVM IR are represented as function pointers.
These pointers do not point to any real function and never get called. Actually
they point to some structure, which in turn contains pointer to the real block
invoke function.
This patch changes represntation of OpenCL blocks in LLVM IR from function
pointers to pointers to `%struct.__block_literal_generic`.
Such representation allows to avoid unnecessary bitcasts and simplifies
further processing (e.g. translation to SPIR-V ) of the module for targets
which do not support function pointers.


Repository:
  rC Clang

https://reviews.llvm.org/D58277

Files:
  lib/CodeGen/CodeGenTypes.cpp
  test/CodeGenOpenCL/blocks.cl
  test/CodeGenOpenCL/cl20-device-side-enqueue.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58277.186988.patch
Type: text/x-patch
Size: 11558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190215/0d64ed13/attachment-0001.bin>


More information about the cfe-commits mailing list