Commit Graph

376 Commits

Author SHA1 Message Date
Richard Smith 96881be75c [c++20] P0515R3: Parsing support and basic AST construction for operator <=>.
Adding the new enumerator forced a bunch more changes into this patch than I
would have liked. The -Wtautological-compare warning was extended to properly
check the new comparison operator, clang-format needed updating because it uses
precedence levels as weights for determining where to break lines (and several
operators increased their precedence levels with this change), thread-safety
analysis needed changes to build its own IL properly for the new operator.

All "real" semantic checking for this operator has been deferred to a future
patch. For now, we use the relational comparison rules and arbitrarily give
the builtin form of the operator a return type of 'void'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320707 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-14 15:16:18 +00:00
Alexey Bataev e3e5f4e1c6 [OPENMP] Initial codegen for `target teams distribute simd` directive.
Host + generic device codegen for `target teams distribute simd`
directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320608 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-13 19:45:06 +00:00
Alexey Bataev fd1985cea5 [OPENMP] Simplify codegen for loop iteration variables in loop preamble.
Initial patch could cause trouble in the optimized code because of the
incorrectly generated lifetime intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320191 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-08 20:18:58 +00:00
Alexey Bataev 984e4561c9 [OPENMP] Initial codegen for `target teams distribute` directive.
Host + default devices codegen for `target teams distribute` directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320149 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-08 15:03:50 +00:00
Alexey Bataev f41523819e [OPENMP] Initial codegen for `teams distribute simd` directive.
Host + default devices codegen for `teams distribute simd` directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319896 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-06 14:31:09 +00:00
Alexey Bataev d80ab9d1a5 [OPENMP] Fix PR35486: crash when collapsing loops with dependent iteration spaces.
Though it is incorrect from point of view of OpenMP standard to have
dependent iteration space in OpenMP loops, compiler should not crash.
Patch fixes this problem.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319700 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04 21:30:42 +00:00
Carlo Bertolli 5440a99158 [OpenMP] Initial implementation of code generation for pragma 'teams distribute parallel for simd' on host
https://reviews.llvm.org/D40795

This includes regression tests for all associated clauses.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319696 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04 20:57:19 +00:00
Alexey Bataev 1d00b51338 [OPENMP] Codegen for `distribute simd` directive.
Initial codegen support for `distribute simd` directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319661 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04 15:38:33 +00:00
Alexey Bataev bc14311ded [OPENMP] General improvement of handling of `teams distribute`
directive, NFC.

Some general improvements in support of `teams distribute` directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319320 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29 15:14:16 +00:00
Alexey Bataev de3c9ade60 [OPENMP] Codegen for `distribute parallel for simd` directive.
Initial codegen for `#pragma omp distribute parallel for simd` directive
and its clauses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319079 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27 19:38:58 +00:00
Alexey Bataev 61396a3c03 [OPENMP] Improve handling of cancel directives in target-based
constructs, NFC.

Improved handling of cancel|cancellation point directives inside
target-based for directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319046 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27 16:54:08 +00:00
Alexey Bataev 13e60aabca [OPENMP] Add support for cancel constructs in `target teams distribute
parallel for`.

Add support for cancel/cancellation point directives inside `target
teams distribute parallel for` directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318881 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-22 21:12:03 +00:00
Alexey Bataev 058809db8e [OPENMP] Add support for cancel constructs in [teams] distribute
parallel for directives.

Added codegen/sema support for cancel constructs in [teams] distribute
parallel for directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-22 20:19:50 +00:00
Alexey Bataev c87c796e20 [OPENMP] Do not mark captured variables as artificial in debug info.
Captured variables should not be marked as artificial parameters in
outlined functions in debug info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-22 16:02:03 +00:00
Alexey Bataev 33fb7dabb6 [OPENMP] Codegen for `target teams` directive.
Added codegen of the clauses for `target teams` directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318834 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-22 14:25:55 +00:00
Alexey Bataev f301ed91f8 [OPENMP] Initial support for asynchronous data update, NFC.
OpenMP 5.0 introduces asynchronous data update/dependecies clauses on
target data directives. Patch adds initial support for outer task
regions to use task-based codegen for future async target data
directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-21 17:08:48 +00:00
Carlo Bertolli d441952f1c [OpenMP] Initial implementation of code generation for pragma 'teams distribute parallel for' on host
https://reviews.llvm.org/D40187

This patch implements code gen for 'teams distribute parallel for' on the host, including all its clauses and related regression tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318692 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-20 20:46:39 +00:00
Hans Wennborg 7fa26e7b1c Fix some -Wunused-variable warnings
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318578 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-18 00:49:18 +00:00
Alexey Bataev 36ff1ba8ff [OPENMP] Codegen for `target simd` construct.
Added codegen support for `target simd` directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318536 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17 17:57:25 +00:00
Alexey Bataev 3a91f170c9 [OPENMP] Add support for cancelling inside target parallel for
directive.

Added missed support for cancelling of target parallel for construct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318434 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16 18:20:21 +00:00
Alexey Bataev 1e53b12c18 [OPENMP] Codegen for `#pragma omp target parallel for simd`.
Added codegen for `#pragma omp target parallel for simd` and clauses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317813 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09 17:32:15 +00:00
Alexey Bataev 56cd6a05c2 [OPENMP] Codegen for `#pragma omp target parallel for`.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317719 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08 20:16:14 +00:00
Ivan A. Kosarev a855bcfaf2 [CodeGen] Generate TBAA info for reference loads
Differential Revision: https://reviews.llvm.org/D39177


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316896 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 11:49:31 +00:00
Alexey Bataev 3692af84ce [OPENMP] Fix PR35013: Fix passing VLAs captures to outlined functions.
Fixed passing of VLAs and variably-modified types to outlined functions.
Synchronized passing with the types codegen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316488 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-24 19:52:31 +00:00
Jonas Hahnfeld 13f1a2dfa1 [OpenMP] Avoid VLAs for some reductions on array sections
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316362 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-23 19:01:35 +00:00
Jonas Hahnfeld d194f2aeb2 Revert "[OpenMP] Avoid VLAs for some reductions on array sections"
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316235 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20 20:16:17 +00:00
Jonas Hahnfeld f20a280b3b [OpenMP] Avoid VLAs for some reductions on array sections
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316229 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20 19:40:40 +00:00
Alexey Bataev 1b641bcb61 [OPENMP] Fix capturing of boolean variables in debug mode.
If the variables is boolean and we generating inner function with real
types, the codegen may crash because of not loading boolean value from
memory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316011 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-17 16:47:34 +00:00
Alexey Bataev 76e3b89942 [OPENMP] Add default codegen|tests for 'target parallel for[ simd]'
constructs.

Added default codegen for 'target parallel for' construct + tests for
default codegen of 'target parallel for[ simd]' constructs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315315 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10 14:14:43 +00:00
Ivan A. Kosarev bb7654dfb0 [CodeGen] Do not construct complete LValue base info in trivial cases
Besides obvious code simplification, avoiding explicit creation
of LValueBaseInfo objects makes it easier to make TBAA
information to be part of such objects.

This is part of D38126 reworked to be a separate patch to
simplify review.

Differential Revision: https://reviews.llvm.org/D38695


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315289 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10 09:39:32 +00:00
Carlo Bertolli c64cb39314 [OpenMP] Initial implementation of teams distribute code generation
https://reviews.llvm.org/D38371

This patch implements codegen for the combined 'teams distribute" OpenMP pragma and adds regression tests for all its clauses.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314905 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-04 14:12:09 +00:00
Alexey Bataev 3ac9cc2040 [OPENMP] Capture argument of `device` clause for target-based
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314686 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-02 16:32:39 +00:00
Alexey Bataev bd9a973c97 [OPENMP] Generate implicit map|firstprivate clauses for target-based
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314205 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26 13:47:31 +00:00
Alexey Bataev 0040ea0ac5 [OPENMP] Fix for PR33922: New ident_t flags for
__kmpc_for_static_fini().

Added special flags for calls of __kmpc_for_static_fini(), like previous
ly for __kmpc_for_static_init(). Added flag OMP_IDENT_WORK_DISTRIBUTE
for distribute cnstruct, OMP_IDENT_WORK_SECTIONS for sections-based
  constructs and OMP_IDENT_WORK_LOOP for loop-based constructs in
  location flags.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312642 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-06 16:17:35 +00:00
Alexey Bataev 6c069179ec [OPENMP] Fix for PR34014: OpenMP 4.5: Target construct in static method
of class fails to map class static variable.

If the global variable is captured and it has several redeclarations,
sometimes it may lead to a compiler crash. Patch fixes this by working
only with canonical declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-22 17:54:52 +00:00
Alexey Bataev 5b6371013b [OPENMP] Fix for PR28581: OpenMP linear clause - wrong results.
If worksharing construct has at least one linear item, an implicit
synchronization point must be emitted to avoid possible conflict with
the loading/storing values to the original variables. Added implicit
barrier if the linear item is found before actual start of the
worksharing construct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311013 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-16 15:58:46 +00:00
Alexey Bataev 430fd9ec7c [OPENMP] Fix for PR33922: New ident_t flags for
__kmpc_for_static_init().

OpenMP 5.0 will include OpenMP Tools interface that requires distinguishing different worksharing constructs.

Since the same entry point (__kmp_for_static_init(ident_t *loc,
kmp_int32 global_tid,........)) is called in case static
loop/sections/distribute it is suggested using 'flags' field of the
ident_t structure to pass the type of the construct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310865 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14 17:56:13 +00:00
Alexey Bataev bf1aff02c1 [OPENMP][DEBUG] Fix for PR33676: Debug info for OpenMP region is broken.
After some changes in clang/LLVM debug info for task-based regions was
not generated at all. Patch fixes this problem.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310850 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14 16:03:47 +00:00
Alexey Bataev f925ecb766 [OPENMP] Generalization of calls of the outlined functions.
General improvement of the outlined functions calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310840 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-14 15:01:03 +00:00
Alexey Bataev 1ba8f524f7 [OPENMP] Emit non-debug version of outlined functions with original
name.

If the host code is compiled with the debug info, while the target
without, there is a problem that the compiler is unable to find the
debug wrapper. Patch fixes this problem by emitting special name for the
debug version of the code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310511 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-09 19:38:53 +00:00
Alexey Bataev ce50a95999 [OPENMP][DEBUG] Set proper address space info if required by target.
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310387 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 18:04:06 +00:00
Alexey Bataev 1bc8e95f27 Revert "[OPENMP][DEBUG] Set proper address space info if required by target."
This reverts commit r310377.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310379 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 16:45:36 +00:00
Alexey Bataev 6a68af0c0f [OPENMP][DEBUG] Set proper address space info if required by target.
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310377 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 16:29:11 +00:00
Alexey Bataev 5dc0a08536 Revert "[OPENMP][DEBUG] Set proper address space info if required by target."
This reverts commit r310360.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310364 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 14:44:43 +00:00
Alexey Bataev 7dd032a359 [OPENMP][DEBUG] Set proper address space info if required by target.
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310360 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08 14:25:14 +00:00
Alexey Bataev 91be796f6d Revert "[OPENMP][DEBUG] Set proper address space info if required by target."
This reverts commit r310104.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310135 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 21:27:11 +00:00
Alexey Bataev 3ae5f4e75b Revert "[OPENMP] Fix for pacify buildbots, NFC."
This reverts commit r310120.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310134 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 21:26:25 +00:00
Alexey Bataev b80084e670 [OPENMP] Fix for pacify buildbots, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310120 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 20:29:52 +00:00
Alexey Bataev cf45efc918 [OPENMP][DEBUG] Set proper address space info if required by target.
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310104 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 19:46:10 +00:00
Alexey Bataev 06e5f9a555 [OPENMP] Unify generation of outlined function calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310098 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-04 19:10:54 +00:00