From: Sven van Haastregt Date: Thu, 31 Mar 2022 15:41:40 +0000 (+0100) Subject: [OpenCL] Set MinVersion for sub_group_barrier with memory_scope X-Git-Tag: upstream/15.0.7~11838 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4dfec37037f5f96db8898b79601c7a1d19177027;p=platform%2Fupstream%2Fllvm.git [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) --- diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td index 9c1a39c..a57b744 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 ---