[clang] 4dfec37 - [OpenCL] Set MinVersion for sub_group_barrier with memory_scope

Sven van Haastregt via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 31 08:41:52 PDT 2022


Author: Sven van Haastregt
Date: 2022-03-31T16:41:40+01:00
New Revision: 4dfec37037f5f96db8898b79601c7a1d19177027

URL: https://github.com/llvm/llvm-project/commit/4dfec37037f5f96db8898b79601c7a1d19177027
DIFF: https://github.com/llvm/llvm-project/commit/4dfec37037f5f96db8898b79601c7a1d19177027.diff

LOG: [OpenCL] Set MinVersion for sub_group_barrier with memory_scope

The memory_scope enum is not available before OpenCL 2.0, so ensure
the sub_group_barrier overload with a memory_scope argument is
restricted to OpenCL 2.0 and above.  This is already the case in
opencl-c.h.

Fixes the issue revealed by https://reviews.llvm.org/D120254

Reported-by: Harald van Dijk (hvdijk)

Added: 
    

Modified: 
    clang/lib/Sema/OpenCLBuiltins.td

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
index 9c1a39cdb1a56..a57b74430f694 100644
--- a/clang/lib/Sema/OpenCLBuiltins.td
+++ b/clang/lib/Sema/OpenCLBuiltins.td
@@ -1698,7 +1698,9 @@ let Extension = FuncExtKhrSubgroups in {
 // --- Table 28.2.2 ---
 let Extension = FuncExtKhrSubgroups in {
   def : Builtin<"sub_group_barrier", [Void, MemFenceFlags], Attr.Convergent>;
-  def : Builtin<"sub_group_barrier", [Void, MemFenceFlags, MemoryScope], Attr.Convergent>;
+  let MinVersion = CL20 in {
+    def : Builtin<"sub_group_barrier", [Void, MemFenceFlags, MemoryScope], Attr.Convergent>;
+  }
 }
 
 // --- Table 28.2.4 ---


        


More information about the cfe-commits mailing list