llvm
llvm copied to clipboard
[SYCL] Add LowerSPIRVAddressSpaceCastsPass
This PR adds the LowerSPIRVAddressSpaceCastsPass, which lowers IR patterns like
%0 = addrspacecast ptr addrspace(n) %src to ptr addrspace(4)
%1 = call ptr addrspace(n) @cast(ptr addrspace(4) %0, ...)
where @cast is one of the SPIRV OpGenericCastToPtrExplicit builtins. This can lower a dynamic runtime check at compile time if the address space can be inferred at compile time.