The patch adds the SPIRV-specific intrinsics required to keep information critical to SPIR-V consistency (types, constants, etc.) during translation from IR to MIR. Two related passes have also been added: SPIRVEmitIntrinsics pass inserts calls to SPIR-V intrinsics before IRTranslator, SPIRVPreLegalizer pass utilizes some intrinsic calls to save SPIR-V specific info in SPIR-V instructions and prepares MIR for Legalizer and InstructionSelect passes. Several tests passed with this change were also added.
The issue with opaque pointers was fixed in SPIRVGlobalRegistry.cpp (see the rest of https://reviews.llvm.org/D116464).
CreateUnaryIntrinsic?