While trying to get rid of the hackish way of pocl to retain information of OpenCL address spaces in the IR (via the fake address space map ids) by means of using the argument info metadata instead, I noticed that the MD currently uses the target's address space IDs. I think it doesn't make sense to use the target's address space ids in this context as this is metadata that should be referring to the "logical" OpenCL address spaces. For flat AS machines like all "CPUs" in general, the logical AS info gets lost as there's only one address space (0).
This patch changes the logic such that we always use the SPIR address space ids for the argument metadata. It thus allows implementing the clGetKernelArgInfo() and the other detection needs.
If possible I'd like to get this also to 3.9.1 which would allow pocl to get cleaner way to handle the address spaces for its next release which supports 3.9. Our use of fake address space ids seem to cause lots bugs which I'd like to get rid of.