[clang] 87a2583 - [OpenCL] Guard read_write images with TypeExtension
Sven van Haastregt via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 21 02:53:19 PDT 2022
Author: Sven van Haastregt
Date: 2022-04-21T10:52:41+01:00
New Revision: 87a258366e5d4f3786c6c2b9fe5dbeb736def909
URL: https://github.com/llvm/llvm-project/commit/87a258366e5d4f3786c6c2b9fe5dbeb736def909
DIFF: https://github.com/llvm/llvm-project/commit/87a258366e5d4f3786c6c2b9fe5dbeb736def909.diff
LOG: [OpenCL] Guard read_write images with TypeExtension
Ensure that any `read_write` image type carries the
`__opencl_c_read_write_images` upon construction of the `ImageType`.
Added:
Modified:
clang/lib/Sema/OpenCLBuiltins.td
Removed:
################################################################################
diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
index a7469d684bcc4..ece0b8866d942 100644
--- a/clang/lib/Sema/OpenCLBuiltins.td
+++ b/clang/lib/Sema/OpenCLBuiltins.td
@@ -99,10 +99,8 @@ def FuncExtKhrLocalInt32ExtendedAtomics : FunctionExtension<"cl_khr_local_int32
def FuncExtKhrInt64BaseAtomics : FunctionExtension<"cl_khr_int64_base_atomics">;
def FuncExtKhrInt64ExtendedAtomics : FunctionExtension<"cl_khr_int64_extended_atomics">;
def FuncExtKhrMipmapImage : FunctionExtension<"cl_khr_mipmap_image">;
-def FuncExtKhrMipmapImageReadWrite : FunctionExtension<"cl_khr_mipmap_image __opencl_c_read_write_images">;
def FuncExtKhrMipmapImageWrites : FunctionExtension<"cl_khr_mipmap_image_writes">;
def FuncExtKhrGlMsaaSharing : FunctionExtension<"cl_khr_gl_msaa_sharing">;
-def FuncExtKhrGlMsaaSharingReadWrite : FunctionExtension<"cl_khr_gl_msaa_sharing __opencl_c_read_write_images">;
def FuncExtOpenCLCDeviceEnqueue : FunctionExtension<"__opencl_c_device_enqueue">;
def FuncExtOpenCLCGenericAddressSpace : FunctionExtension<"__opencl_c_generic_address_space">;
@@ -244,9 +242,11 @@ class ImageType<Type _Ty, string _AccessQualifier> :
let IsConst = _Ty.IsConst;
let IsVolatile = _Ty.IsVolatile;
let AddrSpace = _Ty.AddrSpace;
- // Add TypeExtension for "write_only image3d_t".
+ // Add TypeExtensions for writable "image3d_t" and "read_write" image types.
let Extension = !cond(
!and(!eq(_Ty.Name, "image3d_t"), !eq(_AccessQualifier, "WO")) : TypeExtension<"cl_khr_3d_image_writes">,
+ !and(!eq(_Ty.Name, "image3d_t"), !eq(_AccessQualifier, "RW")) : TypeExtension<"cl_khr_3d_image_writes __opencl_c_read_write_images">,
+ !eq(_AccessQualifier, "RW") : TypeExtension<"__opencl_c_read_write_images">,
true : _Ty.Extension);
}
@@ -1594,9 +1594,6 @@ multiclass ImageQueryNumMipLevels<string aQual> {
let Extension = FuncExtKhrMipmapImage in {
defm : ImageQueryNumMipLevels<"RO">;
defm : ImageQueryNumMipLevels<"WO">;
-}
-
-let Extension = FuncExtKhrMipmapImageReadWrite in {
defm : ImageQueryNumMipLevels<"RW">;
}
@@ -1673,9 +1670,6 @@ let Extension = FuncExtKhrGlMsaaSharing in {
defm : ImageReadMsaa<"RO">;
defm : ImageQueryMsaa<"RO">;
defm : ImageQueryMsaa<"WO">;
-}
-
-let Extension = FuncExtKhrGlMsaaSharingReadWrite in {
defm : ImageReadMsaa<"RW">;
defm : ImageQueryMsaa<"RW">;
}
More information about the cfe-commits
mailing list