diff options
author | Alexey Sotkin <alexey.sotkin@intel.com> | 2018-09-03 11:43:22 +0000 |
---|---|---|
committer | Alexey Sotkin <alexey.sotkin@intel.com> | 2018-09-03 11:43:22 +0000 |
commit | 73ae7cb4f12fb939a52fa16b12baa8afa48821cc (patch) | |
tree | 7f8f7923203b022cf4f7c8801be93f26e23a0175 /clang/lib/Sema/Sema.cpp | |
parent | e9e38c207e463b3806754b4eb7d836181c58a399 (diff) | |
download | bcm5719-llvm-73ae7cb4f12fb939a52fa16b12baa8afa48821cc.tar.gz bcm5719-llvm-73ae7cb4f12fb939a52fa16b12baa8afa48821cc.zip |
[OpenCL] Traverse vector types for ocl extensions support
Summary:
Given the following kernel:
__kernel void foo() {
double d;
double4 dd;
}
and cl_khr_fp64 is disabled, the compilation would fail due to
the presence of 'double d', but when removed, it passes.
The expectation is that extended vector types of unsupported types
will also be unsupported.
The patch adds the check for this scenario.
Patch by: Ofir Cohen
Reviewers: bader, Anastasia, AlexeySotkin, yaxunl
Reviewed By: Anastasia
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51296
llvm-svn: 341309
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index e4bf27de8b8..bd2637a72ef 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -1889,6 +1889,14 @@ bool Sema::checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DS, QualType QT) { if (auto TagT = dyn_cast<TagType>(QT.getCanonicalType().getTypePtr())) Decl = TagT->getDecl(); auto Loc = DS.getTypeSpecTypeLoc(); + + // Check extensions for vector types. + // e.g. double4 is not allowed when cl_khr_fp64 is absent. + if (QT->isExtVectorType()) { + auto TypePtr = QT->castAs<ExtVectorType>()->getElementType().getTypePtr(); + return checkOpenCLDisabledTypeOrDecl(TypePtr, Loc, QT, OpenCLTypeExtMap); + } + if (checkOpenCLDisabledTypeOrDecl(Decl, Loc, QT, OpenCLDeclExtMap)) return true; |