[clang] [clang][SPIRV] Remove volatile variants of GenericCastToPtr* built-ins (PR #146298)

Wenju He via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 30 02:09:40 PDT 2025


================
@@ -93,16 +73,6 @@ __SPIRV_BUILTIN_ALIAS(__builtin_spirv_generic_cast_to_ptr_explicit)
 __private const void *
 __spirv_GenericCastToPtrExplicit_ToPrivate(__generic const void *,
                                            int) __SPIRV_NOEXCEPT;
-extern __SPIRV_overloadable
-__SPIRV_BUILTIN_ALIAS(__builtin_spirv_generic_cast_to_ptr_explicit)
-__private volatile void *
-__spirv_GenericCastToPtrExplicit_ToPrivate(__generic volatile void *,
-                                           int) __SPIRV_NOEXCEPT;
-extern __SPIRV_overloadable
-__SPIRV_BUILTIN_ALIAS(__builtin_spirv_generic_cast_to_ptr_explicit)
-__private const volatile void *
-__spirv_GenericCastToPtrExplicit_ToPrivate(__generic const volatile void *,
-                                           int) __SPIRV_NOEXCEPT;
----------------
wenju-he wrote:

> While I agree with your point, that imposes a cast for the user.

the cast at user site is only necessary if the input pointer argument is already `volatile`, right? In such case, any built-in that uses the pointer arg will have the same issue, i.e. casting is needed. So it is a general issue.

IMO whether volatile is present should reflect how the built-in uses the pointer argument, similar as when we adds an specific attribute for a function argument. 



https://github.com/llvm/llvm-project/pull/146298


More information about the cfe-commits mailing list