[PATCH 1/2] [OpenCL] Change type of block pointer for OpenCL
authorAlexey Bader <alexey.bader@intel.com>
Tue, 19 Feb 2019 15:19:06 +0000 (15:19 +0000)
committerGianfranco Costamagna <locutusofborg@debian.org>
Tue, 25 Feb 2020 14:08:36 +0000 (14:08 +0000)
commit3a89bf05c226a4bfdefe04c4642438727ed4b385
tree3b3b511c1d0aa276f954715859b97bd4ea45bc2e
parent1e6baf2048c1c26273c03abd869381d9285f3b7a
[PATCH 1/2] [OpenCL] Change type of block pointer for OpenCL

Summary:

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.

Patch by: Alexey Sotkin.

Reviewers: Anastasia, yaxunl, svenvh

Reviewed By: Anastasia

Subscribers: alexbatashev, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D58277

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354337 91177308-0d34-0410-b5e6-96231b3b80d8

Gbp-Pq: Name OpenCL-Change-type-of-block-pointer-for-OpenCL.patch
clang/lib/CodeGen/CodeGenTypes.cpp
clang/test/CodeGenOpenCL/blocks.cl
clang/test/CodeGenOpenCL/cl20-device-side-enqueue.cl