[PATCH] D138284: Fix incorrect cast in VisitSYCLUniqueStableNameExpr

Alexander Richardson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 03:46:58 PST 2022


arichardson created this revision.
arichardson added reviewers: erichkeane, rjmccall, aaron.ballman.
Herald added subscribers: Naghasan, Anastasia, ebevhan, yaxunl.
Herald added a project: All.
arichardson requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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 <https://reviews.llvm.org/rGeba69b59d1a30dead07da2c279c8ecfd2b62ba9f> 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
addrspace(4). I believe is correct, but it would be good for someone who is
familiar with the target to confirm.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138284

Files:
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/test/CodeGenSYCL/unique_stable_name.cpp
  clang/test/CodeGenSYCL/unique_stable_name_windows_diff.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138284.476416.patch
Type: text/x-patch
Size: 16641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221118/c1ff092b/attachment-0001.bin>


More information about the cfe-commits mailing list