summaryrefslogtreecommitdiffstats
path: root/test/SemaOpenCL
Commit message (Collapse)AuthorAgeFilesLines
* Merging r353431:Hans Wennborg2019-02-122-59/+64
| | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r353431 | stulova | 2019-02-07 18:32:37 +0100 (Thu, 07 Feb 2019) | 9 lines [OpenCL][PR40603] In C++ preserve compatibility with OpenCL C v2.0 Valid OpenCL C code should still compile in C++ mode. This change enables extensions and OpenCL types. Differential Revision: https://reviews.llvm.org/D57824 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_80@353826 91177308-0d34-0410-b5e6-96231b3b80d8
* Merging r352539:Hans Wennborg2019-01-292-6/+7
| | | | | | | | | | | | | | | | | | | ------------------------------------------------------------------------ r352539 | arsenm | 2019-01-29 21:49:47 +0100 (Tue, 29 Jan 2019) | 9 lines Revert "OpenCL: Extend argument promotion rules to vector types" This reverts r348083. This was based on a misreading of the spec for printf specifiers. Also revert r343653, as without a subsequent patch, a correctly specified format for a vector will incorrectly warn. Fixes bug 40491. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_80@352547 91177308-0d34-0410-b5e6-96231b3b80d8
* OpenCL: Improve vector printf warningsMatt Arsenault2018-12-012-10/+94
| | | | | | | | | | | | The vector modifier is considered separate, so don't treat it as a conversion specifier. This is still not warning on some cases, like using a type that isn't a valid vector element. Fixes bug 39652 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348084 91177308-0d34-0410-b5e6-96231b3b80d8
* OpenCL: Don't warn on v printf modifierMatt Arsenault2018-11-131-0/+34
| | | | | | | | | | | This avoids spurious warnings, but could use a lot of work. For example the number of vector elements is not verified, and the passed value type is not checked. Fixes bug 39486 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346806 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extensionAndrew Savonichev2018-11-082-0/+114
| | | | | | | | | | | | | | | | | | Summary: 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 Reviewers: Anastasia, yaxunl, shafik Reviewed By: Anastasia Subscribers: arphaman, sidorovd, AlexeySotkin, krisb, bader, asavonic, cfe-commits Differential Revision: https://reviews.llvm.org/D51484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346392 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r346326 [OpenCL] Add support of ↵Andrew Savonichev2018-11-072-114/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | cl_intel_device_side_avc_motion_estimation This patch breaks Index/opencl-types.cl LIT test: Script: -- : 'RUN: at line 1'; stage1/bin/c-index-test -test-print-type llvm/tools/clang/test/Index/opencl-types.cl -cl-std=CL2.0 | stage1/bin/FileCheck llvm/tools/clang/test/Index/opencl-types.cl -- Command Output (stderr): -- llvm/tools/clang/test/Index/opencl-types.cl:3:26: warning: unsupported OpenCL extension 'cl_khr_fp16' - ignoring [-Wignored-pragmas] llvm/tools/clang/test/Index/opencl-types.cl:4:26: warning: unsupported OpenCL extension 'cl_khr_fp64' - ignoring [-Wignored-pragmas] llvm/tools/clang/test/Index/opencl-types.cl:8:9: error: use of type 'double' requires cl_khr_fp64 extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:11:8: error: declaring variable of type 'half' is not allowed llvm/tools/clang/test/Index/opencl-types.cl:15:3: error: use of type 'double' requires cl_khr_fp64 extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:16:3: error: use of type 'double4' (vector of 4 'double' values) requires cl_khr_fp64 extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:26:26: warning: unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring [-Wignored-pragmas] llvm/tools/clang/test/Index/opencl-types.cl:35:44: error: use of type '__read_only image2d_msaa_t' requires cl_khr_gl_msaa_sharing extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:36:49: error: use of type '__read_only image2d_array_msaa_t' requires cl_khr_gl_msaa_sharing extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:37:49: error: use of type '__read_only image2d_msaa_depth_t' requires cl_khr_gl_msaa_sharing extension to be enabled llvm/tools/clang/test/Index/opencl-types.cl:38:54: error: use of type '__read_only image2d_array_msaa_depth_t' requires cl_khr_gl_msaa_sharing extension to be enabled git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346338 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extensionAndrew Savonichev2018-11-072-0/+114
| | | | | | | | | | | | | | | | | | Summary: 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 Reviewers: Anastasia, yaxunl, shafik Reviewed By: Anastasia Subscribers: arphaman, sidorovd, AlexeySotkin, krisb, bader, asavonic, cfe-commits Differential Revision: https://reviews.llvm.org/D51484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346326 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Fix diagnostic message about overload candidatesAndrew Savonichev2018-11-071-1/+1
| | | | | | | | | | | | | | | | | Summary: I wonder if there are some extension which need to be disabled to get overloadable candidate available. Reviewers: asavonic, Anastasia Reviewed By: Anastasia Subscribers: yaxunl, sidorovd, cfe-commits Differential Revision: https://reviews.llvm.org/D54152 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346311 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow clk_event_t comparisonsSven van Haastregt2018-11-012-3/+25
| | | | | | | | | Also rename `invalid-clk-events-cl2.0.cl` to `clk_event_t.cl` and repurpose it to include both positive and negative clk_event_t tests. Differential Revision: https://reviews.llvm.org/D53871 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345825 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Fix serialization of OpenCLExtensionDeclsAndrew Savonichev2018-10-292-35/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: 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. Reviewers: Anastasia, yaxunl, JDevlieghere Reviewed By: Anastasia Subscribers: sidorovd, cfe-commits, asavonic Differential Revision: https://reviews.llvm.org/D53200 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345497 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Remove unwanted signedness conversion from testsMarco Antognini2018-10-191-4/+4
| | | | | | | | | | | | The get_kernel_* functions used in cl20-device-side-enqueue.cl all return unsigned integers. This patch avoids undesired implicit conversions on the returned values. Differential Revision: https://reviews.llvm.org/D52873 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344778 91177308-0d34-0410-b5e6-96231b3b80d8
* AMDGPU: add __builtin_amdgcn_update_dppYaxun Liu2018-10-171-0/+9
| | | | | | | | | | | Emit llvm.amdgcn.update.dpp for both __builtin_amdgcn_mov_dpp and __builtin_amdgcn_update_dpp. The first argument to llvm.amdgcn.update.dpp will be undef for __builtin_amdgcn_mov_dpp. Differential Revision: https://reviews.llvm.org/D52320 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344665 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema][OpenCL] Improve diagnostics for not viable overloadable function ↵Andrew Savonichev2018-10-111-1/+1
| | | | | | | | | | | | | | | | | | | candidates Summary: Allowed extension name (that ought to be disabled) printing in the note message. This diagnostic was proposed here: https://reviews.llvm.org/D51341 Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: cfe-commits, asavonic, bader Differential Revision: https://reviews.llvm.org/D52292 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344246 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Fixed address space cast in C style cast of C++ parsingAnastasia Stulova2018-10-102-98/+255
| | | | | | | | | | | | C style cast in OpenCL C++ was ignoring the address space conversions from OpenCL C and as a result accepting incorrect code to compile. This commit adds special function for checking correctness of address spaces that is shared between C and C++ casts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344148 91177308-0d34-0410-b5e6-96231b3b80d8
* OpenCL: Mark printf format string argumentMatt Arsenault2018-10-031-0/+13
| | | | | | Fixes not warning on format string errors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343653 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r326937 "[OpenCL] Remove block invoke function from emitted block ↵Sven van Haastregt2018-10-021-1/+1
| | | | | | | | | | | literal struct" This reverts r326937 as it broke block argument handling in OpenCL. See the discussion on https://reviews.llvm.org/D43783 . The next commit will add a test case that revealed the issue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343582 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Improve extension-version.cl and to_addr_builtin.cl testsSven van Haastregt2018-09-272-0/+88
| | | | | | | | | | | | | | Add cl_khr_depth_images to extension-version.cl. Extend to_addr_builtin.cl to additionally test the built-in methods to_private and to_local, and test assignment with to_global to incorrect types. Patch by Alistair Davies. Differential Revision: https://reviews.llvm.org/D52020 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343207 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Allow zero assignment and comparisons between queue_t type variablesSven van Haastregt2018-09-251-4/+22
| | | | | | | | | | | | This change allows for zero assignment and comparison of queue_t type variables, and extends null_queue.cl to test this. Patch by Alistair Davies. Differential Revision: https://reviews.llvm.org/D51727 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342968 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "We allow implicit function declarations as an extension in all C ↵Anastasia Stulova2018-09-242-2/+2
| | | | | | | | | | | | dialects. Remove OpenCL special case." Discussed on cfe-commits (Week-of-Mon-20180820), this change leads to the generation of invalid IR for OpenCL without giving an error. Therefore, the conclusion was to revert. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342885 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Diagnose redundant address space conversionSven van Haastregt2018-09-201-1/+3
| | | | | | | | | | | | | | | | | Add a warning if a parameter with a named address space is passed to a to_addr builtin. For example: int i; to_private(&i); // generate warning as conversion from private to private is redundant. Patch by Alistair Davies. Differential Revision: https://reviews.llvm.org/D51411 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342638 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Allow blocks to capture arrays in OpenCLAndrew Savonichev2018-09-171-0/+16
| | | | | | | | | | | | | | Summary: Patch by Egor Churaev Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: asavonic, bader, cfe-commits Differential Revision: https://reviews.llvm.org/D51722 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342370 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge two attribute diagnostics into oneAndrew Savonichev2018-09-171-2/+2
| | | | | | | | | | | | | | | | | | Summary: Merged the recently added `err_attribute_argument_negative` diagnostic with existing `err_attribute_requires_positive_integer` diagnostic: the former allows only strictly positive integer, while the latter also allows zero. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51853 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342367 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Relax diagnostics on OpenCL access qualifiersAndrew Savonichev2018-09-061-1/+31
| | | | | | | | | | | | | | | | | Summary: Emit warning for multiple access qualifiers if they do not conflict. Patch by Alexey Bader Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: asavonic, bader, cfe-commits Differential Revision: https://reviews.llvm.org/D51302 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341553 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Disallow negative attribute argumentsAndrew Savonichev2018-09-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Negative arguments in kernel attributes are silently bitcast'ed to unsigned, for example: __attribute__((reqd_work_group_size(1, -1, 1))) __kernel void k() {} is a complete equivalent of: __attribute__((reqd_work_group_size(1, 4294967294, 1))) __kernel void k() {} This is likely an error, so the patch forbids negative arguments in several OpenCL attributes. Users who really want 4294967294 can still use it as an unsigned representation. Reviewers: Anastasia, yaxunl, bader Reviewed By: Anastasia, yaxunl, bader Subscribers: bader, cfe-commits Differential Revision: https://reviews.llvm.org/D50259 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341539 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Traverse vector types for ocl extensions supportAlexey Sotkin2018-09-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341309 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add test for constant sampler argumentSven van Haastregt2018-08-141-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339678 91177308-0d34-0410-b5e6-96231b3b80d8
* AMDGPU: Add another missing builtinMatt Arsenault2018-08-091-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339395 91177308-0d34-0410-b5e6-96231b3b80d8
* AMDGPU: Add builtin for s_dcache_wbMatt Arsenault2018-08-071-0/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339110 91177308-0d34-0410-b5e6-96231b3b80d8
* AMDGPU: Add builtin for s_dcache_inv_volMatt Arsenault2018-08-071-0/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339109 91177308-0d34-0410-b5e6-96231b3b80d8
* Append new attributes to the end of an AttributeList.Michael Kruse2018-08-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recommit of r335084 after revert in r335516. ... instead of prepending it at the beginning (the original behavior since implemented in r122535 2010-12-23). This builds up an AttributeList in the the order in which the attributes appear in the source. The reverse order caused nodes for attributes in the AST (e.g. LoopHint) to be in the reverse order, and therefore printed in the wrong order in -ast-dump. Some TODO comments mention this. The order was explicitly reversed for enable_if attribute overload resolution and name mangling, which is not necessary anymore with this patch. The change unfortunately has some secondary effect, especially on diagnostic output. In the simplest cases, the CHECK lines or expected diagnostic were changed to the the new output. If the kind of error/warning changed, the attributes' order was changed instead. This unfortunately causes some 'previous occurrence here' hints to be textually after the main marker. This typically happens when attributes are merged, but are incompatible to each other. Interchanging the role of the the main and note SourceLocation will also cause the case where two different declaration's attributes (in contrast to multiple attributes of the same declaration) are merged to be reverse. There is no easy fix because sometimes previous attributes are merged into a new declaration's attribute list, sometimes new attributes are added to a previous declaration's attribute list. Since 'previous occurrence here' pointing to locations after the main marker is not rare, I left the markers as-is; it is only relevant when the attributes are declared in the same declaration anyway. Differential Revision: https://reviews.llvm.org/D48100 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338800 91177308-0d34-0410-b5e6-96231b3b80d8
* __c11_atomic_load's _Atomic can be constJF Bastien2018-08-021-2/+3
| | | | | | | | | | | | | | | | | | | | | Summary: C++11 onwards specs the non-member functions atomic_load and atomic_load_explicit as taking the atomic<T> by const (potentially volatile) pointer. C11, in its infinite wisdom, decided to drop the const, and C17 will fix this with DR459 (the current draft forgot to fix B.16, but that’s not the normative part). clang’s lib/Headers/stdatomic.h implements these as #define to the __c11_* equivalent, which are builtins with custom typecheck. Fix the typecheck. D47613 takes care of the libc++ side. Discussion: http://lists.llvm.org/pipermail/cfe-dev/2018-May/058129.html <rdar://problem/27426936> Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47618 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338743 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to make builtin address space declarations not uselessMatt Arsenault2018-08-021-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way address space declarations for builtins currently work is nearly useless. The code assumes the address spaces used for builtins is a confusingly named "target address space" from user code using __attribute__((address_space(N))) that matches the builtin declaration. There's no way to use this to declare a builtin that returns a language specific address space. The terminology used is highly cofusing since it has nothing to do with the the address space selected by the target to use for a language address space. This feature is essentially unused as-is. AMDGPU and NVPTX are the only in-tree targets attempting to use this. The AMDGPU builtins certainly do not behave as intended (i.e. all of the builtins returning pointers can never compile because the numbered address space never matches the expected named address space). The NVPTX builtins are missing tests for some, and the others seem to rely on an implicit addrspacecast. Change the used address space for builtins based on a target hook to allow using a language address space for a builtin. This allows the same builtin declaration to be used for multiple languages with similarly purposed address spaces (e.g. the same AMDGPU builtin can be used in OpenCL and CUDA even though the constant address spaces are arbitarily different). This breaks the possibility of using arbitrary numbered address spaces alongside the named address spaces for builtins. If this is an issue we probably need to introduce another builtin declaration character to distinguish language address spaces from so-called "target address spaces". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338707 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Forbid size dependent types used as kernel argumentsAlexey Sotkin2018-07-311-1/+29
| | | | | | | | | | | | | | | | | | | | | Summary: Size_t, intptr_t, uintptr_t and ptrdiff_t cannot be used as kernel arguments, according to OpenCL Specification s6.9k: The size in bytes of these types are implementation-defined and in addition can also be different for the OpenCL device and the host processor making it difficult to allocate buffer objects to be passed as arguments to a kernel declared as pointer to these types. Patch by: Andrew Savonichev Reviewers: Anastasia, yaxunl Subscribers: yaxunl, Anastasia, cfe-commits Differential Revision: https://reviews.llvm.org/D49725 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338432 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Check for invalid kernel arguments in array typesAlexey Sotkin2018-07-311-0/+13
| | | | | | | | | | | | | | | | | Summary: OpenCL specification forbids use of several types as kernel arguments. This patch improves existing diagnostic to look through arrays. Patch by: Andrew Savonichev Reviewers: Anastasia, yaxunl Subscribers: yaxunl, Anastasia, cfe-commits Differential Revision: https://reviews.llvm.org/D49723 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338427 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Mark implicitly-inserted ICE's as being part of explicit cast (PR38166)Roman Lebedev2018-07-241-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed in [[ https://bugs.llvm.org/show_bug.cgi?id=38166 | PR38166 ]], we need to be able to distinqush whether the cast we are visiting is actually a cast, or part of an `ExplicitCast`. There are at least four ways to get there: 1. Introduce a new `CastKind`, and use it instead of `IntegralCast` if we are in `ExplicitCast`. Would work, but does not scale - what if we will need more of these cast kinds? 2. Introduce a flag in `CastExprBits`, whether this cast is part of `ExplicitCast` or not. Would work, but it isn't immediately clear where it needs to be set. 2. Fix `ScalarExprEmitter::VisitCastExpr()` to visit these `NoOp` casts. As pointed out by @rsmith, CodeGenFunction::EmitMaterializeTemporaryExpr calls skipRValueSubobjectAdjustments, which steps over the CK_NoOp cast`, which explains why we currently don't visit those. This is probably impossible, as @efriedma points out, that is intentional as per `[class.temporary]` in the standard 3. And the simplest one, just record which NoOp casts we skip. It just kinda works as-is afterwards. But, the approach with a flag is the least intrusive one, and is probably the best one overall. Reviewers: rsmith, rjmccall, majnemer, efriedma Reviewed By: rsmith Subscribers: cfe-commits, aaron.ballman, vsk, llvm-commits, rsmith Differential Revision: https://reviews.llvm.org/D49508 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337815 91177308-0d34-0410-b5e6-96231b3b80d8
* DR1687: When overload resolution selects a built-in operator, implicitRichard Smith2018-06-271-1/+1
| | | | | | | | | | | conversions are only applied to operands of class type, and the second standard conversion sequence is not applied. When diagnosing an invalid builtin binary operator, talk about the original types rather than the converted types. If these differ by a user-defined conversion, tell the user what happened. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335781 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Append new attributes to the end of an AttributeList."Michael Kruse2018-06-251-2/+2
| | | | | | | This reverts commit r335084 as requested by David Jones and Eric Christopher because of differences of emitted warnings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335516 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Fixed parsing of address spaces for C++.Anastasia Stulova2018-06-221-0/+4
| | | | | | | | | Added address space tokens to C++ parsing code to be able to parse declarations that start from an address space keyword. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335362 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Allow creating types with multiple of the same addrspace.Alexey Bader2018-06-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The comment with the OpenCL clause about this clearly says: "No type shall be qualified by qualifiers for two or more different address spaces." This must mean that two or more qualifiers for the _same_ address space is allowed. However, it is likely unintended by the programmer, so emit a warning. For dependent address space types, reject them like before since we cannot know what the address space will be. Patch by Bevin Hansson (ebevhan). Reviewers: Anastasia Reviewed By: Anastasia Subscribers: bader, cfe-commits Differential Revision: https://reviews.llvm.org/D47630 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335103 91177308-0d34-0410-b5e6-96231b3b80d8
* Append new attributes to the end of an AttributeList.Michael Kruse2018-06-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... instead of prepending it at the beginning (the original behavior since implemented in r122535 2010-12-23). This builds up an AttributeList in the the order in which the attributes appear in the source. The reverse order caused nodes for attributes in the AST (e.g. LoopHint) to be in the reverse, and therefore printed in the wrong order by -ast-dump. Some TODO comments mention this. The order was explicitly reversed for enable_if attribute overload resolution and name mangling, which is not necessary anymore with this patch. The change unfortunately has some secondary effects, especially for diagnostic output. In the simplest cases, the CHECK lines or expected diagnostic were changed to the the new output. If the kind of error/warning changed, the attribute's order was changed instead. It also causes some 'previous occurrence here' hints to be textually after the main marker. This typically happens when attributes are merged, but are incompatible. Interchanging the role of the the main and note SourceLocation will also cause the case where two different declaration's attributes (in contrast to multiple attributes of the same declaration) are merged to be reversed. There is no easy fix because sometimes previous attributes are merged into a new declaration's attribute list, sometimes new attributes are added to a previous declaration's attribute list. Since 'previous occurrence here' pointing to locations after the main marker is not rare, I left the markers as-is; it is only relevant when the attributes are declared in the same declaration anyway, which often is on the same line. Differential Revision: https://reviews.llvm.org/D48100 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335084 91177308-0d34-0410-b5e6-96231b3b80d8
* [CUDA][HIP] Allow CUDA __global__ functions to have amdgpu kernel attributesYaxun Liu2018-06-121-4/+4
| | | | | | | | | | | | | There are HIP applications e.g. Tensorflow 1.3 using amdgpu kernel attributes, however currently they are only allowed on OpenCL kernel functions. This patch will allow amdgpu kernel attributes to be applied to CUDA/HIP __global__ functions. Differential Revision: https://reviews.llvm.org/D47958 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334561 91177308-0d34-0410-b5e6-96231b3b80d8
* [AMDGPU] fixes for lds f32 builtinsDaniil Fukalov2018-05-211-0/+17
| | | | | | | | | | | | 1. added restrictions to memory scope, order and volatile parameters 2. added custom processing for these builtins - currently is not used code, needed to switch off GCCBuiltin link to the builtins (ongoing change to llvm tree) 3. builtins renamed as requested Differential Revision: https://reviews.llvm.org/D43281 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332848 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add constant address space to __func__ in AST.Anastasia Stulova2018-05-091-0/+8
| | | | | | | | | | | | | | Added string literal helper function to obtain the type attributed by a constant address space. Also fixed predefind __func__ expr to use the helper to constract the string literal correctly. Differential Revision: https://reviews.llvm.org/D46049 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331877 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Restrict various keywords in OpenCL C++ modeSven van Haastregt2018-05-091-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Restrict the following keywords in the OpenCL C++ language mode, according to Sections 2.2 & 2.9 of the OpenCL C++ 1.0 Specification. - dynamic_cast - typeid - register (already restricted in OpenCL C, update the diagnostic) - thread_local - exceptions (try/catch/throw) - access qualifiers read_only, write_only, read_write Support the `__global`, `__local`, `__constant`, `__private`, and `__generic` keywords in OpenCL C++. Leave the unprefixed address space qualifiers such as global available, i.e., do not mark them as reserved keywords in OpenCL C++. libclcxx provides explicit address space pointer classes such as `global_ptr` and `global<T>` that are implemented using the `__`-prefixed qualifiers. Differential Revision: https://reviews.llvm.org/D46022 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331874 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add "cles_khr_int64" extension.Alexey Bader2018-01-261-0/+9
| | | | | | | | | | | | | | | | | | | | Summary: For OpenCL 1.1 embedded profile 64 bit integers i.e. long, ulong including the appropriate vector data types and operations on 64-bit integers are optional. The "cles_khr_int64" extension string will be reported if the embedded profile implementation supports 64-bit integers. Reviewers: Anastasia, bader Reviewed By: Anastasia, bader Subscribers: bader, yaxunl, Anastasia, cfe-commits Differential Revision: https://reviews.llvm.org/D42532 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323522 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add extensions cl_intel_subgroups and cl_intel_subgroups_shortAlexey Sotkin2017-11-271-0/+18
| | | | | | | | | | | | Reviewers: yaxunl, Anastasia, bader Reviewed By: Anastasia, bader Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39936 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319011 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Fix code generation of function-scope constant samplers.Alexey Bader2017-11-151-26/+1
| | | | | | | | | | | | | | | | | | Summary: Constant samplers are handled as static variables and clang's code generation library, which leads to llvm::unreachable. We bypass emitting sampler variable as static since it's translated to a function call later. Reviewers: yaxunl, Anastasia Reviewed By: yaxunl, Anastasia Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D34342 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318290 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Restrict swizzle length check to OpenCL modeBruno Cardoso Lopes2017-10-171-1/+1
| | | | | | | | | | | Changes behavior introduced in r298369 to only error out on vector component invalid length access on OpenCL mode. Differential Revision: https://reviews.llvm.org/D38868 rdar://problem/33568748 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316016 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add LangAS::opencl_private to represent private address space in ASTYaxun Liu2017-10-135-22/+77
| | | | | | | | | | | | | | | | | | | | | | | | | Currently Clang uses default address space (0) to represent private address space for OpenCL in AST. There are two issues with this: Multiple address spaces including private address space cannot be diagnosed. There is no mangling for default address space. For example, if private int* is emitted as i32 addrspace(5)* in IR. It is supposed to be mangled as PUAS5i but it is mangled as Pi instead. This patch attempts to represent OpenCL private address space explicitly in AST. It adds a new enum LangAS::opencl_private and adds it to the variable types which are implicitly private: automatic variables without address space qualifier function parameter pointee type without address space qualifier (OpenCL 1.2 and below) Differential Revision: https://reviews.llvm.org/D35082 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315668 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Allow function declaration with empty argument list.Alexey Bader2017-10-112-2/+5
| | | | | | | | | | | | | | | | | | Treat 'f()' as 'f(void)' rather than a function w/o a prototype. Reviewers: Anastasia, yaxunl Reviewed By: Anastasia, yaxunl Subscribers: cfe-commits, echuraev, chapuni Differential Revision: https://reviews.llvm.org/D33681 Re-apply revision 306653. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315453 91177308-0d34-0410-b5e6-96231b3b80d8