This patch fixes a bug introduced in commit 4eaf5846d0e7 - https://reviews.llvm.org/D111566
Commit 4eaf5846d0e7 sets address space of function type as program address space unconditionally. This breaks types which have address space qualifiers. E.g. __ptr32.
This patch fixes the bug by using address space qualifiers if present.
How about something like that?