summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOpenMP.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP] Remove unused header files, NFC.Alexey Bataev2017-08-281-3/+0
| | | | llvm-svn: 311908
* [OPENMP] Fix for PR34321: ustom OpenMP reduction in C++ template causesAlexey Bataev2017-08-251-1/+2
| | | | | | | | | SEGFAULT at compile time Compiler crashed when tried to rebuild non-template expression in dependent context. llvm-svn: 311777
* [OPENMP][DEBUG] Set proper address space info if required by target.Alexey Bataev2017-08-081-0/+33
| | | | | | | | | | | Arguments, passed to the outlined function, must have correct address space info for proper Debug info support. Patch sets global address space for arguments that are mapped and passed by reference. Also, cuda-gdb does not handle reference types correctly, so reference arguments are represented as pointers. llvm-svn: 310387
* Revert "[OPENMP][DEBUG] Set proper address space info if required by target."Alexey Bataev2017-08-081-33/+0
| | | | | | This reverts commit r310377. llvm-svn: 310379
* [OPENMP][DEBUG] Set proper address space info if required by target.Alexey Bataev2017-08-081-0/+33
| | | | | | | | | | | Arguments, passed to the outlined function, must have correct address space info for proper Debug info support. Patch sets global address space for arguments that are mapped and passed by reference. Also, cuda-gdb does not handle reference types correctly, so reference arguments are represented as pointers. llvm-svn: 310377
* Revert "[OPENMP][DEBUG] Set proper address space info if required by target."Alexey Bataev2017-08-081-33/+0
| | | | | | This reverts commit r310360. llvm-svn: 310364
* [OPENMP][DEBUG] Set proper address space info if required by target.Alexey Bataev2017-08-081-0/+33
| | | | | | | | | | | Arguments, passed to the outlined function, must have correct address space info for proper Debug info support. Patch sets global address space for arguments that are mapped and passed by reference. Also, cuda-gdb does not handle reference types correctly, so reference arguments are represented as pointers. llvm-svn: 310360
* Revert "[OPENMP][DEBUG] Set proper address space info if required by target."Alexey Bataev2017-08-041-33/+0
| | | | | | This reverts commit r310104. llvm-svn: 310135
* [OPENMP][DEBUG] Set proper address space info if required by target.Alexey Bataev2017-08-041-0/+33
| | | | | | | | | | | Arguments, passed to the outlined function, must have correct address space info for proper Debug info support. Patch sets global address space for arguments that are mapped and passed by reference. Also, cuda-gdb does not handle reference types correctly, so reference arguments are represented as pointers. llvm-svn: 310104
* [OPENMP] Allow all lvalues in 'depend' clause.Alexey Bataev2017-07-271-9/+12
| | | | | | | According to upcoming OpenMP 5.0 all addressable lvalue expressions are allowed in deoend clause. llvm-svn: 309309
* [OPENMP] Codegen for 'in_reduction' clause.Alexey Bataev2017-07-271-16/+74
| | | | | | | | | | | | | | | | | | Added codegen for task-based directive with in_reduction clause. ``` <body> ``` The next code is emitted: ``` void *td; ... td = call i8* @__kmpc_task_reduction_init(); ... <type> *priv = (<type> *)call i8* @__kmpc_task_reduction_get_th_data(i32 GTID, i8* td, i8* <orig>) ``` llvm-svn: 309270
* [OPENMP] Codegen for 'task_reduction' clause.Alexey Bataev2017-07-251-36/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added codegen for taskgroup directive with task_reduction clause. ``` <body> ``` The next code is emitted: ``` %struct.kmp_task_red_input_t red_init[n]; void *td; call void @__kmpc_taskgroup(%ident_t id, i32 gtid) ... red_init[i].shar = &<item>; red_init[i].size = sizeof(<item>); red_init[i].init = (void*)initializer_function; red_init[i].fini = (void*)destructor_function; red_init[i].comb = (void*)combiner_function; red_init[i].flags = flags; ... td = call i8* @__kmpc_task_reduction_init(i32 gtid, i32 n, i8* (void*)red_init); call void @__kmpc_end_taskgroup(%ident_t id, i32 gtid) void initializer_function(i8* priv) { *(<type>*)priv = <red_init>; ret void; } void destructor_function(i8* priv) { (<type>*)priv->~(); ret void; } void combiner_function(i8* inout, i8* in) { *(<type>*)inout = *(<type>*)inout <red_id> *(<type>*)in; ret void; } ``` llvm-svn: 308979
* [OPENMP] Fix the restrictions for in_reduction clause.Alexey Bataev2017-07-241-38/+53
| | | | | | | This patch allows to use in_reduction clause even if the innermost directive is not taskgroup. llvm-svn: 308883
* Inline variable into assert to fix unused warning.Richard Trieu2017-07-211-4/+2
| | | | llvm-svn: 308783
* [OPENMP] Fix build problem, NFC.Alexey Bataev2017-07-211-5/+3
| | | | llvm-svn: 308773
* [OPENMP] Initial support for 'in_reduction' clause.Alexey Bataev2017-07-211-0/+188
| | | | | | | Parsing/sema analysis for 'in_reduction' clause for task-based directives. llvm-svn: 308768
* [OPENMP] Simplify analysis of data-sharing attributes.Alexey Bataev2017-07-211-83/+48
| | | | llvm-svn: 308759
* [OPENMP] Fix DSA processing for member declaration.Alexey Bataev2017-07-201-31/+31
| | | | | | | | If the member declaration is captured in the OMPCapturedExprDecl, we may loose data-sharing attribute info for this declaration. Patch fixes this bug. llvm-svn: 308629
* [OPENMP] Initial support for 'task_reduction' clause.Alexey Bataev2017-07-181-18/+54
| | | | | | Parsing/sema analysis of the 'task_reduction' clause. llvm-svn: 308352
* [OPENMP] Generalization of sema analysis of reduction-based clauses,Alexey Bataev2017-07-181-132/+172
| | | | | | NFC. llvm-svn: 308317
* [OPENMP] Codegen for reduction clauses in 'taskloop' directives.Alexey Bataev2017-07-171-0/+2
| | | | | | Adds codegen for taskloop-based directives. llvm-svn: 308174
* [OPENMP] Add restriction for reduction clause in taskloop directives.Alexey Bataev2017-07-111-0/+43
| | | | | | | | Added checks for the reduction clauses in the taskloop directives: 1. Only addressable items must be used in reduction clauses. 2. Reduction clauses cannot be used with nogroup clauses. llvm-svn: 307693
* [OpenMP] Fix mapping of scalars for combined directivesJonas Hahnfeld2017-07-011-3/+26
| | | | | | | | | | | | | | | | Combined directives like 'target parallel' have two captured statements. Sema has to check the right one from the right direction. Previously, Sema::IsOpenMPCapturedByRef would return false for mapped scalars on combined directives. This results in a wrong signature of the outlined function which triggers an assertion: void llvm::CallInst::init(llvm::FunctionType *, llvm::Value *, ArrayRef<llvm::Value *>, ArrayRef<OperandBundleDef>, const llvm::Twine &): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed. Fixes PR30975 (and PR31985). New function was taken from clang-ykt. Differential Revision: https://reviews.llvm.org/D34888 llvm-svn: 306956
* [OPENMP] Allow 'use_device_ptr' clause in 'target data' alone.Alexey Bataev2017-05-301-23/+20
| | | | | | | | According to OpenMP 5.0 at least one 'map' or 'use_device_ptr' clause must be specified for 'target data' construct. Patch adds support for this feature. llvm-svn: 304216
* [OPENMP] Add a check for iterator not reached the end of stack, NFC.Alexey Bataev2017-04-271-2/+2
| | | | | | | Add an extra check for the iterator during checks of the data-sharing attributes. llvm-svn: 301549
* [OPENMP] Improve performance of the hasDSA() function, NFC.Alexey Bataev2017-04-271-10/+5
| | | | | | | Remove some unneccesary code from the function after the fix for ASAN buildbots. llvm-svn: 301547
* Fix asan failures on OpenMP.Haojian Wu2017-04-271-0/+2
| | | | llvm-svn: 301536
* [OPENMP] Fix handling of OpenMP code during template instantiation.Alexey Bataev2017-04-261-95/+174
| | | | | | | | | If some function template is instantiated during handling of OpenMP code, currently it may cause crash of compiler because of trying of capturing variables in non-capturing function scopes. Patch fixes this bug. llvm-svn: 301416
* [OPENMP] Move handling of threadprivate vars from the stack, NFC.Alexey Bataev2017-04-261-69/+75
| | | | | | | Threadprivate variables do no need to be handled in the Stack of all directives, moving it out for better performance and memory. llvm-svn: 301410
* [OpenMP] Prepare sema to support combined constructs with omp distribute and ↵Carlo Bertolli2017-04-201-8/+80
| | | | | | | | | | omp for https://reviews.llvm.org/D32237 This patch prepares sema with additional fields to support all those composite and combined constructs of OpenMP that include pragma 'distribute' and 'for', such as 'distribute parallel for'. It also extends the regression tests for 'distribute parallel for' and adds a new one. llvm-svn: 300802
* [NFC, Scoped Enum] Convert Sema::ExpressionEvaluationContext into a scoped EnumFaisal Vali2017-04-011-3/+6
| | | | | | | | - also replace direct equality checks against the ConstantEvaluated enumerator with isConstantEvaluted(), in anticipation of adding finer granularity to the various ConstantEvaluated contexts and reinstating certain restrictions on where lambda expressions can occur in C++17. - update the clang tablegen backend that uses these Enumerators, and add the relevant scope where needed. llvm-svn: 299316
* [OpenMP] Generate better diagnostics for cancel and cancellation pointJonas Hahnfeld2017-02-221-14/+20
| | | | | | | | | | | | | | | checkNestingOfRegions uses CancelRegion to determine whether cancel and cancellation point are valid in the given nesting. This leads to unuseful diagnostics if CancelRegion is invalid. The given test case has produced: region cannot be closely nested inside 'parallel' region As a solution, introduce checkCancelRegion and call it first to get the expected error: one of 'for', 'parallel', 'sections' or 'taskgroup' is expected Differential Revision: https://reviews.llvm.org/D30135 llvm-svn: 295808
* [OpenMP] Prepare Sema for initial implementation for pragma 'distribute ↵Carlo Bertolli2017-02-171-0/+32
| | | | | | | | | | | | | | | parallel for' https://reviews.llvm.org/D29922 This patch adds two fields for use in the implementation of 'distribute parallel for': The increment expression for the distribute loop. As the chunk assigned to a team is executed by multiple threads within the 'parallel for' region, the increment expression has to correspond to the value returned by the related runtime call (for_static_init). The upper bound of the innermost loop ('for' in 'distribute parallel for') is not the globalUB expression normally used for pragma 'for' when found in isolation. It is instead the upper bound of the chunk assigned to the team ('distribute' loop). In this way, we prevent teams from executing chunks assigned to other teams. The use of these two fields can be see in a related explanatory patch: https://reviews.llvm.org/D29508 llvm-svn: 295497
* [OpenMP] Support for thread_limit-clause on the 'target teams' directive.Arpith Chacko Jacob2017-01-251-3/+75
| | | | | | | | | | | The thread_limit-clause on the combined directive applies to the 'teams' region of this construct. We modify the ThreadLimitClause class to capture the clause expression within the 'target' region. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29087 llvm-svn: 293049
* [OpenMP] Support for num_teams-clause on the 'target teams' directive.Arpith Chacko Jacob2017-01-251-2/+75
| | | | | | | | | | | The num_teams-clause on the combined directive applies to the 'teams' region of this construct. We modify the NumTeamsClause class to capture the clause expression within the 'target' region. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29085 llvm-svn: 293048
* [OpenMP] Codegen support for 'target teams' on the host.Arpith Chacko Jacob2017-01-251-5/+6
| | | | | | | | | | | | | | | This patch adds support for codegen of 'target teams' on the host. This combined directive has two captured statements, one for the 'teams' region, and the other for the 'parallel'. This target teams region is offloaded using the __tgt_target_teams() call. The patch sets the number of teams as an argument to this call. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29084 llvm-svn: 293005
* Reverting commit because an NVPTX patch sneaked in. Break up into twoArpith Chacko Jacob2017-01-251-6/+5
| | | | | | patches. llvm-svn: 293003
* [OpenMP] Codegen support for 'target teams' on the host.Arpith Chacko Jacob2017-01-251-5/+6
| | | | | | | | | | | | | | | This patch adds support for codegen of 'target teams' on the host. This combined directive has two captured statements, one for the 'teams' region, and the other for the 'parallel'. This target teams region is offloaded using the __tgt_target_teams() call. The patch sets the number of teams as an argument to this call. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29084 llvm-svn: 293001
* [OpenMP] Support for the num_threads-clause on 'target parallel'.Arpith Chacko Jacob2017-01-251-7/+78
| | | | | | | | | | | | | | | The num_threads-clause on the combined directive applies to the 'parallel' region of this construct. We modify the NumThreadsClause class to capture the clause expression within the 'target' region. The offload runtime call for 'target parallel' is changed to __tgt_target_teams() with 1 team and the number of threads set by this clause or a default if none. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29082 llvm-svn: 292997
* [OpenMP] DSAChecker bug fix for combined directives.Arpith Chacko Jacob2017-01-231-1/+5
| | | | | | | | | | | | | The DSAChecker code in SemaOpenMP looks at the captured statement associated with an OpenMP directive. A combined directive such as 'target parallel' has nested capture statements, which have to be fully traversed before executing the DSAChecker. This is a patch to perform the traversal for such combined directives. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D29026 llvm-svn: 292794
* [OpenMP] Support for the if-clause on the combined directive 'target parallel'.Arpith Chacko Jacob2017-01-181-14/+172
| | | | | | | | | | | | | | | | | | | | | | | The if-clause on the combined directive potentially applies to both the 'target' and the 'parallel' regions. Codegen'ing the if-clause on the combined directive requires additional support because the expression in the clause must be captured by the 'target' capture statement but not the 'parallel' capture statement. Note that this situation arises for other clauses such as num_threads. The OMPIfClause class inherits OMPClauseWithPreInit to support capturing of expressions in the clause. A member CaptureRegion is added to OMPClauseWithPreInit to indicate which captured statement (in this case 'target' but not 'parallel') captures these expressions. To ensure correct codegen of captured expressions in the presence of combined 'target' directives, OMPParallelScope was added to 'parallel' codegen. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D28781 llvm-svn: 292437
* [OpenMP] Codegen support for 'target parallel' on the host.Arpith Chacko Jacob2017-01-181-5/+65
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for codegen of 'target parallel' on the host. It is also the first combined directive that requires two or more captured statements. Support for this functionality is included in the patch. A combined directive such as 'target parallel' has two captured statements, one for the 'target' and the other for the 'parallel' region. Two captured statements are required because each has different implicit parameters (see SemaOpenMP.cpp). For example, the 'parallel' has 'global_tid' and 'bound_tid' while the 'target' does not. The patch adds support for handling multiple captured statements based on the combined directive. When codegen'ing the 'target parallel' directive, the 'target' outlined function is created using the outer captured statement and the 'parallel' outlined function is created using the inner captured statement. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D28753 llvm-svn: 292419
* Revert r292374 to debug Windows buildbot failure.Arpith Chacko Jacob2017-01-181-63/+5
| | | | llvm-svn: 292400
* [OpenMP] Codegen support for 'target parallel' on the host.Arpith Chacko Jacob2017-01-181-5/+63
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for codegen of 'target parallel' on the host. It is also the first combined directive that requires two or more captured statements. Support for this functionality is included in the patch. A combined directive such as 'target parallel' has two captured statements, one for the 'target' and the other for the 'parallel' region. Two captured statements are required because each has different implicit parameters (see SemaOpenMP.cpp). For example, the 'parallel' has 'global_tid' and 'bound_tid' while the 'target' does not. The patch adds support for handling multiple captured statements based on the combined directive. When codegen'ing the 'target parallel' directive, the 'target' outlined function is created using the outer captured statement and the 'parallel' outlined function is created using the inner captured statement. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D28753 llvm-svn: 292374
* Remove redundant passing around of a "ContainsAutoType" flag.Richard Smith2017-01-121-21/+18
| | | | | | | | | | | | This flag serves no purpose other than to prevent us walking through a type to check whether it contains an 'auto' specifier; this duplication of information is error-prone, does not appear to provide any performance benefit, and will become less practical once we support C++1z deduced class template types and eventually constrained types from the Concepts TS. No functionality change intended. llvm-svn: 291737
* [OpenMP] Sema and parsing for 'target teams distribute simd’ pragmaKelvin Li2017-01-101-4/+46
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute simd’ pragma. Differential Revision: https://reviews.llvm.org/D28252 llvm-svn: 291579
* [OpenMP] Support the 'is_device_ptr' clause with 'target parallel for' pragmaKelvin Li2017-01-101-2/+4
| | | | | | | | This patch is to add support of the 'is_device_ptr' clause with the 'target parallel for' pragma. Differential Revision: https://reviews.llvm.org/D28255 llvm-svn: 291540
* [OpenMP] Support the 'is_device_ptr' clause with 'target parallel for simd' ↵Kelvin Li2017-01-101-2/+4
| | | | | | | | | | pragma This patch is to add support of the 'is_device_ptr' clause with the 'target parallel for simd' pragma. Differential Revision: https://reviews.llvm.org/D28402 llvm-svn: 291537
* [OpenMP] Sema and parsing for 'target teams distribute parallel for simd’ ↵Kelvin Li2017-01-031-4/+60
| | | | | | | | | | pragma This patch is to implement sema and parsing for 'target teams distribute parallel for simd’ pragma. Differential Revision: https://reviews.llvm.org/D28202 llvm-svn: 290862
* [OpenMP] Sema and parsing for 'target teams distribute parallel for’ pragmaKelvin Li2016-12-291-4/+59
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute parallel for’ pragma. Differential Revision: https://reviews.llvm.org/D28160 llvm-svn: 290725
OpenPOWER on IntegriCloud