NOTE: Also see the '[RFC] Late (OpenMP) GPU code "SPMD-zation"' email thread.
This patch introduces an LLVM optimization for target regions (TRegions)
that tries to enable SPMD-mode or use custom state machines for the
kernels.
TRegion have been introduced in https://reviews.llvm.org/D59319 .
The interface is deliberately simple to be easily analyzable in the
middle end. Design decisions included:
- Hide all (complex) implementation choices in the runtime library but allow complete removal of the abstraction once the runtime is inlined.
- Provide all runtime calls with sufficient, easy encoded information.
- Make the LLVM optimization, even though tied to the TRegion interface, as general as possible.
Positive and negative examples for the LLVM optimization are provided in the
`llvm/test/Transforms/OpenMP/to_SPMD_mode.ll`
and
`llvm/test/Transforms/OpenMP/no_SPMD_mode.ll`
test files.