[PATCH] D51302: [OpenCL] Relax diagnostics on OpenCL access qualifiers
AlexeySachkov created this revision. AlexeySachkov added reviewers: Anastasia, yaxunl. Emit warning for multiple access qualifiers if they do not conflict. Patch by Alexey Bader Repository: rC Clang https://reviews.llvm.org/D51302 Files: lib/Sema/SemaDeclAttr.cpp lib/Sema/SemaType.cpp test/SemaOpenCL/access-qualifier.cl Index: lib/Sema/SemaType.cpp === --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -7083,23 +7083,43 @@ } if (const TypedefType* TypedefTy = CurType->getAs()) { -QualType PointeeTy = TypedefTy->desugar(); -S.Diag(Attr.getLoc(), diag::err_opencl_multiple_access_qualifiers); +QualType BaseTy = TypedefTy->desugar(); std::string PrevAccessQual; -switch (cast(PointeeTy.getTypePtr())->getKind()) { - #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ -case BuiltinType::Id: \ - PrevAccessQual = #Access;\ - break; - #include "clang/Basic/OpenCLImageTypes.def" -default: - assert(0 && "Unable to find corresponding image type."); +if (BaseTy->isPipeType()) { + if (TypedefTy->getDecl()->hasAttr()) { +OpenCLAccessAttr *Attr = +TypedefTy->getDecl()->getAttr(); +PrevAccessQual = Attr->getSpelling(); + } else { +PrevAccessQual = "read_only"; + } +} else if (const BuiltinType* ImgType = BaseTy->getAs()) { + + switch (ImgType->getKind()) { +#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ + case BuiltinType::Id: \ +PrevAccessQual = #Access;\ +break; +#include "clang/Basic/OpenCLImageTypes.def" + default: +llvm_unreachable("Unable to find corresponding image type."); + } +} else { + llvm_unreachable("unexpected type"); +} +StringRef AttrName = Attr.getName()->getName(); +if (PrevAccessQual == AttrName.ltrim("_")) { + // Duplicated qualifiers + S.Diag(Attr.getLoc(), diag::warn_duplicate_declspec) + << AttrName << Attr.getRange(); +} else { + // Contradicting qualifiers + S.Diag(Attr.getLoc(), diag::err_opencl_multiple_access_qualifiers); } S.Diag(TypedefTy->getDecl()->getBeginLoc(), - diag::note_opencl_typedef_access_qualifier) -<< PrevAccessQual; + diag::note_opencl_typedef_access_qualifier) << PrevAccessQual; } else if (CurType->isPipeType()) { if (Attr.getSemanticSpelling() == OpenCLAccessAttr::Keyword_write_only) { QualType ElemType = CurType->getAs()->getElementType(); Index: lib/Sema/SemaDeclAttr.cpp === --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -5890,10 +5890,16 @@ // Check if there is only one access qualifier. if (D->hasAttr()) { -S.Diag(AL.getLoc(), diag::err_opencl_multiple_access_qualifiers) -<< D->getSourceRange(); -D->setInvalidDecl(true); -return; +if (D->getAttr()->getSemanticSpelling() == +AL.getSemanticSpelling()) { + S.Diag(AL.getLoc(), diag::warn_duplicate_declspec) + << AL.getName()->getName() << AL.getRange(); +} else { + S.Diag(AL.getLoc(), diag::err_opencl_multiple_access_qualifiers) + << D->getSourceRange(); + D->setInvalidDecl(true); + return; +} } // OpenCL v2.0 s6.6 - read_write can be used for image types to specify that an Index: test/SemaOpenCL/access-qualifier.cl === --- test/SemaOpenCL/access-qualifier.cl +++ test/SemaOpenCL/access-qualifier.cl @@ -60,7 +60,7 @@ kernel void k11(read_only write_only image1d_t i){} // expected-error{{multiple access qualifiers}} -kernel void k12(read_only read_only image1d_t i){} // expected-error{{multiple access qualifiers}} +kernel void k12(read_only read_only image1d_t i){} // expected-warning {{duplicate 'read_only' declaration specifier}} #if __OPENCL_C_VERSION__ >= 200 kernel void k13(read_write pipe int i){} // expected-error{{access qualifier 'read_write' can not be used for 'read_only pipe int'}} @@ -78,3 +78,33 @@ #if __OPENCL_C_VERSION__ < 200 kernel void test_image3d_wo(write_only image3d_t img) {} // expected-error {{use of type '__write_only image3d_t' requires cl_khr_3d_image_writes extension to be enabled}} #endif + +#if __OPENCL_C_VERSION__ >= 200 +kernel void read_write_twice_typedef(read_write img1d_rw i){} // expected-warning {{duplicate 'read_write' declaration specifier}} +// expected-note@-74 {{previously declared 'read_write' here}} + +kernel void pipe_ro_twice(read_only read_only pipe int i){} // expected-warning{{duplicate 'read_only' declaration specifier}} +// Conflicting access qualifiers +kernel void pipe_ro_twice_tw(read_
[PATCH] D51302: [OpenCL] Relax diagnostics on OpenCL access qualifiers
AlexeySachkov updated this revision to Diff 163086. AlexeySachkov added a comment. Applied comment from Anastasia https://reviews.llvm.org/D51302 Files: lib/Sema/SemaDeclAttr.cpp lib/Sema/SemaType.cpp test/SemaOpenCL/access-qualifier.cl Index: lib/Sema/SemaType.cpp === --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -7083,23 +7083,43 @@ } if (const TypedefType* TypedefTy = CurType->getAs()) { -QualType PointeeTy = TypedefTy->desugar(); -S.Diag(Attr.getLoc(), diag::err_opencl_multiple_access_qualifiers); +QualType BaseTy = TypedefTy->desugar(); std::string PrevAccessQual; -switch (cast(PointeeTy.getTypePtr())->getKind()) { - #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ -case BuiltinType::Id: \ - PrevAccessQual = #Access;\ - break; - #include "clang/Basic/OpenCLImageTypes.def" -default: - assert(0 && "Unable to find corresponding image type."); +if (BaseTy->isPipeType()) { + if (TypedefTy->getDecl()->hasAttr()) { +OpenCLAccessAttr *Attr = +TypedefTy->getDecl()->getAttr(); +PrevAccessQual = Attr->getSpelling(); + } else { +PrevAccessQual = "read_only"; + } +} else if (const BuiltinType* ImgType = BaseTy->getAs()) { + + switch (ImgType->getKind()) { +#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ + case BuiltinType::Id: \ +PrevAccessQual = #Access;\ +break; +#include "clang/Basic/OpenCLImageTypes.def" + default: +llvm_unreachable("Unable to find corresponding image type."); + } +} else { + llvm_unreachable("unexpected type"); +} +StringRef AttrName = Attr.getName()->getName(); +if (PrevAccessQual == AttrName.ltrim("_")) { + // Duplicated qualifiers + S.Diag(Attr.getLoc(), diag::warn_duplicate_declspec) + << AttrName << Attr.getRange(); +} else { + // Contradicting qualifiers + S.Diag(Attr.getLoc(), diag::err_opencl_multiple_access_qualifiers); } S.Diag(TypedefTy->getDecl()->getBeginLoc(), - diag::note_opencl_typedef_access_qualifier) -<< PrevAccessQual; + diag::note_opencl_typedef_access_qualifier) << PrevAccessQual; } else if (CurType->isPipeType()) { if (Attr.getSemanticSpelling() == OpenCLAccessAttr::Keyword_write_only) { QualType ElemType = CurType->getAs()->getElementType(); Index: lib/Sema/SemaDeclAttr.cpp === --- lib/Sema/SemaDeclAttr.cpp +++ lib/Sema/SemaDeclAttr.cpp @@ -5890,10 +5890,16 @@ // Check if there is only one access qualifier. if (D->hasAttr()) { -S.Diag(AL.getLoc(), diag::err_opencl_multiple_access_qualifiers) -<< D->getSourceRange(); -D->setInvalidDecl(true); -return; +if (D->getAttr()->getSemanticSpelling() == +AL.getSemanticSpelling()) { + S.Diag(AL.getLoc(), diag::warn_duplicate_declspec) + << AL.getName()->getName() << AL.getRange(); +} else { + S.Diag(AL.getLoc(), diag::err_opencl_multiple_access_qualifiers) + << D->getSourceRange(); + D->setInvalidDecl(true); + return; +} } // OpenCL v2.0 s6.6 - read_write can be used for image types to specify that an Index: test/SemaOpenCL/access-qualifier.cl === --- test/SemaOpenCL/access-qualifier.cl +++ test/SemaOpenCL/access-qualifier.cl @@ -60,7 +60,7 @@ kernel void k11(read_only write_only image1d_t i){} // expected-error{{multiple access qualifiers}} -kernel void k12(read_only read_only image1d_t i){} // expected-error{{multiple access qualifiers}} +kernel void k12(read_only read_only image1d_t i){} // expected-warning {{duplicate 'read_only' declaration specifier}} #if __OPENCL_C_VERSION__ >= 200 kernel void k13(read_write pipe int i){} // expected-error{{access qualifier 'read_write' can not be used for 'read_only pipe int'}} @@ -78,3 +78,33 @@ #if __OPENCL_C_VERSION__ < 200 kernel void test_image3d_wo(write_only image3d_t img) {} // expected-error {{use of type '__write_only image3d_t' requires cl_khr_3d_image_writes extension to be enabled}} #endif + +#if __OPENCL_C_VERSION__ >= 200 +kernel void read_write_twice_typedef(read_write img1d_rw i){} // expected-warning {{duplicate 'read_write' declaration specifier}} +// expected-note@-74 {{previously declared 'read_write' here}} + +kernel void pipe_ro_twice(read_only read_only pipe int i){} // expected-warning{{duplicate 'read_only' declaration specifier}} +// Conflicting access qualifiers +kernel void pipe_ro_twice_tw(read_write read_only read_only pipe int i){} // expected-error{{access qualifier 'read_write'
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov created this revision. AlexeySachkov added reviewers: Anastasia, yaxunl. Documentation can be found at https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_device_side_avc_motion_estimation.txt Patch by Kristina Bessonova Repository: rC Clang https://reviews.llvm.org/D51484 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/Type.h include/clang/Basic/OpenCLExtensionTypes.def include/clang/Basic/OpenCLExtensions.def include/clang/Serialization/ASTBitCodes.h include/clang/module.modulemap lib/AST/ASTContext.cpp lib/AST/ASTImporter.cpp lib/AST/ExprConstant.cpp lib/AST/ItaniumMangle.cpp lib/AST/MicrosoftMangle.cpp lib/AST/NSAPI.cpp lib/AST/Type.cpp lib/AST/TypeLoc.cpp lib/Analysis/PrintfFormatString.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGOpenCLRuntime.cpp lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/Headers/opencl-c.h lib/Index/USRGeneration.cpp lib/Sema/Sema.cpp lib/Sema/SemaExpr.cpp lib/Serialization/ASTCommon.cpp lib/Serialization/ASTReader.cpp test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl test/SemaOpenCL/extension-version.cl tools/libclang/CIndex.cpp tools/libclang/CXType.cpp Index: lib/Serialization/ASTReader.cpp === --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -6970,6 +6970,11 @@ T = Context.SingletonId; \ break; #include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ +case PREDEF_TYPE_##Id##_ID: \ + T = Context.Id##Ty; \ + break; +#include "clang/Basic/OpenCLExtensionTypes.def" case PREDEF_TYPE_SAMPLER_ID: T = Context.OCLSamplerTy; break; Index: lib/Serialization/ASTCommon.cpp === --- lib/Serialization/ASTCommon.cpp +++ lib/Serialization/ASTCommon.cpp @@ -213,6 +213,11 @@ ID = PREDEF_TYPE_##Id##_ID; \ break; #include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ + case BuiltinType::Id: \ +ID = PREDEF_TYPE_##Id##_ID; \ +break; +#include "clang/Basic/OpenCLExtensionTypes.def" case BuiltinType::OCLSampler: ID = PREDEF_TYPE_SAMPLER_ID; break; Index: lib/Headers/opencl-c.h === --- lib/Headers/opencl-c.h +++ lib/Headers/opencl-c.h @@ -16193,6 +16193,628 @@ void__ovld __conv intel_sub_group_block_write_us8( __global ushort* p, ushort8 data ); #endif // cl_intel_subgroups_short +#ifdef cl_intel_device_side_avc_motion_estimation +#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable + +#define CLK_AVC_ME_MAJOR_16x16_INTEL 0x0 +#define CLK_AVC_ME_MAJOR_16x8_INTEL 0x1 +#define CLK_AVC_ME_MAJOR_8x16_INTEL 0x2 +#define CLK_AVC_ME_MAJOR_8x8_INTEL 0x3 + +#define CLK_AVC_ME_MINOR_8x8_INTEL 0x0 +#define CLK_AVC_ME_MINOR_8x4_INTEL 0x1 +#define CLK_AVC_ME_MINOR_4x8_INTEL 0x2 +#define CLK_AVC_ME_MINOR_4x4_INTEL 0x3 + +#define CLK_AVC_ME_MAJOR_FORWARD_INTEL 0x0 +#define CLK_AVC_ME_MAJOR_BACKWARD_INTEL 0x1 +#define CLK_AVC_ME_MAJOR_BIDIRECTIONAL_INTEL 0x2 + +#define CLK_AVC_ME_PARTITION_MASK_ALL_INTEL 0x0 +#define CLK_AVC_ME_PARTITION_MASK_16x16_INTEL 0x7E +#define CLK_AVC_ME_PARTITION_MASK_16x8_INTEL 0x7D +#define CLK_AVC_ME_PARTITION_MASK_8x16_INTEL 0x7B +#define CLK_AVC_ME_PARTITION_MASK_8x8_INTEL 0x77 +#define CLK_AVC_ME_PARTITION_MASK_8x4_INTEL 0x6F +#define CLK_AVC_ME_PARTITION_MASK_4x8_INTEL 0x5F +#define CLK_AVC_ME_PARTITION_MASK_4x4_INTEL 0x3F + +#define CLK_AVC_ME_SLICE_TYPE_PRED_INTEL 0x0 +#define CLK_AVC_ME_SLICE_TYPE_BPRED_INTEL 0x1 +#define CLK_AVC_ME_SLICE_TYPE_INTRA_INTEL 0x2 + +#define CLK_AVC_ME_SEARCH_WINDOW_EXHAUSTIVE_INTEL 0x0 +#define CLK_AVC_ME_SEARCH_WINDOW_SMALL_INTEL 0x1 +#define CLK_AVC_ME_SEARCH_WINDOW_TINY_INTEL 0x2 +#define CLK_AVC_ME_SEARCH_WINDOW_EXTRA_TINY_INTEL 0x3 +#define CLK_AVC_ME_SEARCH_WINDOW_DIAMOND_INTEL 0x4 +#define CLK_AVC_ME_SEARCH_WINDOW_LARGE_DIAMOND_INTEL 0x5 +#define CLK_AVC_ME_SEARCH_WINDOW_RESERVED0_INTEL 0x6 +#define CLK_AVC_ME_SEARCH_WINDOW_RESERVED1_INTEL 0x7 +#define CLK_AVC_ME_SEARCH_WINDOW_CUSTOM_INTEL 0x8 +#define CLK_AVC_ME_SEARCH_WINDOW_16x12_RADIUS_INTEL 0x9 +#define CLK_AVC_ME_SEARCH_WINDOW_4x4_RADIUS_INTEL 0x2 +#define CLK_AVC_ME_SEARCH_WINDOW_2x2_RADIUS_INTEL 0xa + +#define CLK_AVC_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0 +#define CLK_AVC_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x2 + +#define CLK_AVC_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0 +#define CLK_AVC_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1 +#define CLK_AVC_ME_SUBPIXEL_MODE_QPEL_INTEL 0x3 + +#define CLK_AVC_ME_COST_PRECISION_QPEL_INTEL 0x0 +#define CLK_AVC_ME_COST_PRECISION_HPEL_INTEL 0x1 +#define CLK_AVC_ME_COST_PRECISION_PEL_INTEL 0x2 +#define CLK_AVC_ME_COST_PRECISION_DPEL_INTEL 0x3 + +#define CLK_AVC_ME_BIDIR_WEIGHT_QUARTER_INTEL 0x10 +#define CLK_AVC_ME
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov added inline comments. Comment at: include/clang/Basic/OpenCLExtensionTypes.def:1 +//===-- OpenCLExtensionTypes.def - Metadata about BuiltinTypes --*- C++ -*-===// +// Anastasia wrote: > I am confused about the purpose of this file. Is it supposed to contain intel > extension specific types or generally OpenCL types? It is supposed to contain any opaque types from any OpenCL extension Comment at: include/clang/Basic/OpenCLExtensionTypes.def:27 + +INTEL_SGAVC_TYPE(mce_payload_t, McePayload) +INTEL_SGAVC_TYPE(ime_payload_t, ImePayload) Anastasia wrote: > From the specification of this extension I can't quite see if these types > have to be in Clang instead of the header. Can you please elaborate on any > example where it wouldn't be possible for this type to be declared in the > header using the technique explained in: > https://clang.llvm.org/docs/UsersManual.html#opencl-extensions We cannot define these types in header because their layout is not defined in specification, i.e. all of these types are opaque Repository: rC Clang https://reviews.llvm.org/D51484 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D52654: [OpenCL][NFC] Unify ZeroToOCL* cast types
AlexeySachkov updated this revision to Diff 168947. AlexeySachkov added a comment. Applied comments from Anastasia. Updated patch with more code unified https://reviews.llvm.org/D52654 Files: include/clang/AST/OperationKinds.def include/clang/Sema/Initialization.h lib/AST/Expr.cpp lib/AST/ExprConstant.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprComplex.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CGExprScalar.cpp lib/Edit/RewriteObjCFoundationAPI.cpp lib/Sema/SemaCast.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaInit.cpp lib/StaticAnalyzer/Core/ExprEngineC.cpp Index: lib/StaticAnalyzer/Core/ExprEngineC.cpp === --- lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -412,8 +412,7 @@ case CK_BlockPointerToObjCPointerCast: case CK_AnyPointerToBlockPointerCast: case CK_ObjCObjectLValueCast: - case CK_ZeroToOCLEvent: - case CK_ZeroToOCLQueue: + case CK_ZeroToOCLOpaqueType: case CK_IntToOCLSampler: case CK_LValueBitCast: { state = Index: lib/Sema/SemaInit.cpp === --- lib/Sema/SemaInit.cpp +++ lib/Sema/SemaInit.cpp @@ -3261,8 +3261,7 @@ case SK_StdInitializerList: case SK_StdInitializerListConstructorCall: case SK_OCLSamplerInit: - case SK_OCLZeroEvent: - case SK_OCLZeroQueue: + case SK_OCLZeroOpaqueType: break; case SK_ConversionSequence: @@ -3548,16 +3547,9 @@ Steps.push_back(S); } -void InitializationSequence::AddOCLZeroEventStep(QualType T) { +void InitializationSequence::AddOCLZeroOpaqueTypeStep(QualType T) { Step S; - S.Kind = SK_OCLZeroEvent; - S.Type = T; - Steps.push_back(S); -} - -void InitializationSequence::AddOCLZeroQueueStep(QualType T) { - Step S; - S.Kind = SK_OCLZeroQueue; + S.Kind = SK_OCLZeroOpaqueType; S.Type = T; Steps.push_back(S); } @@ -5260,39 +5252,31 @@ return true; } -// -// OpenCL 1.2 spec, s6.12.10 -// -// The event argument can also be used to associate the -// async_work_group_copy with a previous async copy allowing -// an event to be shared by multiple async copies; otherwise -// event should be zero. -// -static bool TryOCLZeroEventInitialization(Sema &S, - InitializationSequence &Sequence, - QualType DestType, - Expr *Initializer) { - if (!S.getLangOpts().OpenCL || !DestType->isEventT() || - !Initializer->isIntegerConstantExpr(S.getASTContext()) || - (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0)) +static bool TryOCLZeroOpaqueTypeInitialization(Sema &S, + InitializationSequence &Sequence, + QualType DestType, + Expr *Initializer) { + if (!S.getLangOpts().OpenCL) return false; - Sequence.AddOCLZeroEventStep(DestType); - return true; -} + // + // OpenCL 1.2 spec, s6.12.10 + // + // The event argument can also be used to associate the + // async_work_group_copy with a previous async copy allowing + // an event to be shared by multiple async copies; otherwise + // event should be zero. + // + if (DestType->isEventT() || DestType->isQueueT()) { +if (!Initializer->isIntegerConstantExpr(S.getASTContext()) || +(Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0)) + return false; -static bool TryOCLZeroQueueInitialization(Sema &S, - InitializationSequence &Sequence, - QualType DestType, - Expr *Initializer) { - if (!S.getLangOpts().OpenCL || S.getLangOpts().OpenCLVersion < 200 || - !DestType->isQueueT() || - !Initializer->isIntegerConstantExpr(S.getASTContext()) || - (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0)) -return false; +Sequence.AddOCLZeroOpaqueTypeStep(DestType); +return true; + } - Sequence.AddOCLZeroQueueStep(DestType); - return true; + return false; } InitializationSequence::InitializationSequence(Sema &S, @@ -5566,12 +5550,9 @@ if (TryOCLSamplerInitialization(S, *this, DestType, Initializer)) return; -if (TryOCLZeroEventInitialization(S, *this, DestType, Initializer)) +if (TryOCLZeroOpaqueTypeInitialization(S, *this, DestType, Initializer)) return; -if (TryOCLZeroQueueInitialization(S, *this, DestType, Initializer)) - return; - // Handle initialization in C AddCAssignmentStep(DestType); MaybeProduceObjCObject(S, *this, Entity); @@ -7393,8 +7374,7 @@ case SK_ProduceObjCObject: case SK_StdInitializerList: case SK_OCLSamplerInit: - case SK_OCLZeroEvent: - case SK_OCLZeroQueue: { + case S
[PATCH] D52654: [OpenCL][NFC] Unify ZeroToOCL* cast types
AlexeySachkov marked an inline comment as done. AlexeySachkov added inline comments. Comment at: lib/Sema/SemaInit.cpp:5291 - Sequence.AddOCLZeroQueueStep(DestType); - return true; +Sequence.AddOCLZeroQueueStep(DestType); +return true; Anastasia wrote: > I guess this one can't be generalized? Actually, it is generalized now https://reviews.llvm.org/D52654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov updated this revision to Diff 169368. AlexeySachkov marked an inline comment as done. AlexeySachkov added a comment. Updated tests. Reverted usage of `#pragma OPENCL EXTENSION my_ext : begin` due to a failed LIT tests: `test/Headers/opencl-c-header.cl` Test failed on the following RUN-line: // Compile for OpenCL 2.0 for the first time. The module should change. // RUN: %clang_cc1 -triple spir-unknown-unknown -O0 -emit-llvm -o - -cl-std=CL2.0 -finclude-default-header -fmodules -fimplicit-modu le-maps -fmodules-cache-path=%t -fdisable-module-hash -ftime-report %s 2>&1 | FileCheck --check-prefix=CHECK20 --check-prefix=CHECK- MOD %s Clang crashes at the assertion in `ASTReader::getGlobalSubmoduleID()`: assert(I != M.SubmoduleRemap.end() && "Invalid index into submodule index remap"); https://reviews.llvm.org/D51484 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/OperationKinds.def include/clang/AST/Type.h include/clang/Basic/OpenCLExtensionTypes.def include/clang/Basic/OpenCLExtensions.def include/clang/Sema/Initialization.h include/clang/Serialization/ASTBitCodes.h include/clang/module.modulemap lib/AST/ASTContext.cpp lib/AST/ASTImporter.cpp lib/AST/Expr.cpp lib/AST/ExprConstant.cpp lib/AST/ItaniumMangle.cpp lib/AST/MicrosoftMangle.cpp lib/AST/NSAPI.cpp lib/AST/Type.cpp lib/AST/TypeLoc.cpp lib/Analysis/PrintfFormatString.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprComplex.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CGOpenCLRuntime.cpp lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/Edit/RewriteObjCFoundationAPI.cpp lib/Headers/opencl-c.h lib/Index/USRGeneration.cpp lib/Sema/Sema.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaInit.cpp lib/Serialization/ASTCommon.cpp lib/Serialization/ASTReader.cpp lib/StaticAnalyzer/Core/ExprEngineC.cpp test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl test/Headers/opencl-c-header.cl test/Index/opencl-types.cl test/SemaOpenCL/extension-version.cl test/SemaOpenCL/intel-subgroup-avc-ext-types.cl tools/libclang/CIndex.cpp tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -70,6 +70,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) BTCASE(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) BTCASE(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" BTCASE(OCLSampler); BTCASE(OCLEvent); BTCASE(OCLQueue); @@ -605,6 +607,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) TKIND(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) TKIND(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" TKIND(OCLSampler); TKIND(OCLEvent); TKIND(OCLQueue); Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1519,6 +1519,9 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ case BuiltinType::Id: #include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) \ + case BuiltinType::Id: +#include "clang/Basic/OpenCLExtensionTypes.def" case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: case BuiltinType::OCLClkEvent: Index: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl === --- /dev/null +++ test/SemaOpenCL/intel-subgroup-avc-ext-types.cl @@ -0,0 +1,111 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -cl-ext=+cl_intel_device_side_avc_motion_estimation -fsyntax-only -verify %s + +#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable + +// Having the initializers defined in the test allows us not to include default +// opencl header, and thus reducing test execution time. +// The initializers' values must match with ones defined in the default opencl +// header (clang/lib/Headers/opencl-c.h) + +#define CLK_AVC_ME_INITIALIZE_INTEL 0x0 + +#define CLK_AVC_IME_PAYLOAD_INITIALIZE_INTEL 0x0 +#define CLK_AVC_REF_PAYLOAD_INITIALIZE_INTEL 0x0 +#define CLK_AVC_SIC_PAYLOAD_INITIALIZE_INTEL 0x0 + +#define CLK_AVC_IME_RESULT_INITIALIZE_INTEL 0x0 +#define CLK_AVC_REF_RESULT_INITIALIZE_INTEL 0x0 +#define CLK_AVC_SIC_RESULT_INITIALIZE_INTEL 0x0 + +#define CLK_AVC_IME_RESULT_SINGLE_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0 +#define CLK_AVC_IME_RESULT_SINGLE_REFERENCE_STREAMIN
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov added inline comments. Comment at: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl:26 + char4 c4, event_t e, struct st ss) { + intel_sub_group_avc_mce_payload_t payload_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with an expression of incompatible type 'int'}} Anastasia wrote: > AlexeySachkov wrote: > > Anastasia wrote: > > > Would it make sense to add a check for non-zero constant? > > > > > > Also can you assign variables of intel_sub_group_avc_mce_payload_t type > > > from the same type? Any other restrictions on assignment (i.e. w integer > > > literals) and operations over these types? > > > Also can you assign variables of intel_sub_group_avc_mce_payload_t type > > > from the same type? > > > > Yes, such assignment is allowed. > > > > > Any other restrictions on assignment (i.e. w integer literals) > > > > All of these types can only be initialized using call to a special > > built-ins or using predefined macros like > > `CLK_AVC_REF_RESULT_INITIALIZE_INTEL`. Any other assignment should lead to > > an error. > > > > I found that I'm able to assign variable of type > > `intel_sub_group_avc_imc_payload_t` to variable of type > > `intel_sub_group_avc_mce_payload_t`, so I will update the patch when I > > implement such diagnostic message. > > > > > and operations over these types? > > Variables of these types can only be used as return values or arguments for > > built-in functions described in the specification. All other operations are > > restricted > W/o the spec change it's really difficult to review properly. So are you > testing 2 groups of types: > 1. Init by zero in `bar`? > 2. Init by builtin function in `foo`? > I would like to test: 1. foo: init by literal or variable, negative tests 2. far: init by other type or assignment between different types, negative tests 3. bar: init by special initializers from spec, positive tests Comment at: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl:34 + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ime_payload_t payload_ime = b; + // expected-error@-1 {{initializing 'intel_sub_group_avc_ime_payload_t' with an expression of incompatible type 'bool'}} Anastasia wrote: > I am not sure it makes sense to iterate through all different types. You > don't enumerate all of them and we don't do exhaustive testing in Clang tests > anyway. I would just check integer literal and one other builtin type. Simplified test a little bit. https://reviews.llvm.org/D51484 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53200: [OpenCL] Fix serialization of OpenCLExtensionDecls
AlexeySachkov created this revision. AlexeySachkov added reviewers: Anastasia, yaxunl. I recently discovered that adding the following code into `opencl-c.h` causes failure of `test/Headers/opencl-c-header.cl`: #pragma OPENCL EXTENSION cl_my_ext : begin void cl_my_ext_foobarbaz(); #pragma OPENCL EXTENSIOn cl_my_ext : end Clang crashes at the assertion is `ASTReader::getGlobalSubmoduleID()`: assert(I != M.SubmoduleRemap.end() && "Invalid index into submodule index remap"); The root cause of the problem that to deserialize `OPENCL_EXTENSION_DECLS` section `ASTReader` needs to deserialize a Decl contained in it. In turn, deserializing a Decl requires information about whether this declaration is part of a (sub)module, but this information is not read yet because it is located further in a module file. Repository: rC Clang https://reviews.llvm.org/D53200 Files: lib/Serialization/ASTWriter.cpp Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -5014,13 +5014,16 @@ WriteFPPragmaOptions(SemaRef.getFPOptions()); WriteOpenCLExtensions(SemaRef); WriteOpenCLExtensionTypes(SemaRef); - WriteOpenCLExtensionDecls(SemaRef); WriteCUDAPragmas(SemaRef); // If we're emitting a module, write out the submodule information. if (WritingModule) WriteSubmodules(WritingModule); + // We need to have information about submodules to correctly deserialize + // decls from OpenCLExtensionDecls block + WriteOpenCLExtensionDecls(SemaRef); + Stream.EmitRecord(SPECIAL_TYPES, SpecialTypes); // Write the record containing external, unnamed definitions. Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -5014,13 +5014,16 @@ WriteFPPragmaOptions(SemaRef.getFPOptions()); WriteOpenCLExtensions(SemaRef); WriteOpenCLExtensionTypes(SemaRef); - WriteOpenCLExtensionDecls(SemaRef); WriteCUDAPragmas(SemaRef); // If we're emitting a module, write out the submodule information. if (WritingModule) WriteSubmodules(WritingModule); + // We need to have information about submodules to correctly deserialize + // decls from OpenCLExtensionDecls block + WriteOpenCLExtensionDecls(SemaRef); + Stream.EmitRecord(SPECIAL_TYPES, SpecialTypes); // Write the record containing external, unnamed definitions. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53200: [OpenCL] Fix serialization of OpenCLExtensionDecls
AlexeySachkov updated this revision to Diff 169851. AlexeySachkov added a comment. Added test https://reviews.llvm.org/D53200 Files: lib/Serialization/ASTWriter.cpp test/Headers/opencl-pragma-extension-begin.cl test/Headers/opencl-pragma-extension-begin.h Index: test/Headers/opencl-pragma-extension-begin.h === --- /dev/null +++ test/Headers/opencl-pragma-extension-begin.h @@ -0,0 +1,4 @@ + +#pragma OPENCL EXTENSION cl_my_ext : begin +void cl_my_ext_foo(); +#pragma OPENCL EXTENSION cl_my_ext : end Index: test/Headers/opencl-pragma-extension-begin.cl === --- /dev/null +++ test/Headers/opencl-pragma-extension-begin.cl @@ -0,0 +1,13 @@ +// RUN: rm -rf %t.ocl.pragma.ext.begin +// RUN: mkdir -p %t.ocl.pragma.ext.begin +// +// RUN: %clang_cc1 -cl-std=CL1.2 -include %S/opencl-pragma-extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.ocl.pragma.ext.begin %s 2>&1 +// +// RUN: rm -rf %t.ocl.pragma.ext.begin +// RUN: mkdir -p %t.ocl.pragma.ext.begin +// +// RUN: %clang_cc1 -cl-std=CL2.0 -include %S/opencl-pragma-extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.ocl.pragma.ext.begin %s 2>&1 + +void __kernel test(__global int *data) { + *data = 10; +} Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -5014,13 +5014,16 @@ WriteFPPragmaOptions(SemaRef.getFPOptions()); WriteOpenCLExtensions(SemaRef); WriteOpenCLExtensionTypes(SemaRef); - WriteOpenCLExtensionDecls(SemaRef); WriteCUDAPragmas(SemaRef); // If we're emitting a module, write out the submodule information. if (WritingModule) WriteSubmodules(WritingModule); + // We need to have information about submodules to correctly deserialize + // decls from OpenCLExtensionDecls block + WriteOpenCLExtensionDecls(SemaRef); + Stream.EmitRecord(SPECIAL_TYPES, SpecialTypes); // Write the record containing external, unnamed definitions. Index: test/Headers/opencl-pragma-extension-begin.h === --- /dev/null +++ test/Headers/opencl-pragma-extension-begin.h @@ -0,0 +1,4 @@ + +#pragma OPENCL EXTENSION cl_my_ext : begin +void cl_my_ext_foo(); +#pragma OPENCL EXTENSION cl_my_ext : end Index: test/Headers/opencl-pragma-extension-begin.cl === --- /dev/null +++ test/Headers/opencl-pragma-extension-begin.cl @@ -0,0 +1,13 @@ +// RUN: rm -rf %t.ocl.pragma.ext.begin +// RUN: mkdir -p %t.ocl.pragma.ext.begin +// +// RUN: %clang_cc1 -cl-std=CL1.2 -include %S/opencl-pragma-extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.ocl.pragma.ext.begin %s 2>&1 +// +// RUN: rm -rf %t.ocl.pragma.ext.begin +// RUN: mkdir -p %t.ocl.pragma.ext.begin +// +// RUN: %clang_cc1 -cl-std=CL2.0 -include %S/opencl-pragma-extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.ocl.pragma.ext.begin %s 2>&1 + +void __kernel test(__global int *data) { + *data = 10; +} Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -5014,13 +5014,16 @@ WriteFPPragmaOptions(SemaRef.getFPOptions()); WriteOpenCLExtensions(SemaRef); WriteOpenCLExtensionTypes(SemaRef); - WriteOpenCLExtensionDecls(SemaRef); WriteCUDAPragmas(SemaRef); // If we're emitting a module, write out the submodule information. if (WritingModule) WriteSubmodules(WritingModule); + // We need to have information about submodules to correctly deserialize + // decls from OpenCLExtensionDecls block + WriteOpenCLExtensionDecls(SemaRef); + Stream.EmitRecord(SPECIAL_TYPES, SpecialTypes); // Write the record containing external, unnamed definitions. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53200: [OpenCL] Fix serialization of OpenCLExtensionDecls
AlexeySachkov updated this revision to Diff 169978. AlexeySachkov added a comment. Removed unnecessary empty line from test https://reviews.llvm.org/D53200 Files: lib/Serialization/ASTWriter.cpp test/Headers/opencl-pragma-extension-begin.cl test/Headers/opencl-pragma-extension-begin.h Index: test/Headers/opencl-pragma-extension-begin.h === --- /dev/null +++ test/Headers/opencl-pragma-extension-begin.h @@ -0,0 +1,3 @@ +#pragma OPENCL EXTENSION cl_my_ext : begin +void cl_my_ext_foo(); +#pragma OPENCL EXTENSION cl_my_ext : end Index: test/Headers/opencl-pragma-extension-begin.cl === --- /dev/null +++ test/Headers/opencl-pragma-extension-begin.cl @@ -0,0 +1,13 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// +// RUN: %clang_cc1 -cl-std=CL1.2 -include %S/opencl-pragma-extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s 2>&1 +// +// RUN: rm -rf %t +// RUN: mkdir -p %t +// +// RUN: %clang_cc1 -cl-std=CL2.0 -include %S/opencl-pragma-extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s 2>&1 + +void __kernel test(__global int *data) { + *data = 10; +} Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -5014,13 +5014,16 @@ WriteFPPragmaOptions(SemaRef.getFPOptions()); WriteOpenCLExtensions(SemaRef); WriteOpenCLExtensionTypes(SemaRef); - WriteOpenCLExtensionDecls(SemaRef); WriteCUDAPragmas(SemaRef); // If we're emitting a module, write out the submodule information. if (WritingModule) WriteSubmodules(WritingModule); + // We need to have information about submodules to correctly deserialize + // decls from OpenCLExtensionDecls block + WriteOpenCLExtensionDecls(SemaRef); + Stream.EmitRecord(SPECIAL_TYPES, SpecialTypes); // Write the record containing external, unnamed definitions. Index: test/Headers/opencl-pragma-extension-begin.h === --- /dev/null +++ test/Headers/opencl-pragma-extension-begin.h @@ -0,0 +1,3 @@ +#pragma OPENCL EXTENSION cl_my_ext : begin +void cl_my_ext_foo(); +#pragma OPENCL EXTENSION cl_my_ext : end Index: test/Headers/opencl-pragma-extension-begin.cl === --- /dev/null +++ test/Headers/opencl-pragma-extension-begin.cl @@ -0,0 +1,13 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// +// RUN: %clang_cc1 -cl-std=CL1.2 -include %S/opencl-pragma-extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s 2>&1 +// +// RUN: rm -rf %t +// RUN: mkdir -p %t +// +// RUN: %clang_cc1 -cl-std=CL2.0 -include %S/opencl-pragma-extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %s 2>&1 + +void __kernel test(__global int *data) { + *data = 10; +} Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -5014,13 +5014,16 @@ WriteFPPragmaOptions(SemaRef.getFPOptions()); WriteOpenCLExtensions(SemaRef); WriteOpenCLExtensionTypes(SemaRef); - WriteOpenCLExtensionDecls(SemaRef); WriteCUDAPragmas(SemaRef); // If we're emitting a module, write out the submodule information. if (WritingModule) WriteSubmodules(WritingModule); + // We need to have information about submodules to correctly deserialize + // decls from OpenCLExtensionDecls block + WriteOpenCLExtensionDecls(SemaRef); + Stream.EmitRecord(SPECIAL_TYPES, SpecialTypes); // Write the record containing external, unnamed definitions. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53200: [OpenCL] Fix serialization of OpenCLExtensionDecls
AlexeySachkov added a comment. @yaxunl could you please review this patch? It fixes a bug in a feature implemented by you in: commit c6fb598a301143e9d21156a012cc6ef669ff0188 Author: Yaxun Liu Date: Sun Dec 18 05:18:55 2016 + Recommit r289979 [OpenCL] Allow disabling types and declarations associated with extensions Fixed undefined behavior due to cast integer to bool in initializer list. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290056 91177308-0d34-0410-b5e6-96231b3b80d8 https://reviews.llvm.org/D53200 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53200: [OpenCL] Fix serialization of OpenCLExtensionDecls
AlexeySachkov added inline comments. Comment at: test/Headers/opencl-pragma-extension-begin.cl:1 +// RUN: rm -rf %t +// RUN: mkdir -p %t Anastasia wrote: > I think the tests in this folder are for standard includes only but you are > testing custom include file here. > > Could this be integrated into test/SemaOpenCL/extension-begin.cl? Or if else > you could just move to that folder (it might be better to append module to > the name in that case). > I think the tests in this folder are for standard includes only but you are > testing custom include file here. Currently, standard include file doesn't contain begin/end ocl pragma directives and I decided to create a special one header for the test. I will integrate it into existing test for extension-begin pragma. https://reviews.llvm.org/D53200 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53200: [OpenCL] Fix serialization of OpenCLExtensionDecls
AlexeySachkov updated this revision to Diff 170601. AlexeySachkov added a comment. Updated tests https://reviews.llvm.org/D53200 Files: lib/Serialization/ASTWriter.cpp test/SemaOpenCL/extension-begin.cl test/SemaOpenCL/extension-begin.h Index: test/SemaOpenCL/extension-begin.h === --- /dev/null +++ test/SemaOpenCL/extension-begin.h @@ -0,0 +1,26 @@ +#ifndef INCLUDED +#define INCLUDED + +#pragma OPENCL EXTENSION all : begin +#pragma OPENCL EXTENSION all : end + +#pragma OPENCL EXTENSION my_ext : begin + +struct A { + int a; +}; + +typedef struct A TypedefOfA; +typedef const __private TypedefOfA* PointerOfA; + +void f(void); + +__attribute__((overloadable)) void g(long x); + +#pragma OPENCL EXTENSION my_ext : end +#pragma OPENCL EXTENSION my_ext : end + +__attribute__((overloadable)) void g(void); + +#endif // INCLUDED + Index: test/SemaOpenCL/extension-begin.cl === --- test/SemaOpenCL/extension-begin.cl +++ test/SemaOpenCL/extension-begin.cl @@ -1,37 +1,29 @@ // Test this without pch. -// RUN: %clang_cc1 %s -DHEADER -DHEADER_USER -triple spir-unknown-unknown -verify -pedantic -fsyntax-only +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only // Test with pch. -// RUN: %clang_cc1 %s -DHEADER -triple spir-unknown-unknown -emit-pch -o %t -verify -pedantic -// RUN: %clang_cc1 %s -DHEADER_USER -triple spir-unknown-unknown -include-pch %t -fsyntax-only -verify -pedantic - -#if defined(HEADER) && !defined(INCLUDED) -#define INCLUDED - -#pragma OPENCL EXTENSION all : begin // expected-warning {{expected 'disable' - ignoring}} -#pragma OPENCL EXTENSION all : end // expected-warning {{expected 'disable' - ignoring}} - -#pragma OPENCL EXTENSION my_ext : begin - -struct A { - int a; -}; - -typedef struct A TypedefOfA; -typedef const TypedefOfA* PointerOfA; - -void f(void); - -__attribute__((overloadable)) void g(long x); - -#pragma OPENCL EXTENSION my_ext : end -#pragma OPENCL EXTENSION my_ext : end // expected-warning {{OpenCL extension end directive mismatches begin directive - ignoring}} - -__attribute__((overloadable)) void g(void); - -#endif // defined(HEADER) && !defined(INCLUDED) - -#ifdef HEADER_USER +// RUN: %clang_cc1 -x cl %S/extension-begin.h -triple spir-unknown-unknown -emit-pch -o %t.pch -pedantic +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -include-pch %t.pch -DIMPLICIT_INCLUDE -DUSE_PCH -fsyntax-only -verify -pedantic + +// Test with modules +// RUN: rm -rf %t.modules +// RUN: mkdir -p %t.modules +// +// RUN: %clang_cc1 -cl-std=CL1.2 -DIMPLICIT_INCLUDE -include %S/extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.modules %s -verify -pedantic +// +// RUN: rm -rf %t.modules +// RUN: mkdir -p %t.modules +// +// RUN: %clang_cc1 -cl-std=CL2.0 -DIMPLICIT_INCLUDE -include %S/extension-begin.h -triple spir-unknown-unknown -O0 -emit-llvm -o - -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.modules %s -verify -pedantic + +#ifndef IMPLICIT_INCLUDE +#include "extension-begin.h" +#endif // IMPLICIT_INCLUDE +#ifndef USE_PCH +// expected-warning@extension-begin.h:4 {{expected 'disable' - ignoring}} +// expected-warning@extension-begin.h:5 {{expected 'disable' - ignoring}} +// expected-warning@extension-begin.h:21 {{OpenCL extension end directive mismatches begin directive - ignoring}} +#endif // USE_PCH #pragma OPENCL EXTENSION my_ext : enable void test_f1(void) { @@ -48,9 +40,7 @@ PointerOfA test_A_pointer; // expected-error {{use of type 'PointerOfA' (aka 'const struct A *') requires my_ext extension to be enabled}} f(); // expected-error {{use of declaration 'f' requires my_ext extension to be enabled}} g(0); // expected-error {{no matching function for call to 'g'}} -// expected-note@-26 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be disabled}} -// expected-note@-22 {{candidate function not viable: requires 0 arguments, but 1 was provided}} +// expected-note@extension-begin.h:18 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be disabled}} +// expected-note@extension-begin.h:23 {{candidate function not viable: requires 0 arguments, but 1 was provided}} } -#endif // HEADER_USER - Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -5014,13 +5014,16 @@ WriteFPPragmaOptions(SemaRef.getFPOptions()); WriteOpenCLExtensions(SemaRef); WriteOpenCLExtensionTypes(SemaRef); - WriteOpenCLExtensionDecls(SemaRef); WriteCUDAPragmas(SemaRef); // If we're emitting a module, write out the submodule information. if (WritingModule) WriteSubmodules(WritingModule); + // We need to have information about submodules to correctl
[PATCH] D52654: [OpenCL][NFC] Unify ZeroToOCL* cast types
AlexeySachkov updated this revision to Diff 170630. AlexeySachkov added a comment. Rebase to the ToT https://reviews.llvm.org/D52654 Files: include/clang/AST/OperationKinds.def include/clang/Sema/Initialization.h lib/AST/Expr.cpp lib/AST/ExprConstant.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprComplex.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CGExprScalar.cpp lib/Edit/RewriteObjCFoundationAPI.cpp lib/Sema/SemaCast.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaInit.cpp lib/StaticAnalyzer/Core/ExprEngineC.cpp Index: lib/StaticAnalyzer/Core/ExprEngineC.cpp === --- lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -412,8 +412,7 @@ case CK_BlockPointerToObjCPointerCast: case CK_AnyPointerToBlockPointerCast: case CK_ObjCObjectLValueCast: - case CK_ZeroToOCLEvent: - case CK_ZeroToOCLQueue: + case CK_ZeroToOCLOpaqueType: case CK_IntToOCLSampler: case CK_LValueBitCast: case CK_FixedPointCast: { Index: lib/Sema/SemaInit.cpp === --- lib/Sema/SemaInit.cpp +++ lib/Sema/SemaInit.cpp @@ -3261,8 +3261,7 @@ case SK_StdInitializerList: case SK_StdInitializerListConstructorCall: case SK_OCLSamplerInit: - case SK_OCLZeroEvent: - case SK_OCLZeroQueue: + case SK_OCLZeroOpaqueType: break; case SK_ConversionSequence: @@ -3548,16 +3547,9 @@ Steps.push_back(S); } -void InitializationSequence::AddOCLZeroEventStep(QualType T) { +void InitializationSequence::AddOCLZeroOpaqueTypeStep(QualType T) { Step S; - S.Kind = SK_OCLZeroEvent; - S.Type = T; - Steps.push_back(S); -} - -void InitializationSequence::AddOCLZeroQueueStep(QualType T) { - Step S; - S.Kind = SK_OCLZeroQueue; + S.Kind = SK_OCLZeroOpaqueType; S.Type = T; Steps.push_back(S); } @@ -5260,39 +5252,31 @@ return true; } -// -// OpenCL 1.2 spec, s6.12.10 -// -// The event argument can also be used to associate the -// async_work_group_copy with a previous async copy allowing -// an event to be shared by multiple async copies; otherwise -// event should be zero. -// -static bool TryOCLZeroEventInitialization(Sema &S, - InitializationSequence &Sequence, - QualType DestType, - Expr *Initializer) { - if (!S.getLangOpts().OpenCL || !DestType->isEventT() || - !Initializer->isIntegerConstantExpr(S.getASTContext()) || - (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0)) +static bool TryOCLZeroOpaqueTypeInitialization(Sema &S, + InitializationSequence &Sequence, + QualType DestType, + Expr *Initializer) { + if (!S.getLangOpts().OpenCL) return false; - Sequence.AddOCLZeroEventStep(DestType); - return true; -} + // + // OpenCL 1.2 spec, s6.12.10 + // + // The event argument can also be used to associate the + // async_work_group_copy with a previous async copy allowing + // an event to be shared by multiple async copies; otherwise + // event should be zero. + // + if (DestType->isEventT() || DestType->isQueueT()) { +if (!Initializer->isIntegerConstantExpr(S.getASTContext()) || +(Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0)) + return false; -static bool TryOCLZeroQueueInitialization(Sema &S, - InitializationSequence &Sequence, - QualType DestType, - Expr *Initializer) { - if (!S.getLangOpts().OpenCL || S.getLangOpts().OpenCLVersion < 200 || - !DestType->isQueueT() || - !Initializer->isIntegerConstantExpr(S.getASTContext()) || - (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0)) -return false; +Sequence.AddOCLZeroOpaqueTypeStep(DestType); +return true; + } - Sequence.AddOCLZeroQueueStep(DestType); - return true; + return false; } InitializationSequence::InitializationSequence(Sema &S, @@ -5566,12 +5550,9 @@ if (TryOCLSamplerInitialization(S, *this, DestType, Initializer)) return; -if (TryOCLZeroEventInitialization(S, *this, DestType, Initializer)) +if (TryOCLZeroOpaqueTypeInitialization(S, *this, DestType, Initializer)) return; -if (TryOCLZeroQueueInitialization(S, *this, DestType, Initializer)) - return; - // Handle initialization in C AddCAssignmentStep(DestType); MaybeProduceObjCObject(S, *this, Entity); @@ -7407,8 +7388,7 @@ case SK_ProduceObjCObject: case SK_StdInitializerList: case SK_OCLSamplerInit: - case SK_OCLZeroEvent: - case SK_OCLZeroQueue: { + case SK_OCLZeroOpaqueType: { assert(Arg
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov updated this revision to Diff 170657. AlexeySachkov added a comment. Applied comments. Rebased to ToT https://reviews.llvm.org/D51484 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/Type.h include/clang/Basic/OpenCLExtensionTypes.def include/clang/Basic/OpenCLExtensions.def include/clang/Sema/Initialization.h include/clang/Serialization/ASTBitCodes.h include/clang/module.modulemap lib/AST/ASTContext.cpp lib/AST/ASTImporter.cpp lib/AST/ExprConstant.cpp lib/AST/ItaniumMangle.cpp lib/AST/MicrosoftMangle.cpp lib/AST/NSAPI.cpp lib/AST/Type.cpp lib/AST/TypeLoc.cpp lib/Analysis/PrintfFormatString.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CGOpenCLRuntime.cpp lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/Headers/opencl-c.h lib/Index/USRGeneration.cpp lib/Sema/Sema.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaInit.cpp lib/Serialization/ASTCommon.cpp lib/Serialization/ASTReader.cpp test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl test/Headers/opencl-c-header.cl test/Index/opencl-types.cl test/SemaOpenCL/extension-version.cl test/SemaOpenCL/intel-subgroup-avc-ext-types.cl tools/libclang/CIndex.cpp tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -70,6 +70,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) BTCASE(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) BTCASE(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" BTCASE(OCLSampler); BTCASE(OCLEvent); BTCASE(OCLQueue); @@ -605,6 +607,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) TKIND(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) TKIND(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" TKIND(OCLSampler); TKIND(OCLEvent); TKIND(OCLQueue); Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1519,6 +1519,9 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ case BuiltinType::Id: #include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) \ + case BuiltinType::Id: +#include "clang/Basic/OpenCLExtensionTypes.def" case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: case BuiltinType::OCLClkEvent: Index: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl === --- /dev/null +++ test/SemaOpenCL/intel-subgroup-avc-ext-types.cl @@ -0,0 +1,105 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -cl-ext=+cl_intel_device_side_avc_motion_estimation -fsyntax-only -verify %s + +#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable + +// All intel_sub_group_avc_* types can only be used as argument or return value +// of built-in functions defined in the extension. +// But there are also additional initialization rules: +// * All types except intel_sub_group_avc_mce_* types can be initialized with +// the corresponding initializer macro defined in opencl-c.h +// Currently all these macroses are defined as 0x0 +// * In previous versions of the extension these macroses was defined as {0}, +// so initialization with initializer list containing one integer equal to +// zero should also work + +struct st{}; +// negative test cases for initializers +void foo(char c, float f, void* v, struct st ss) { + intel_sub_group_avc_mce_payload_t payload_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ime_payload_t payload_ime = 1; // No literal initializer for *payload_t types + // expected-error@-1 {{initializing 'intel_sub_group_avc_ime_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ref_payload_t payload_ref = f; + // expected-error@-1 {{initializing 'intel_sub_group_avc_ref_payload_t' with an expression of incompatible type 'float'}} + intel_sub_group_avc_sic_payload_t payload_sic = ss; + // expected-error@-1 {{initializing 'intel_sub_group_avc_sic_payload_t' with an expression of incompatible type 'struct st'}} + + intel_sub_group_avc_mce_result_t result_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_result_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ime_result_t result_ime = 1; // No literal initializer for *result_t types + // expected-error@-1 {{initializing 'intel_sub_group_avc_ime_result_t' with an ex
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov marked 2 inline comments as done. AlexeySachkov added inline comments. Comment at: lib/Headers/opencl-c.h:16197 +#ifdef cl_intel_device_side_avc_motion_estimation +#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable + Anastasia wrote: > Anastasia wrote: > > Should we be using: > > #pragma OPENCL EXTENSION my_ext : begin > > then the user can get correct diagnostics that the functions can only be > > used once the extension is enabled. > Would it be better to use `begin`/`end` instead of `enable`/`disable`? Done, but https://reviews.llvm.org/D53200 have to be landed first to avoid failures in LIT tests https://reviews.llvm.org/D51484 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53200: [OpenCL] Fix serialization of OpenCLExtensionDecls
AlexeySachkov added inline comments. Comment at: test/SemaOpenCL/extension-begin.cl:43 g(0); // expected-error {{no matching function for call to 'g'}} -// expected-note@-26 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be disabled}} -// expected-note@-22 {{candidate function not viable: requires 0 arguments, but 1 was provided}} +// expected-note@extension-begin.h:18 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be disabled}} +// expected-note@extension-begin.h:23 {{candidate function not viable: requires 0 arguments, but 1 was provided}} Anastasia wrote: > Is this a typo? Should this be 'enabled' instead of 'disabled'? I left the diagnostic message the same as it was. Looks like it is a bug in the diagnostic. I can try to fix it, but I would like to do it in a separate patch https://reviews.llvm.org/D53200 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54152: [OpenCL] Fix diagnostic message about overload candidates
AlexeySachkov created this revision. AlexeySachkov added reviewers: asavonic, Anastasia. Herald added a subscriber: yaxunl. I wonder if there are some extension which need to be disabled to get overloadable candidate available. Repository: rC Clang https://reviews.llvm.org/D54152 Files: include/clang/Basic/DiagnosticSemaKinds.td test/SemaOpenCL/extension-begin.cl Index: test/SemaOpenCL/extension-begin.cl === --- test/SemaOpenCL/extension-begin.cl +++ test/SemaOpenCL/extension-begin.cl @@ -40,7 +40,7 @@ PointerOfA test_A_pointer; // expected-error {{use of type 'PointerOfA' (aka 'const struct A *') requires my_ext extension to be enabled}} f(); // expected-error {{use of declaration 'f' requires my_ext extension to be enabled}} g(0); // expected-error {{no matching function for call to 'g'}} -// expected-note@extension-begin.h:18 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be disabled}} +// expected-note@extension-begin.h:18 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be enabled}} // expected-note@extension-begin.h:23 {{candidate function not viable: requires 0 arguments, but 1 was provided}} } Index: include/clang/Basic/DiagnosticSemaKinds.td === --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -3681,7 +3681,7 @@ def note_ovl_candidate_disabled_by_function_cond_attr : Note< "candidate disabled: %0">; def note_ovl_candidate_disabled_by_extension : Note< -"candidate unavailable as it requires OpenCL extension '%0' to be disabled">; +"candidate unavailable as it requires OpenCL extension '%0' to be enabled">; def err_addrof_function_disabled_by_enable_if_attr : Error< "cannot take address of function %0 because it has one or more " "non-tautological enable_if conditions">; Index: test/SemaOpenCL/extension-begin.cl === --- test/SemaOpenCL/extension-begin.cl +++ test/SemaOpenCL/extension-begin.cl @@ -40,7 +40,7 @@ PointerOfA test_A_pointer; // expected-error {{use of type 'PointerOfA' (aka 'const struct A *') requires my_ext extension to be enabled}} f(); // expected-error {{use of declaration 'f' requires my_ext extension to be enabled}} g(0); // expected-error {{no matching function for call to 'g'}} -// expected-note@extension-begin.h:18 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be disabled}} +// expected-note@extension-begin.h:18 {{candidate unavailable as it requires OpenCL extension 'my_ext' to be enabled}} // expected-note@extension-begin.h:23 {{candidate function not viable: requires 0 arguments, but 1 was provided}} } Index: include/clang/Basic/DiagnosticSemaKinds.td === --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -3681,7 +3681,7 @@ def note_ovl_candidate_disabled_by_function_cond_attr : Note< "candidate disabled: %0">; def note_ovl_candidate_disabled_by_extension : Note< -"candidate unavailable as it requires OpenCL extension '%0' to be disabled">; +"candidate unavailable as it requires OpenCL extension '%0' to be enabled">; def err_addrof_function_disabled_by_enable_if_attr : Error< "cannot take address of function %0 because it has one or more " "non-tautological enable_if conditions">; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov updated this revision to Diff 172917. AlexeySachkov added a comment. Updated opencl-c.h header: fixed typos in built-in declarations. Applied comment from Alexey https://reviews.llvm.org/D51484 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/Type.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/OpenCLExtensionTypes.def include/clang/Basic/OpenCLExtensions.def include/clang/Sema/Initialization.h include/clang/Serialization/ASTBitCodes.h include/clang/module.modulemap lib/AST/ASTContext.cpp lib/AST/ASTImporter.cpp lib/AST/ExprConstant.cpp lib/AST/ItaniumMangle.cpp lib/AST/MicrosoftMangle.cpp lib/AST/NSAPI.cpp lib/AST/PrintfFormatString.cpp lib/AST/Type.cpp lib/AST/TypeLoc.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CGOpenCLRuntime.cpp lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/Headers/opencl-c.h lib/Index/USRGeneration.cpp lib/Sema/Sema.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaInit.cpp lib/Serialization/ASTCommon.cpp lib/Serialization/ASTReader.cpp test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl test/Headers/opencl-c-header.cl test/Index/opencl-types.cl test/SemaOpenCL/extension-begin.cl test/SemaOpenCL/extension-version.cl test/SemaOpenCL/intel-subgroup-avc-ext-types.cl tools/libclang/CIndex.cpp tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -70,6 +70,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) BTCASE(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) BTCASE(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" BTCASE(OCLSampler); BTCASE(OCLEvent); BTCASE(OCLQueue); @@ -605,6 +607,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) TKIND(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) TKIND(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" TKIND(OCLSampler); TKIND(OCLEvent); TKIND(OCLQueue); Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1519,6 +1519,9 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ case BuiltinType::Id: #include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) \ + case BuiltinType::Id: +#include "clang/Basic/OpenCLExtensionTypes.def" case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: case BuiltinType::OCLClkEvent: Index: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl === --- /dev/null +++ test/SemaOpenCL/intel-subgroup-avc-ext-types.cl @@ -0,0 +1,105 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -cl-ext=+cl_intel_device_side_avc_motion_estimation -fsyntax-only -verify %s + +#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable + +// All intel_sub_group_avc_* types can only be used as argument or return value +// of built-in functions defined in the extension. +// But there are also additional initialization rules: +// * All types except intel_sub_group_avc_mce_* types can be initialized with +// the corresponding initializer macro defined in opencl-c.h +// Currently all these macroses are defined as 0x0 +// * In previous versions of the extension these macroses was defined as {0}, +// so initialization with initializer list containing one integer equal to +// zero should also work + +struct st{}; +// negative test cases for initializers +void foo(char c, float f, void* v, struct st ss) { + intel_sub_group_avc_mce_payload_t payload_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ime_payload_t payload_ime = 1; // No literal initializer for *payload_t types + // expected-error@-1 {{initializing 'intel_sub_group_avc_ime_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ref_payload_t payload_ref = f; + // expected-error@-1 {{initializing 'intel_sub_group_avc_ref_payload_t' with an expression of incompatible type 'float'}} + intel_sub_group_avc_sic_payload_t payload_sic = ss; + // expected-error@-1 {{initializing 'intel_sub_group_avc_sic_payload_t' with an expression of incompatible type 'struct st'}} + + intel_sub_group_avc_mce_result_t result_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_result_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ime_result_t result_i
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov updated this revision to Diff 172946. AlexeySachkov added a comment. Rebased to ToT. https://reviews.llvm.org/D51484 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/Type.h include/clang/Basic/OpenCLExtensionTypes.def include/clang/Basic/OpenCLExtensions.def include/clang/Sema/Initialization.h include/clang/Serialization/ASTBitCodes.h include/clang/module.modulemap lib/AST/ASTContext.cpp lib/AST/ASTImporter.cpp lib/AST/ExprConstant.cpp lib/AST/ItaniumMangle.cpp lib/AST/MicrosoftMangle.cpp lib/AST/NSAPI.cpp lib/AST/PrintfFormatString.cpp lib/AST/Type.cpp lib/AST/TypeLoc.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CGOpenCLRuntime.cpp lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/Headers/opencl-c.h lib/Index/USRGeneration.cpp lib/Sema/Sema.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaInit.cpp lib/Serialization/ASTCommon.cpp lib/Serialization/ASTReader.cpp test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl test/Headers/opencl-c-header.cl test/Index/opencl-types.cl test/SemaOpenCL/extension-version.cl test/SemaOpenCL/intel-subgroup-avc-ext-types.cl tools/libclang/CIndex.cpp tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -70,6 +70,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) BTCASE(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) BTCASE(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" BTCASE(OCLSampler); BTCASE(OCLEvent); BTCASE(OCLQueue); @@ -605,6 +607,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) TKIND(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) TKIND(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" TKIND(OCLSampler); TKIND(OCLEvent); TKIND(OCLQueue); Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1519,6 +1519,9 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ case BuiltinType::Id: #include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) \ + case BuiltinType::Id: +#include "clang/Basic/OpenCLExtensionTypes.def" case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: case BuiltinType::OCLClkEvent: Index: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl === --- /dev/null +++ test/SemaOpenCL/intel-subgroup-avc-ext-types.cl @@ -0,0 +1,105 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -cl-ext=+cl_intel_device_side_avc_motion_estimation -fsyntax-only -verify %s + +#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable + +// All intel_sub_group_avc_* types can only be used as argument or return value +// of built-in functions defined in the extension. +// But there are also additional initialization rules: +// * All types except intel_sub_group_avc_mce_* types can be initialized with +// the corresponding initializer macro defined in opencl-c.h +// Currently all these macroses are defined as 0x0 +// * In previous versions of the extension these macroses was defined as {0}, +// so initialization with initializer list containing one integer equal to +// zero should also work + +struct st{}; +// negative test cases for initializers +void foo(char c, float f, void* v, struct st ss) { + intel_sub_group_avc_mce_payload_t payload_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ime_payload_t payload_ime = 1; // No literal initializer for *payload_t types + // expected-error@-1 {{initializing 'intel_sub_group_avc_ime_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ref_payload_t payload_ref = f; + // expected-error@-1 {{initializing 'intel_sub_group_avc_ref_payload_t' with an expression of incompatible type 'float'}} + intel_sub_group_avc_sic_payload_t payload_sic = ss; + // expected-error@-1 {{initializing 'intel_sub_group_avc_sic_payload_t' with an expression of incompatible type 'struct st'}} + + intel_sub_group_avc_mce_result_t result_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_result_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ime_result_t result_ime = 1; // No literal initializer for *result_t types + // expected-error@-1 {{initializing 'intel_sub_group_avc_ime_result_t' with an expression of incompatib
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov updated this revision to Diff 173130. AlexeySachkov changed the repository for this revision from rL LLVM to rC Clang. AlexeySachkov removed a subscriber: llvm-commits. AlexeySachkov added a comment. Fixed issue in `test/Index/opencl-types.cl` Repository: rC Clang https://reviews.llvm.org/D51484 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/Type.h include/clang/Basic/OpenCLExtensionTypes.def include/clang/Basic/OpenCLExtensions.def include/clang/Sema/Initialization.h include/clang/Serialization/ASTBitCodes.h include/clang/module.modulemap lib/AST/ASTContext.cpp lib/AST/ASTImporter.cpp lib/AST/ExprConstant.cpp lib/AST/ItaniumMangle.cpp lib/AST/MicrosoftMangle.cpp lib/AST/NSAPI.cpp lib/AST/PrintfFormatString.cpp lib/AST/Type.cpp lib/AST/TypeLoc.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CGOpenCLRuntime.cpp lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/Headers/opencl-c.h lib/Index/USRGeneration.cpp lib/Sema/Sema.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaInit.cpp lib/Serialization/ASTCommon.cpp lib/Serialization/ASTReader.cpp test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl test/Headers/opencl-c-header.cl test/Index/opencl-types.cl test/SemaOpenCL/extension-version.cl test/SemaOpenCL/intel-subgroup-avc-ext-types.cl tools/libclang/CIndex.cpp tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -70,6 +70,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) BTCASE(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) BTCASE(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" BTCASE(OCLSampler); BTCASE(OCLEvent); BTCASE(OCLQueue); @@ -605,6 +607,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) TKIND(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) TKIND(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" TKIND(OCLSampler); TKIND(OCLEvent); TKIND(OCLQueue); Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1519,6 +1519,9 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ case BuiltinType::Id: #include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) \ + case BuiltinType::Id: +#include "clang/Basic/OpenCLExtensionTypes.def" case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: case BuiltinType::OCLClkEvent: Index: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl === --- /dev/null +++ test/SemaOpenCL/intel-subgroup-avc-ext-types.cl @@ -0,0 +1,105 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -cl-ext=+cl_intel_device_side_avc_motion_estimation -fsyntax-only -verify %s + +#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable + +// All intel_sub_group_avc_* types can only be used as argument or return value +// of built-in functions defined in the extension. +// But there are also additional initialization rules: +// * All types except intel_sub_group_avc_mce_* types can be initialized with +// the corresponding initializer macro defined in opencl-c.h +// Currently all these macroses are defined as 0x0 +// * In previous versions of the extension these macroses was defined as {0}, +// so initialization with initializer list containing one integer equal to +// zero should also work + +struct st{}; +// negative test cases for initializers +void foo(char c, float f, void* v, struct st ss) { + intel_sub_group_avc_mce_payload_t payload_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ime_payload_t payload_ime = 1; // No literal initializer for *payload_t types + // expected-error@-1 {{initializing 'intel_sub_group_avc_ime_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ref_payload_t payload_ref = f; + // expected-error@-1 {{initializing 'intel_sub_group_avc_ref_payload_t' with an expression of incompatible type 'float'}} + intel_sub_group_avc_sic_payload_t payload_sic = ss; + // expected-error@-1 {{initializing 'intel_sub_group_avc_sic_payload_t' with an expression of incompatible type 'struct st'}} + + intel_sub_group_avc_mce_result_t result_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_result_t' with an expression of incompatible type 'int'}} + intel_sub_group_av
[PATCH] D54253: [OpenCL][NFC] Improve test coverage of test/Index/opencl-types.cl
AlexeySachkov created this revision. AlexeySachkov added reviewers: Anastasia, asavonic. Herald added subscribers: arphaman, yaxunl. The problem here is that test only checks default target. I recently introduced regression which wasn't detected by local testing: I missed that some declarations might be '(invalid)' on different platforms. Repository: rC Clang https://reviews.llvm.org/D54253 Files: test/Index/opencl-types.cl Index: test/Index/opencl-types.cl === --- test/Index/opencl-types.cl +++ test/Index/opencl-types.cl @@ -1,4 +1,6 @@ // RUN: c-index-test -test-print-type %s -cl-std=CL2.0 | FileCheck %s +// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 --target=ppc64le | FileCheck %s +// RUN: c-index-test -test-print-type %s -cl-std=CL2.0 --target=arm | FileCheck %s #pragma OPENCL EXTENSION cl_khr_fp16 : enable #pragma OPENCL EXTENSION cl_khr_fp64 : enable @@ -16,12 +18,12 @@ double4 vectorDouble; } -// CHECK: VarDecl=scalarHalf:11:8 (Definition){{( \(invalid\))?}} [type=half] [typekind=Half] [isPOD=1] -// CHECK: VarDecl=vectorHalf:12:9 (Definition) [type=half4] [typekind=Typedef] [canonicaltype=half __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] -// CHECK: VarDecl=scalarFloat:13:9 (Definition) [type=float] [typekind=Float] [isPOD=1] -// CHECK: VarDecl=vectorFloat:14:10 (Definition) [type=float4] [typekind=Typedef] [canonicaltype=float __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] -// CHECK: VarDecl=scalarDouble:15:10 (Definition){{( \(invalid\))?}} [type=double] [typekind=Double] [isPOD=1] -// CHECK: VarDecl=vectorDouble:16:11 (Definition){{( \(invalid\))?}} [type=double4] [typekind=Typedef] [canonicaltype=double __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] +// CHECK: VarDecl=scalarHalf:13:8 (Definition){{( \(invalid\))?}} [type=half] [typekind=Half] [isPOD=1] +// CHECK: VarDecl=vectorHalf:14:9 (Definition) [type=half4] [typekind=Typedef] [canonicaltype=half __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] +// CHECK: VarDecl=scalarFloat:15:9 (Definition) [type=float] [typekind=Float] [isPOD=1] +// CHECK: VarDecl=vectorFloat:16:10 (Definition) [type=float4] [typekind=Typedef] [canonicaltype=float __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] +// CHECK: VarDecl=scalarDouble:17:10 (Definition){{( \(invalid\))?}} [type=double] [typekind=Double] [isPOD=1] +// CHECK: VarDecl=vectorDouble:18:11 (Definition){{( \(invalid\))?}} [type=double4] [typekind=Typedef] [canonicaltype=double __attribute__((ext_vector_type(4)))] [canonicaltypekind=Unexposed] [isPOD=1] #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable @@ -38,18 +40,18 @@ void kernel OCLImage2dArrayMSAADepthROTest(read_only image2d_array_msaa_depth_t scalarOCLImage2dArrayMSAADepthRO); void kernel OCLImage3dROTest(read_only image3d_t scalarOCLImage3dRO); -// CHECK: ParmDecl=scalarOCLImage1dRO:28:50 (Definition) [type=__read_only image1d_t] [typekind=OCLImage1dRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage1dArrayRO:29:61 (Definition) [type=__read_only image1d_array_t] [typekind=OCLImage1dArrayRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage1dBufferRO:30:63 (Definition) [type=__read_only image1d_buffer_t] [typekind=OCLImage1dBufferRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dRO:31:50 (Definition) [type=__read_only image2d_t] [typekind=OCLImage2dRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayRO:32:61 (Definition) [type=__read_only image2d_array_t] [typekind=OCLImage2dArrayRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dDepthRO:33:61 (Definition) [type=__read_only image2d_depth_t] [typekind=OCLImage2dDepthRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayDepthRO:34:72 (Definition) [type=__read_only image2d_array_depth_t] [typekind=OCLImage2dArrayDepthRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dMSAARO:35:59 (Definition){{( \(invalid\))?}} [type=__read_only image2d_msaa_t] [typekind=OCLImage2dMSAARO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayMSAARO:36:70 (Definition){{( \(invalid\))?}} [type=__read_only image2d_array_msaa_t] [typekind=OCLImage2dArrayMSAARO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dMSAADepthRO:37:70 (Definition){{( \(invalid\))?}} [type=__read_only image2d_msaa_depth_t] [typekind=OCLImage2dMSAADepthRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage2dArrayMSAADepthRO:38:81 (Definition){{( \(invalid\))?}} [type=__read_only image2d_array_msaa_depth_t] [typekind=OCLImage2dArrayMSAADepthRO] [isPOD=1] -// CHECK: ParmDecl=scalarOCLImage3dRO:39:50 (Definition) [type=__read_only image3d_t] [typekind=OCLImage3dRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dRO:30:50 (Definition) [type=__read_only image1d_t] [typekind=OCLImage1dRO] [isPOD=1] +// CHECK: ParmDecl=scalarOCLImage1dArrayRO:31:61 (Definition) [type=__read_only image1d_array_t] [typekind=OCLImage1dArray
[PATCH] D54253: [OpenCL][NFC] Improve test coverage of test/Index/opencl-types.cl
AlexeySachkov added a comment. If I understand correctly, not all extensions are available on non-x86 targets and some declarations are marked as `(invalid)` - that is the only difference I saw Repository: rC Clang https://reviews.llvm.org/D54253 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54253: [OpenCL][NFC] Improve test coverage of test/Index/opencl-types.cl
AlexeySachkov added a comment. I'm running OpenCL on an x886 and everything is fine, but there are a lot of build bots which build different targets on different architectures. Since there are no `target` option specified, `c-index-test` uses native target. I just realized: may be it is better to add something like `// REQUIRES: x86` to the test? Repository: rC Clang https://reviews.llvm.org/D54253 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D54253: [OpenCL] Launch opencl-types.cl test only on x86
AlexeySachkov updated this revision to Diff 174919. AlexeySachkov retitled this revision from "[OpenCL][NFC] Improve test coverage of test/Index/opencl-types.cl" to "[OpenCL] Launch opencl-types.cl test only on x86". AlexeySachkov edited the summary of this revision. AlexeySachkov added a comment. Simplified patch. Updated title and description https://reviews.llvm.org/D54253 Files: test/Index/opencl-types.cl Index: test/Index/opencl-types.cl === --- test/Index/opencl-types.cl +++ test/Index/opencl-types.cl @@ -1,4 +1,5 @@ // RUN: c-index-test -test-print-type %s -cl-std=CL2.0 | FileCheck %s +// REQUIRES: x86 #pragma OPENCL EXTENSION cl_khr_fp16 : enable #pragma OPENCL EXTENSION cl_khr_fp64 : enable Index: test/Index/opencl-types.cl === --- test/Index/opencl-types.cl +++ test/Index/opencl-types.cl @@ -1,4 +1,5 @@ // RUN: c-index-test -test-print-type %s -cl-std=CL2.0 | FileCheck %s +// REQUIRES: x86 #pragma OPENCL EXTENSION cl_khr_fp16 : enable #pragma OPENCL EXTENSION cl_khr_fp64 : enable ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov added inline comments. Comment at: include/clang/Basic/OpenCLExtensionTypes.def:27 + +INTEL_SGAVC_TYPE(mce_payload_t, McePayload) +INTEL_SGAVC_TYPE(ime_payload_t, ImePayload) Anastasia wrote: > AlexeySotkin wrote: > > Anastasia wrote: > > > AlexeySachkov wrote: > > > > Anastasia wrote: > > > > > From the specification of this extension I can't quite see if these > > > > > types have to be in Clang instead of the header. Can you please > > > > > elaborate on any example where it wouldn't be possible for this type > > > > > to be declared in the header using the technique explained in: > > > > > https://clang.llvm.org/docs/UsersManual.html#opencl-extensions > > > > We cannot define these types in header because their layout is not > > > > defined in specification, i.e. all of these types are opaque > > > This is not the reason to add functionality to Clang. You can easily sort > > > such things with target specific headers or even general headers (see > > > `ndrange_t` for example). Spec doesn't have to describe everything. The > > > question is whether there is something about those types that can't be > > > handled using standard include mechanisms. Usually it's prohibited > > > behaviors that can't be represented with such mechanisms. Like if some > > > operations have to be disallowed or allowed (since in OpenCL C you can't > > > define user defined operators) with the types. > > > > > > I think the trend is to avoid adding complexity into Clang, unless there > > > is no other way to implement some feature correctly. > > Major part of these types must support initialization only by zero. > > intel_sub_group_avc_mce_payload_t and intel_sub_group_avc_mce_result_t must > > support initialization only via special builtins defined in the spec. > > Corresponding errors must be reported. I think we can't implement this > > behavior using standard include mechanism, can we? > > > > Possible value of the additional complexity, except builtin declaration, is > > that the patch is quite generic. So next time anyone wants to implement an > > extension with a type restrictions which can't be handled with the include > > mechanism, all that they needs to do is to modify this single file. > > Major part of these types must support initialization only by zero. > > intel_sub_group_avc_mce_payload_t and intel_sub_group_avc_mce_result_t must > > support initialization only via special builtins defined in the spec. > > Corresponding errors must be reported. I think we can't implement this > > behavior using standard include mechanism, can we? > > Are these restrictions not mentioned in the specification document then? Or > is it not the final version yet (not sure since it says First Draft). Do you > plan to add the diagnostics for the restrictions afterwards? It doesn't have > to be in the same patch, but just checking because if not I don't think it > would make sense to go this route. > > > Possible value of the additional complexity, except builtin declaration, is > > that the patch is quite generic. So next time anyone wants to implement an > > extension with a type restrictions which can't be handled with the include > > mechanism, all that they needs to do is to modify this single file. > > > > It seems reasonable to implement this extra mechanism, provided that there > are more of similar use cases. > > Btw, considering that there are some modifications to core language spec > restriction sections in this document, does this extension invalidate or > change any core language rules that might affect parsing/diagnostics? > > > Are these restrictions not mentioned in the specification document then? Or > is it not the final version yet (not sure since it says First Draft). Current version of spec is not very clear regarding all these restrictions. I'm working with authors to get updated version published at Khronos registry. > Do you plan to add the diagnostics for the restrictions afterwards? Yes, I'm going to update this patch and add some tests for Sema > Btw, considering that there are some modifications to core language spec > restriction sections in this document, does this extension invalidate or > change any core language rules that might affect parsing/diagnostics? AFAIK extension describes a new one kind of sampler and initialization rules for it. This new sampler reusing existing sampler_t type, but value of initializer macro doesn't correspond to existing OpenCL spec: next version of patch will hide one warning message: > if (FilterMode != 1 && FilterMode != 2 && > !S.getOpenCLOptions().isEnabled( > "cl_intel_device_side_avc_motion_estimation")) > S.Diag(Kind.getLocation(), >diag::warn_sampler_initializer_invalid_bits) ><< "Filter Mode"; Repository: rC Clang https://reviews.llvm.org/D51484 _
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov updated this revision to Diff 166423. AlexeySachkov added a comment. Updated patch with new functionality and tests https://reviews.llvm.org/D51484 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/OperationKinds.def include/clang/AST/Type.h include/clang/Basic/OpenCLExtensionTypes.def include/clang/Basic/OpenCLExtensions.def include/clang/Sema/Initialization.h include/clang/Serialization/ASTBitCodes.h include/clang/module.modulemap lib/AST/ASTContext.cpp lib/AST/ASTImporter.cpp lib/AST/Expr.cpp lib/AST/ExprConstant.cpp lib/AST/ItaniumMangle.cpp lib/AST/MicrosoftMangle.cpp lib/AST/NSAPI.cpp lib/AST/Type.cpp lib/AST/TypeLoc.cpp lib/Analysis/PrintfFormatString.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprComplex.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CGOpenCLRuntime.cpp lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/Edit/RewriteObjCFoundationAPI.cpp lib/Headers/opencl-c.h lib/Index/USRGeneration.cpp lib/Sema/Sema.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaInit.cpp lib/Serialization/ASTCommon.cpp lib/Serialization/ASTReader.cpp lib/StaticAnalyzer/Core/ExprEngineC.cpp test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl test/SemaOpenCL/extension-version.cl test/SemaOpenCL/intel-subgroup-avc-ext-types.cl tools/libclang/CIndex.cpp tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -70,6 +70,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) BTCASE(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) BTCASE(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" BTCASE(OCLSampler); BTCASE(OCLEvent); BTCASE(OCLQueue); @@ -605,6 +607,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) TKIND(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) TKIND(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" TKIND(OCLSampler); TKIND(OCLEvent); TKIND(OCLQueue); Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1519,6 +1519,9 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ case BuiltinType::Id: #include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) \ + case BuiltinType::Id: +#include "clang/Basic/OpenCLExtensionTypes.def" case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: case BuiltinType::OCLClkEvent: Index: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl === --- /dev/null +++ test/SemaOpenCL/intel-subgroup-avc-ext-types.cl @@ -0,0 +1,76 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -cl-ext=+cl_intel_device_side_avc_motion_estimation -fsyntax-only -verify -DNEGATIVE %s +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -cl-ext=+cl_intel_device_side_avc_motion_estimation -fsyntax-only -verify %s + +#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable + +// Having the initializers defined in the test allows us not to include default +// opencl header, and thus reducing test execution time. +// The initializers' values must match with ones defined in the default opencl +// header (clang/lib/Headers/opencl-c.h) + +#define CLK_AVC_ME_INITIALIZE_INTEL 0x0 + +#define CLK_AVC_IME_PAYLOAD_INITIALIZE_INTEL { 0 } +#define CLK_AVC_REF_PAYLOAD_INITIALIZE_INTEL { 0 } +#define CLK_AVC_SIC_PAYLOAD_INITIALIZE_INTEL { 0 } + +#define CLK_AVC_IME_RESULT_INITIALIZE_INTEL{ 0 } +#define CLK_AVC_REF_RESULT_INITIALIZE_INTEL{ 0 } +#define CLK_AVC_SIC_RESULT_INITIALIZE_INTEL{ 0 } + +#if defined NEGATIVE +struct st{}; +typedef char char4 __attribute__((ext_vector_type(4))); +void foo(bool b, char c, short s, long l, float f, double d, void* v, + char4 c4, event_t e, struct st ss) { + intel_sub_group_avc_mce_payload_t payload_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_ime_payload_t payload_ime = b; + // expected-error@-1 {{initializing 'intel_sub_group_avc_ime_payload_t' with an expression of incompatible type 'bool'}} + intel_sub_group_avc_ref_payload_t payload_ref = c; + // expected-error@-1 {{initializing 'intel_sub_group_avc_ref_payload_t' with an expression of incompatible type 'char'}} + intel_sub_group_avc_sic_payload_t payload_sic = s; + // expected-error@-1 {{initializing 'intel_sub_group_a
[PATCH] D52654: [OpenCL][NFC] Unify ZeroToOCL* cast types
AlexeySachkov created this revision. AlexeySachkov added reviewers: Anastasia, yaxunl. Repository: rC Clang https://reviews.llvm.org/D52654 Files: include/clang/AST/OperationKinds.def lib/AST/Expr.cpp lib/AST/ExprConstant.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprComplex.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CGExprScalar.cpp lib/Edit/RewriteObjCFoundationAPI.cpp lib/Sema/SemaCast.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaInit.cpp lib/StaticAnalyzer/Core/ExprEngineC.cpp Index: lib/StaticAnalyzer/Core/ExprEngineC.cpp === --- lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -412,8 +412,7 @@ case CK_BlockPointerToObjCPointerCast: case CK_AnyPointerToBlockPointerCast: case CK_ObjCObjectLValueCast: - case CK_ZeroToOCLEvent: - case CK_ZeroToOCLQueue: + case CK_ZeroToOCLOpaqueType: case CK_IntToOCLSampler: case CK_LValueBitCast: { state = Index: lib/Sema/SemaInit.cpp === --- lib/Sema/SemaInit.cpp +++ lib/Sema/SemaInit.cpp @@ -5260,39 +5260,39 @@ return true; } -// -// OpenCL 1.2 spec, s6.12.10 -// -// The event argument can also be used to associate the -// async_work_group_copy with a previous async copy allowing -// an event to be shared by multiple async copies; otherwise -// event should be zero. -// -static bool TryOCLZeroEventInitialization(Sema &S, - InitializationSequence &Sequence, - QualType DestType, - Expr *Initializer) { - if (!S.getLangOpts().OpenCL || !DestType->isEventT() || - !Initializer->isIntegerConstantExpr(S.getASTContext()) || - (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0)) +static bool TryOCLZeroOpaqueTypeInitialization(Sema &S, + InitializationSequence &Sequence, + QualType DestType, + Expr *Initializer) { + if (!S.getLangOpts().OpenCL) return false; - Sequence.AddOCLZeroEventStep(DestType); - return true; -} + // + // OpenCL 1.2 spec, s6.12.10 + // + // The event argument can also be used to associate the + // async_work_group_copy with a previous async copy allowing + // an event to be shared by multiple async copies; otherwise + // event should be zero. + // + if (DestType->isEventT()) { +if (!Initializer->isIntegerConstantExpr(S.getASTContext()) || +(Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0)) + return false; +Sequence.AddOCLZeroEventStep(DestType); +return true; + } -static bool TryOCLZeroQueueInitialization(Sema &S, - InitializationSequence &Sequence, - QualType DestType, - Expr *Initializer) { - if (!S.getLangOpts().OpenCL || S.getLangOpts().OpenCLVersion < 200 || - !DestType->isQueueT() || - !Initializer->isIntegerConstantExpr(S.getASTContext()) || - (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0)) -return false; + if (DestType->isQueueT() && S.getLangOpts().OpenCLVersion >= 200) { +if (!Initializer->isIntegerConstantExpr(S.getASTContext()) || +(Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0)) + return false; - Sequence.AddOCLZeroQueueStep(DestType); - return true; +Sequence.AddOCLZeroQueueStep(DestType); +return true; + } + + return false; } InitializationSequence::InitializationSequence(Sema &S, @@ -5566,12 +5566,9 @@ if (TryOCLSamplerInitialization(S, *this, DestType, Initializer)) return; -if (TryOCLZeroEventInitialization(S, *this, DestType, Initializer)) +if (TryOCLZeroOpaqueTypeInitialization(S, *this, DestType, Initializer)) return; -if (TryOCLZeroQueueInitialization(S, *this, DestType, Initializer)) - return; - // Handle initialization in C AddCAssignmentStep(DestType); MaybeProduceObjCObject(S, *this, Entity); @@ -8048,21 +8045,13 @@ CK_IntToOCLSampler); break; } -case SK_OCLZeroEvent: { - assert(Step->Type->isEventT() && - "Event initialization on non-event type."); - - CurInit = S.ImpCastExprToType(CurInit.get(), Step->Type, -CK_ZeroToOCLEvent, -CurInit.get()->getValueKind()); - break; -} +case SK_OCLZeroEvent: case SK_OCLZeroQueue: { - assert(Step->Type->isQueueT() && - "Event initialization on non queue type."); + assert((Step->Type->isEventT() || Step->Type->isQueueT()) && +
[PATCH] D52654: [OpenCL][NFC] Unify ZeroToOCL* cast types
AlexeySachkov added a comment. This is an initial version. I guess there are some other enums related to CK_ZeroToOCL* which also can be merged. Also, I'm not sure that `CK_ZeroToOCLOpaqueType` is a good name. Thoughts? Repository: rC Clang https://reviews.llvm.org/D52654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov updated this revision to Diff 168115. AlexeySachkov added a comment. Herald added a subscriber: arphaman. Applied comments from Anastasia. Updated headers to conform with the latest spec https://reviews.llvm.org/D51484 Files: include/clang-c/Index.h include/clang/AST/ASTContext.h include/clang/AST/OperationKinds.def include/clang/AST/Type.h include/clang/Basic/OpenCLExtensionTypes.def include/clang/Basic/OpenCLExtensions.def include/clang/Sema/Initialization.h include/clang/Serialization/ASTBitCodes.h include/clang/module.modulemap lib/AST/ASTContext.cpp lib/AST/ASTImporter.cpp lib/AST/Expr.cpp lib/AST/ExprConstant.cpp lib/AST/ItaniumMangle.cpp lib/AST/MicrosoftMangle.cpp lib/AST/NSAPI.cpp lib/AST/Type.cpp lib/AST/TypeLoc.cpp lib/Analysis/PrintfFormatString.cpp lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprComplex.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CGExprScalar.cpp lib/CodeGen/CGOpenCLRuntime.cpp lib/CodeGen/CodeGenTypes.cpp lib/CodeGen/ItaniumCXXABI.cpp lib/Edit/RewriteObjCFoundationAPI.cpp lib/Headers/opencl-c.h lib/Index/USRGeneration.cpp lib/Sema/Sema.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaInit.cpp lib/Serialization/ASTCommon.cpp lib/Serialization/ASTReader.cpp lib/StaticAnalyzer/Core/ExprEngineC.cpp test/CodeGenOpenCL/intel-subgroups-avc-ext-types.cl test/Headers/opencl-c-header.cl test/SemaOpenCL/extension-version.cl test/SemaOpenCL/intel-subgroup-avc-ext-types.cl tools/libclang/CIndex.cpp tools/libclang/CXType.cpp Index: tools/libclang/CXType.cpp === --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -70,6 +70,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) BTCASE(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) BTCASE(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" BTCASE(OCLSampler); BTCASE(OCLEvent); BTCASE(OCLQueue); @@ -605,6 +607,8 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) TKIND(Id); #include "clang/Basic/OpenCLImageTypes.def" #undef IMAGE_TYPE +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) TKIND(Id); +#include "clang/Basic/OpenCLExtensionTypes.def" TKIND(OCLSampler); TKIND(OCLEvent); TKIND(OCLQueue); Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -1519,6 +1519,9 @@ #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ case BuiltinType::Id: #include "clang/Basic/OpenCLImageTypes.def" +#define EXT_OPAQUE_TYPE(ExtTYpe, Id, Ext) \ + case BuiltinType::Id: +#include "clang/Basic/OpenCLExtensionTypes.def" case BuiltinType::OCLSampler: case BuiltinType::OCLEvent: case BuiltinType::OCLClkEvent: Index: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl === --- /dev/null +++ test/SemaOpenCL/intel-subgroup-avc-ext-types.cl @@ -0,0 +1,108 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=CL1.2 -cl-ext=+cl_intel_device_side_avc_motion_estimation -fsyntax-only -verify %s + +#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : enable + +// Having the initializers defined in the test allows us not to include default +// opencl header, and thus reducing test execution time. +// The initializers' values must match with ones defined in the default opencl +// header (clang/lib/Headers/opencl-c.h) + +#define CLK_AVC_ME_INITIALIZE_INTEL 0x0 + +#define CLK_AVC_IME_PAYLOAD_INITIALIZE_INTEL 0x0 +#define CLK_AVC_REF_PAYLOAD_INITIALIZE_INTEL 0x0 +#define CLK_AVC_SIC_PAYLOAD_INITIALIZE_INTEL 0x0 + +#define CLK_AVC_IME_RESULT_INITIALIZE_INTEL 0x0 +#define CLK_AVC_REF_RESULT_INITIALIZE_INTEL 0x0 +#define CLK_AVC_SIC_RESULT_INITIALIZE_INTEL 0x0 + +#define CLK_AVC_IME_RESULT_SINGLE_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0 +#define CLK_AVC_IME_RESULT_SINGLE_REFERENCE_STREAMIN_INITIALIZE_INTEL 0x0 +#define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0 +#define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMIN_INITIALIZE_INTEL 0x0 + +// negative test cases +struct st{}; +typedef char char4 __attribute__((ext_vector_type(4))); +void foo(bool b, char c, short s, long l, float f, double d, void* v, + char4 c4, event_t e, struct st ss) { + intel_sub_group_avc_mce_payload_t payload_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc_mce_payload_t payload_mce2 = 1; // No literal initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with an expression of incompatible type 'int'}} + intel_sub_group_avc
[PATCH] D51484: [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
AlexeySachkov marked 7 inline comments as done. AlexeySachkov added inline comments. Comment at: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl:13 + +#define CLK_AVC_IME_PAYLOAD_INITIALIZE_INTEL { 0 } +#define CLK_AVC_REF_PAYLOAD_INITIALIZE_INTEL { 0 } Anastasia wrote: > Just 0 would work too? Yes, it would Comment at: test/SemaOpenCL/intel-subgroup-avc-ext-types.cl:26 + char4 c4, event_t e, struct st ss) { + intel_sub_group_avc_mce_payload_t payload_mce = 0; // No zero initializer for mce types + // expected-error@-1 {{initializing 'intel_sub_group_avc_mce_payload_t' with an expression of incompatible type 'int'}} Anastasia wrote: > Would it make sense to add a check for non-zero constant? > > Also can you assign variables of intel_sub_group_avc_mce_payload_t type from > the same type? Any other restrictions on assignment (i.e. w integer literals) > and operations over these types? > Also can you assign variables of intel_sub_group_avc_mce_payload_t type from > the same type? Yes, such assignment is allowed. > Any other restrictions on assignment (i.e. w integer literals) All of these types can only be initialized using call to a special built-ins or using predefined macros like `CLK_AVC_REF_RESULT_INITIALIZE_INTEL`. Any other assignment should lead to an error. I found that I'm able to assign variable of type `intel_sub_group_avc_imc_payload_t` to variable of type `intel_sub_group_avc_mce_payload_t`, so I will update the patch when I implement such diagnostic message. > and operations over these types? Variables of these types can only be used as return values or arguments for built-in functions described in the specification. All other operations are restricted https://reviews.llvm.org/D51484 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D66324: clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM
AlexeySachkov added a comment. Looks like the issue is fixed in https://github.com/llvm/llvm-project/commit/6d2b75e0887ee87e247756c4d51733616bb2f356 Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66324/new/ https://reviews.llvm.org/D66324 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D71920: [AST] Refactor propagation of dependency bits. NFC
AlexeySachkov added inline comments. Comment at: clang/include/clang/AST/Type.h:1827-1830 +if (Dependent) + Deps |= TypeDependence::Dependent | TypeDependence::Instantiation; +if (InstantiationDependent) + Deps |= TypeDependence::Instantiation; @ilya-biryukov, Is this code snippet correct? It seems to be, that it should look like: ``` if (Dependent) Deps |= TypeDependence::Dependent; if (InstantiationDependent) Deps |= TypeDependence::Dependent | TypeDependence::Instantiation; ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71920/new/ https://reviews.llvm.org/D71920 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D71920: [AST] Refactor propagation of dependency bits. NFC
AlexeySachkov added inline comments. Comment at: clang/include/clang/AST/Type.h:1827-1830 +if (Dependent) + Deps |= TypeDependence::Dependent | TypeDependence::Instantiation; +if (InstantiationDependent) + Deps |= TypeDependence::Instantiation; sammccall wrote: > AlexeySachkov wrote: > > @ilya-biryukov, Is this code snippet correct? > > > > It seems to be, that it should look like: > > ``` > > if (Dependent) > > Deps |= TypeDependence::Dependent; > > if (InstantiationDependent) > > Deps |= TypeDependence::Dependent | TypeDependence::Instantiation; > > ``` > I agree that seems clearer, but ISTM they are equivalent because a dependent > type is always instantiation-dependent (right?) > > Are you seeing related problems? > Are you seeing related problems? I though I was seeing a related problem, but it turned out that I wasn't. Looking at the code again with a clear head, I believe that everything is correct here Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71920/new/ https://reviews.llvm.org/D71920 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits