Fix incorrect cast in VisitSYCLUniqueStableNameExpr
authorAlex Richardson <alexrichardson@google.com>
Fri, 18 Nov 2022 21:15:01 +0000 (21:15 +0000)
committerAlex Richardson <alexrichardson@google.com>
Sat, 19 Nov 2022 11:43:17 +0000 (11:43 +0000)
commit0745b0c0354a0c8e1fefb68a3876d15db6c2e27a
tree41eed7c5e878196e271e0fb71c1844df429af329
parent6ed85a62bdbc40a7d98205b2b3da1cb46120faf4
Fix incorrect cast in VisitSYCLUniqueStableNameExpr

Clang language-level address spaces and LLVM pointer address spaces are
not the same thing (even though they will both have a numeric value of
zero in many cases). LangAS is a enum class to avoid implicit conversions,
but eba69b59d1a30dead07da2c279c8ecfd2b62ba9f avoided the compiler error by
adding a `static_cast<>`. While touching this code, simplify it by using
CreatePointerBitCastOrAddrSpaceCast() which is already a no-op if the types
match.

This changes the code generation for spir64 to place the globals in
the sycl_global addreds space, which maps to `addrspace(1)`.

Reviewed By: bader

Differential Revision: https://reviews.llvm.org/D138284
clang/lib/CodeGen/CGExprScalar.cpp
clang/test/CodeGenSYCL/unique_stable_name.cpp
clang/test/CodeGenSYCL/unique_stable_name_windows_diff.cpp