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.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
LGTM! Thanks! This totally makes sense! I think we inherited that from ObjC but never adapted fully. This change has low risk of breaking backwards compatibility but might need some minor update in tools.