[PATCH] Support for address space casting in order to map these on the new 'addrspacecast' IR instruction

Pekka Jääskeläinen pekka.jaaskelainen at gmail.com
Mon Nov 25 02:28:32 PST 2013

  LGTM. Trying to implicitly cast pointers between ASs now crash LLVM in LLVM 3.4 (assert in Instructions.cpp). Is it related to this? Perhaps the patch should be added to LLVM 3.4 and there could be a switch to disable the check for OpenCL (revert to the CUDA behavior)?

  The exact problem we encounter is that in pocl we need to cast pointers in case of having the logical address space as an argument (atomics in this case) to an OCL built-in function which calls an LLVM built-in with the pointer arg in AS0. We know it is legal and correct for the target of the built-in implementation (CPUs with all pointers mapping to physical AS0), but it now crashes the compilation without extra trickery due to having the logical address space (fake-addr-space-map) causing the bitcast assert. The workaround is casting via an union.


More information about the cfe-commits mailing list