The current OpenMP implementation assumes the use of typed pointers (or rather typed pointer like types). Given the support for typed pointers in LLVM is now pending removal, the OpenMP Dialect should be able to support opaque pointers as well, given that any users of it must lower OpenMP through the LLVM Dialect.
This patch fixes the above and adds support for using LLVM opaque pointers with the OpenMP dialect. This is implemented by making all related code not make use of the element type of pointer arguments. The few (one) op requiring a pointer element type now use an explicit TypeAttr for representing the element type.
More concretely, the list of changes are:
- omp.atomic.read now has an extra TypeAttr (also in syntax) which is the element type of the values read and stored from the operands
- omp.reduction now has an type argument in the syntax for both the accmulator and operand since the operand type can no longer be inferred from the accumulator
- OpenMPToLLVMIRTranslation.cpp was rewritten to never query element types of pointers
- Adjusted the verifier to be able to handle pointers without element types
Note on the last point: I opted to keep OpenMP_PointerLikeTypeInterface as it is useful for the verification of existing typed pointer code. It does not really have use for any other purpose however and one may consider replacing its use as type constraint with AnyType. I have not done so yet.
Would it make sense to change all the tests in openmp-reduction.mlir to opaque pointers and keep the simple_reduction test as a typed pointer test in a separate typed pointer test file?