SPIRVReader: make image and sampler types match clang output (#3293)
For e.g. a `foo(image2d_t %img)` function type, clang produces
@foo(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) %img)
but after OpenCL -> SPIR-V translation, the SPIR-V reader would
translate it into
@foo(ptr addrspace(1) %img)
Preserve image argument types as `TargetExtType`s when translating to an
OpenCL target environment. `TargetExtType`s are already emitted for
SPIR-V friendly IR.
Make sure not to mangle the `TargetExtType` argument in the usual way,
but continue using the special type mangling emitted by clang (e.g.
`ocl_image1d_rw`).
Contributes to
https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/3287
Original commit:
https://github.com/KhronosGroup/SPIRV-LLVM-Translator/commit/2feb3e3eafc4855