summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenOpenCLCXX
Commit message (Collapse)AuthorAgeFilesLines
* [OpenCL] Add ExtVectorElementExpr constant evaluation (PR42387)Sven van Haastregt2019-12-171-0/+28
| | | | | | | | Add constexpr evaluation for ExtVectorElementExpr nodes by evaluating the underlying vector expression. Add basic folding for the case that Evaluate does not return an LValue. Differential Revision: https://reviews.llvm.org/D71133
* [OpenCL] Handle address space conversions for constexpr (PR44177)Sven van Haastregt2019-12-092-5/+28
| | | | | | | | | | | | The AST for the constexpr.cl test contains address space conversion nodes to cast through the implicit generic address space. These caused the evaluator to reject the input as constexpr in C++ for OpenCL mode, whereas the input was considered constexpr in plain C++ mode as the AST won't have address space cast nodes then. Fixes PR44177. Differential Revision: https://reviews.llvm.org/D71015
* [OpenCL] Fix address space for implicit conversion (PR43145)Sven van Haastregt2019-12-021-0/+11
| | | | | | | | | | Clang was creating a DerivedToBase ImplicitCastExpr that was also casting between address spaces as part of the second step in the standard conversion sequence. Defer the address space conversion to the third step in the sequence instead, such that we get a separate ImplicitCastExpr for the address space conversion. Differential Revision: https://reviews.llvm.org/D70605
* [OpenCL] Fix address space for base method call (PR43145)Sven van Haastregt2019-11-211-2/+21
| | | | | | | | Clang was creating an UncheckedDerivedToBase ImplicitCastExpr that was also casting between address spaces. Insert an ImplicitCastExpr node for doing the address space conversion. Differential Revision: https://reviews.llvm.org/D69810
* [OpenCL] Fix FileCheck patternSven van Haastregt2019-11-041-1/+1
| | | | | For this test, FileCheck is not run with the CHECK prefix; it seems COMMON was intended here.
* [OpenCL] Fix address space for const method call from nonconst (PR43145)Sven van Haastregt2019-11-041-0/+11
| | | | | | Patch by Anastasia Stulova and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D68781
* [OpenCL] Preserve addrspace in CGClass (PR43145)Sven van Haastregt2019-10-171-0/+30
| | | | | | | | | | PR43145 revealed two places where Clang was attempting to create a bitcast without considering the address space of class types during C++ class code generation. Differential Revision: https://reviews.llvm.org/D68403 llvm-svn: 375118
* Make the CXXABIs respect the target's default calling convention.Erich Keane2019-07-266-51/+51
| | | | | | | | | SPIR targets need to have all functions be SPIR calling convention, however the CXXABIs were just returning CC_C in all non-'this-CC' cases. https://reviews.llvm.org/D65294 llvm-svn: 367103
* [OpenCL] Rename lang mode flag for C++ modeAnastasia Stulova2019-07-2514-18/+18
| | | | | | | | | | | | Rename lang mode flag to -cl-std=clc++/-cl-std=CLC++ or -std=clc++/-std=CLC++. This aligns with OpenCL C conversion and removes ambiguity with OpenCL C++. Differential Revision: https://reviews.llvm.org/D65102 llvm-svn: 367008
* [OpenCL] Improve destructor support in C++ for OpenCLMarco Antognini2019-07-222-14/+59
| | | | | | | This re-applies r366422 with a fix for Bug PR42665 and a new regression test. llvm-svn: 366670
* Revert r366422: [OpenCL] Improve destructor support in C++ for OpenCLIlya Biryukov2019-07-182-59/+14
| | | | | | | | Reason: this commit causes crashes in the clang compiler when building LLVM Support with libc++, see https://bugs.llvm.org/show_bug.cgi?id=42665 for details. llvm-svn: 366429
* [OpenCL] Improve destructor support in C++ for OpenCLMarco Antognini2019-07-182-14/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch does mainly three things: 1. It fixes a false positive error detection in Sema that is similar to D62156. The error happens when explicitly calling an overloaded destructor for different address spaces. 2. It selects the correct destructor when multiple overloads for address spaces are available. 3. It inserts the expected address space cast when invoking a destructor, if needed, and therefore fixes a crash due to the unmet assertion in llvm::CastInst::Create. The following is a reproducer of the three issues: struct MyType { ~MyType() {} ~MyType() __constant {} }; __constant MyType myGlobal{}; kernel void foo() { myGlobal.~MyType(); // 1 and 2. // 1. error: cannot initialize object parameter of type // '__generic MyType' with an expression of type '__constant MyType' // 2. error: no matching member function for call to '~MyType' } kernel void bar() { // 3. The implicit call to the destructor crashes due to: // Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed. // in llvm::CastInst::Create. MyType myLocal; } The added test depends on D62413 and covers a few more things than the above reproducer. Subscribers: yaxunl, Anastasia, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64569 llvm-svn: 366422
* [OpenCL][PR41727] Prevent ICE on global dtorsAnastasia Stulova2019-07-151-0/+11
| | | | | | | | | | Pass NULL to pointer arg of __cxa_atexit if addr space is not matching with its param. This doesn't align yet with how dtors are generated that should be changed too. Differential Revision: https://reviews.llvm.org/D62413 llvm-svn: 366059
* [clang] Preserve names of addrspacecast'ed values.Vyacheslav Zakharin2019-07-105-42/+56
| | | | | | Differential Revision: https://reviews.llvm.org/D63846 llvm-svn: 365666
* [Sema] Diagnose addr space mismatch while constructing objectsAnastasia Stulova2019-06-201-0/+14
| | | | | | | | | | | | | | If we construct an object in some arbitrary non-default addr space it should fail unless either: - There is an implicit conversion from the address space to default /generic address space. - There is a matching ctor qualified with an address space that is either exactly matching or convertible to the address space of an object. Differential Revision: https://reviews.llvm.org/D62156 llvm-svn: 363944
* Introduce Value::stripPointerCastsSameRepresentationJohannes Doerfert2019-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This patch allows current users of Value::stripPointerCasts() to force the result of the function to have the same representation as the value it was called on. This is useful in various cases, e.g., (non-)null checks. In this patch only a single call site was adjusted to fix an existing misuse that would cause nonnull where they may be wrong. Uses in attribute deduction and other areas, e.g., D60047, are to be expected. For a discussion on this topic, please see [0]. [0] http://lists.llvm.org/pipermail/llvm-dev/2018-December/128423.html Reviewers: hfinkel, arsenm, reames Subscribers: wdng, hiraditya, bollu, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61607 llvm-svn: 362545
* [PR41567][Sema] Fixed cast kind in addr space conversionsAnastasia Stulova2019-06-031-0/+7
| | | | | | | | | This change sets missing cast kind correctly in the address space conversion case. Differential Revision: https://reviews.llvm.org/D62299 llvm-svn: 362409
* [OpenCL] Make global ctor init function a kernelAnastasia Stulova2019-05-091-0/+11
| | | | | | | | | | | | | | We need to be able to enqueue internal function that initializes global constructors on the host side. Therefore it has to be converted to a kernel. This change factors out common logic for adding kernel metadata and moves it from CodeGenFunction to CodeGenModule in order to make it accessible for the extra use case. Differential revision: https://reviews.llvm.org/D61488 llvm-svn: 360342
* [OpenCL] Switched CXX mode to be derived from C++17Anastasia Stulova2019-05-091-7/+1
| | | | | | Differential revision: https://reviews.llvm.org/D61506 llvm-svn: 360330
* [OpenCL] Prevent mangling kernel functions.Anastasia Stulova2019-05-072-9/+9
| | | | | | | | | | | | Kernel function names have to be preserved as in the original source to be able to access them from the host API side. This commit also adds restriction to kernels that prevents them from being used in overloading, templates, etc. Differential Revision: https://reviews.llvm.org/D60454 llvm-svn: 360152
* [OpenCL] Fix initialisation of this via pointer.Anastasia Stulova2019-05-021-7/+10
| | | | | | | | | | | | | | | When the expression used to initialise 'this' has a pointer type, check the address space of the pointee type instead of the pointer type to decide whether an address space cast is required. It is the pointee type that carries the address space qualifier. Fixing PR41674. Patch by kpet (Kevin Petit)! Differential Revision: https://reviews.llvm.org/D61319 llvm-svn: 359798
* [PR41157][OpenCL] Prevent implicit init of local addr space var in C++ mode.Anastasia Stulova2019-04-042-4/+22
| | | | | | | | | | | Prevent adding initializers implicitly to variables declared in local address space. This happens when they get converted into global variables and therefore theoretically have to be default initialized in C++. Differential Revision: https://reviews.llvm.org/D59646 llvm-svn: 357684
* [Sema] Adjust addr space of reference operand in compound assignmentAnastasia Stulova2019-03-191-5/+12
| | | | | | | | | | When we create overloads for the builtin compound assignment operators we need to preserve address space for the reference operand taking it from the argument that is passed in. Differential Revision: https://reviews.llvm.org/D59367 llvm-svn: 356475
* [Sema] Change addr space diagnostics in casts to follow C++ style.Anastasia Stulova2019-03-071-0/+14
| | | | | | | | | | | | | | | | | | | | This change adds a new diagnostic for mismatching address spaces to be used for C++ casts (only enabled in C style cast for now, the rest will follow!). The change extends C-style cast rules to account for address spaces. It also adds a separate function for address space cast checking that can be used to map from a separate address space cast operator addrspace_cast (to be added as a follow up patch). Note, that after this change clang will no longer allows arbitrary address space conversions in reinterpret_casts because they can lead to accidental errors. The implicit safe conversions would still be allowed. Differential Revision: https://reviews.llvm.org/D58346 llvm-svn: 355609
* [PR40778][Sema] Adjust addr space of operands in builtin operators.Anastasia Stulova2019-03-071-0/+46
| | | | | | | | | | | | Adjust address space for references and pointer operands of builtin operators. Currently this change only fixes addr space in assignment (= and |=) operator, that is needed for the test case reported in the bug. Wider support for all other operations will follow. Differential Revision: https://reviews.llvm.org/D58719 llvm-svn: 355608
* [PR40778] Preserve addr space in Derived to Base cast.Anastasia Stulova2019-03-071-0/+22
| | | | | | | | | The address space for the Base class pointer when up-casting from Derived should be taken from the Derived class pointer. Differential Revision: https://reviews.llvm.org/D53818 llvm-svn: 355606
* [PR40778] Add addr space conversion when binding reference to a temporary.Anastasia Stulova2019-03-061-0/+14
| | | | | | | | | | | | This change fixes temporary materialization to happen in the right (default) address space when binding to it a reference of different type. It adds address space conversion afterwards to match the addr space of a reference. Differential Revision: https://reviews.llvm.org/D58634 llvm-svn: 355499
* [OpenCL] Add generic addr space to the return of implicit assignment.Anastasia Stulova2019-01-301-97/+119
| | | | | | | | | | When creating the prototype of implicit assignment operators the returned reference to the class should be qualified with the same addr space as 'this' (i.e. __generic in OpenCL). Differential Revision: https://reviews.llvm.org/D57101 llvm-svn: 352617
* [OpenCL] Allow address spaces as method qualifiers.Anastasia Stulova2019-01-211-0/+35
| | | | | | | | | | | | | | | Methods can now be qualified with address spaces to prevent undesirable conversions to generic or to provide custom implementation to be used if the object is located in certain memory segments. This commit extends parsing and standard C++ overloading to work for an address space of a method (i.e. implicit 'this' parameter). Differential Revision: https://reviews.llvm.org/D55850 llvm-svn: 351747
* [OpenCL] Set generic addr space of 'this' in special class members.Anastasia Stulova2019-01-141-48/+82
| | | | | | | | | | | | | | | | | Set address spaces of 'this' param correctly for implicit special class members. This also changes initialization conversion sequence to separate address space conversion from other qualifiers in case of binding reference to a temporary. In this case address space conversion should happen after the binding (unlike for other quals). This is needed to materialize it correctly in the alloca address space. Initial patch by Mikael Nilssoni! Differential Revision: https://reviews.llvm.org/D56066 llvm-svn: 351053
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-132-6/+163
| | | | | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Note: This recommits the previously reverted patch, but now it is commited together with a fix for lldb. Differential Revision: https://reviews.llvm.org/D54862 llvm-svn: 349019
* Revert "[OpenCL] Add generic AS to 'this' pointer"Mikael Nilsson2018-12-122-163/+6
| | | | | | Reverting because the patch broke lldb. llvm-svn: 348931
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-122-6/+163
| | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Differential Revision: https://reviews.llvm.org/D54862 llvm-svn: 348927
* [OpenCL] Fix for TBAA information of pointer after addresspacecastAndrew Savonichev2018-12-121-0/+20
| | | | | | | | | | | | | | Summary: When addresspacecast is generated resulting pointer should preserve TBAA information from original value. Reviewers: rjmccall, yaxunl, Anastasia Reviewed By: rjmccall Subscribers: asavonic, kosarev, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D55262 llvm-svn: 348919
* [OpenCL] Improve diags for addr spaces in templatesAnastasia Stulova2018-11-291-3/+0
| | | | | | | | | | | Fix ICEs on template instantiations that were leading to the creation of invalid code patterns with address spaces. Incorrect cases are now diagnosed properly. Differential Revision: https://reviews.llvm.org/D54858 llvm-svn: 347865
* [OpenCL] Fix address space deduction in template args.Anastasia Stulova2018-11-191-0/+31
| | | | | | | | | | | Don't deduce address spaces for non-pointer-like types in template args. Fixes PR38603! Differential Revision: https://reviews.llvm.org/D54634 llvm-svn: 347189
* [OpenCL] Enable address spaces for references in C++Anastasia Stulova2018-11-161-0/+46
Added references to the addr spaces deduction and enabled CL2.0 features (program scope variables and storage class qualifiers) to work in C++ mode too. Fixed several address space conversion issues in CodeGen for references. Differential Revision: https://reviews.llvm.org/D53764 llvm-svn: 347059
OpenPOWER on IntegriCloud