summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOpenMP.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP] Fix DSA analysis for threadprivates after deserialization.Alexey Bataev2017-11-141-0/+6
| | | | | | | If threadprivate vaible is deserialized, it is not marked as threadprivate in DSAStack. llvm-svn: 318194
* [OPENMP] Codegen for `#pragma omp target parallel for simd`.Alexey Bataev2017-11-091-6/+16
| | | | | | Added codegen for `#pragma omp target parallel for simd` and clauses. llvm-svn: 317813
* [OPENMP] Codegen for `#pragma omp target parallel for`.Alexey Bataev2017-11-081-5/+77
| | | | llvm-svn: 317719
* [OpenMP] Extend "Avoid VLAs for reduction" optimization to VLAs as baseJonas Hahnfeld2017-11-021-1/+1
| | | | | | | | | We can generate constant sized arrays whenever the array section has constant length, even if the base expression itself is a VLA. Differential Revision: https://reviews.llvm.org/D39504 llvm-svn: 317207
* [OPENMP] Improve debug info for taskgroup implicitly generatedAlexey Bataev2017-10-251-15/+13
| | | | | | expressions. llvm-svn: 316585
* [OPENMP] Constify function parameters, NFC.Alexey Bataev2017-10-251-3/+4
| | | | llvm-svn: 316584
* [OpenMP] Avoid VLAs for some reductions on array sectionsJonas Hahnfeld2017-10-231-1/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases the compiler can deduce the length of an array section as constants. With this information, VLAs can be avoided in place of a constant sized array or even a scalar value if the length is 1. Example: int a[4], b[2]; pragma omp parallel reduction(+: a[1:2], b[1:1]) { } For chained array sections, this optimization is restricted to cases where all array sections except the last have a constant length 1. This trivially guarantees that there are no holes in the memory region that needs to be privatized. Example: int c[3][4]; pragma omp parallel reduction(+: c[1:1][1:2]) { } This relands commit r316229 that I reverted in r316235 because it failed on some bots. During investigation I found that this was because Clang and GCC evaluate the two arguments to emplace_back() in ReductionCodeGen::emitSharedLValue() in a different order, hence leading to a different order of generated instructions in the final LLVM IR. Fix this by passing in the arguments from temporary variables that are evaluated in a defined order. Differential Revision: https://reviews.llvm.org/D39136 llvm-svn: 316362
* Revert "[OpenMP] Avoid VLAs for some reductions on array sections"Jonas Hahnfeld2017-10-201-82/+1
| | | | | | | | | | This breaks at least two buildbots: http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/1175 http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/10478 This reverts commit r316229 during local investigation. llvm-svn: 316235
* [OpenMP] Avoid VLAs for some reductions on array sectionsJonas Hahnfeld2017-10-201-1/+82
| | | | | | | | | | | | | | | | | | | | | | | In some cases the compiler can deduce the length of an array section as constants. With this information, VLAs can be avoided in place of a constant sized array or even a scalar value if the length is 1. Example: int a[4], b[2]; pragma omp parallel reduction(+: a[1:2], b[1:1]) { } For chained array sections, this optimization is restricted to cases where all array sections except the last have a constant length 1. This trivially guarantees that there are no holes in the memory region that needs to be privatized. Example: int c[3][4]; pragma omp parallel reduction(+: c[1:1][1:2]) { } Differential Revision: https://reviews.llvm.org/D39136 llvm-svn: 316229
* [Modules TS] Module ownership semantics for redeclarations.Richard Smith2017-10-101-1/+1
| | | | | | | | | | | | | | | | | When declaring an entity in the "purview" of a module, it's never a redeclaration of an entity in the purview of a default module or in no module ("in the global module"). Don't consider those other declarations as possible redeclaration targets if they're not visible, and reject any cases where we pick a prior visible declaration that violates this rule. This reinstates r315251 and r315256, reverted in r315309 and r315308 respectively, tweaked to avoid triggering a linkage calculation when declaring implicit special members (this exposed our pre-existing issue with typedef names for linkage changing the linkage of types whose linkage has already been computed and cached in more cases). A testcase for that regression has been added in r315366. llvm-svn: 315379
* Revert "[Modules TS] Module ownership semantics for redeclarations."Eric Liu2017-10-101-1/+1
| | | | | | This reverts commit r315251. See the original commit thread for reason. llvm-svn: 315309
* [Modules TS] Module ownership semantics for redeclarations.Richard Smith2017-10-091-1/+1
| | | | | | | | | | When declaring an entity in the "purview" of a module, it's never a redeclaration of an entity in the purview of a default module or in no module ("in the global module"). Don't consider those other declarations as possible redeclaration targets if they're not visible, and reject any cases where we pick a prior visible declaration that violates this rule. llvm-svn: 315251
* [OPENMP] Do not capture local static variables.Alexey Bataev2017-10-061-0/+4
| | | | | | | | Previously we may erroneously try to capture locally declared static variables, which will lead to crash for target-based constructs. Patch fixes this problem. llvm-svn: 315076
* [OPENMP] Fix mapping|privatization of implicitly captured variables.Alexey Bataev2017-10-051-14/+37
| | | | | | | | If the `defaultmap(tofrom:scalar)` clause is specified, the scalars must be mapped with 'tofrom' modifiers, otherwise they must be captured as firstprivates. llvm-svn: 314995
* [OpenMP] Initial implementation of teams distribute code generationCarlo Bertolli2017-10-041-2/+2
| | | | | | | | https://reviews.llvm.org/D38371 This patch implements codegen for the combined 'teams distribute" OpenMP pragma and adds regression tests for all its clauses. llvm-svn: 314905
* [OPENMP] Allow use of declare target directive inside structAlexey Bataev2017-10-031-1/+5
| | | | | | | | | | declaration. Patch allows using of the `#pragma omp declare target`| `#pragma omp end declare target` directives inside the structures if we need to mark as declare target only some static members. llvm-svn: 314833
* [OPENMP] Capture argument of `device` clause for target-basedAlexey Bataev2017-10-021-1/+11
| | | | | | | | | | directives. The argument of the `device` clause in target-based executable directives must be captured to support codegen for the `target` directives with the `depend` clauses. llvm-svn: 314686
* [OPENMP] Fix handling of implicit mapping of array sections.Alexey Bataev2017-09-261-2/+3
| | | | llvm-svn: 314220
* [OPENMP] Generate implicit map|firstprivate clauses for target-basedAlexey Bataev2017-09-261-32/+166
| | | | | | | | | | directives. If the variable is used in the target-based region but is not found in any private|mapping clause, then generate implicit firstprivate|map clauses for these implicitly mapped variables. llvm-svn: 314205
* [OPENMP] Use canonical declarations for redeclarations checks.Alexey Bataev2017-09-211-3/+6
| | | | | | | | | If the captured variable has some redeclarations we may run into the situation where the redeclaration is used instead of the canonical declaration and we may consider this variable as one not captured before. llvm-svn: 313880
* [OpenMP] fix seg-faults printing diagnostics with invalid ordered(n) valuesRachel Craik2017-09-191-5/+11
| | | | | | | | | | | When the value specified for n in ordered(n) is larger than the number of loops a segmentation fault can occur in one of two ways when attempting to print out a diagnostic for an associated depend(sink : vec): 1) The iteration vector vec contains less than n items 2) The iteration vector vec contains a variable that is not a loop control variable This patch addresses both of these issues. Differential Revision: https://reviews.llvm.org/D38049 llvm-svn: 313675
* [OPENMP] Allow all classes as mappable types.Alexey Bataev2017-09-131-44/+0
| | | | | | | According to upcoming OpenMP 5.0 all classes/structs are now considered as mappable, even polymorphic and with static members. llvm-svn: 313141
* [OPENMP] Fix for PR34445: Reduction initializer segfaults at runtime inAlexey Bataev2017-09-061-6/+13
| | | | | | | | | | move constructor. Previously user-defined reduction initializer was considered as an assignment expression, not as initializer. Fixed this by treating the initializer expression as an initializer. llvm-svn: 312638
* [OPENMP] Fix for PR34398: assert with random access iterator if theAlexey Bataev2017-08-311-2/+2
| | | | | | | | | | | | step>1. If the loop is a loot with random access iterators and the iteration construct is represented it += n, then the compiler crashed because of reusing of the same MaterializedTemporaryExpr around N. Patch fixes it by using the expression as written, without any special kind of wrappings. llvm-svn: 312292
* [OPENMP] Capture global variables in all target executable regions.Alexey Bataev2017-08-291-1/+1
| | | | | | | | Capturing of the global variables occurs only in target regions. Patch fixes it and allows capturing of globals in all target executable directives. llvm-svn: 312024
* [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
OpenPOWER on IntegriCloud