[OpenCL] Restrict addr space conversions in nested pointers

Authored by Anastasia on Feb 6 2020, 3:56 AM.


[OpenCL] Restrict addr space conversions in nested pointers

Address space conversion changes pointer representation.
This commit disallows such conversions when they are not
legal i.e. for the nested pointers even with compatible
address spaces. Because the address space conversion in
the nested levels can't be generated to modify the pointers
correctly. The behavior implemented is as follows:

  • Any implicit conversions of nested pointers with different address spaces is rejected.
  • Any conversion of address spaces in nested pointers in safe casts (e.g. const_cast or static_cast) is rejected.
  • Conversion in low level C-style or reinterpret_cast is accepted but with a warning (this aligns with OpenCL C behavior).

Fixes PR39674

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