llvm-project/polly/lib/CodeGen
Siddharth Bhat bccaea57c0 [Polly] [PPCGCodeGeneration] Skip Scops which contain function pointers.
In `PPCGCodeGeneration`, we try to take the references of every `Value`
that is used within a Scop to offload to the kernel. This occurs in
`GPUNodeBuilder::createLaunchParameters`.

This breaks if one of the values is a function pointer, since one of
these cases will trigger:

1. We try to to take the references of an intrinsic function, and this
breaks at `verifyModule`, since it is illegal to take the reference of
an intrinsic.

2. We manage to take the reference to a function, but this fails at
`verifyModule` since the function will not be present in the module that
is created in the kernel.

3. Even if `verifyModule` succeeds (which should not occur), we would
then try to call a *host function* from the *device*, which is
illegal runtime behaviour.

So, we disable this entire range of possibilities by simply not allowing
function references within a `Scop` which corresponds to a kernel.

However, note that this is too conservative. We *can* allow intrinsics
within kernels if the backend can lower the intrinsic correctly. For
example, an intrinsic like `llvm.powi.*` can actually be lowered by the `NVPTX`
backend.

We will now gradually whitelist intrinsics which are known to be safe.

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

llvm-svn: 305185
2017-06-12 11:41:09 +00:00
..
BlockGenerators.cpp Fix a lot of typos. NFC. 2017-06-08 12:06:15 +00:00
CodeGeneration.cpp Fix a lot of typos. NFC. 2017-06-08 12:06:15 +00:00
CodegenCleanup.cpp Fix a lot of typos. NFC. 2017-06-08 12:06:15 +00:00
IRBuilder.cpp [PollyIRBuilder] Bound size of alias metadata 2017-04-03 07:42:50 +00:00
IslAst.cpp Fix a lot of typos. NFC. 2017-06-08 12:06:15 +00:00
IslExprBuilder.cpp Fix a lot of typos. NFC. 2017-06-08 12:06:15 +00:00
IslNodeBuilder.cpp Fix a lot of typos. NFC. 2017-06-08 12:06:15 +00:00
LoopGenerators.cpp Fix a lot of typos. NFC. 2017-06-08 12:06:15 +00:00
PPCGCodeGeneration.cpp [Polly] [PPCGCodeGeneration] Skip Scops which contain function pointers. 2017-06-12 11:41:09 +00:00
PerfMonitor.cpp Fix a lot of typos. NFC. 2017-06-08 12:06:15 +00:00
RuntimeDebugBuilder.cpp Update for alloca construction changes 2017-04-11 00:12:58 +00:00
Utils.cpp [Polly][NewPM] Pull references to the legacy PM interface from utilities and helpers 2017-04-04 10:01:53 +00:00