Commit Graph

22 Commits

Author SHA1 Message Date
Alexey Bataev 68d230359a [OPENMP] Support for -fopenmp-simd option with compilation of simd loops
only.

Added support for -fopenmp-simd option that allows compilation of
simd-based constructs without emission of OpenMP runtime calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321560 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-29 18:07:07 +00:00
Alexey Bataev f66517edc4 [OPENMP] Fix for PR34398: assert with random access iterator if the
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312292 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-31 23:06:52 +00:00
Alexey Bataev 6a092ca245 [OPENMP] Remove extra code transformation.
For better support of some specific GNU extensions some extra
transformation of AST nodes were introduced. These transformations are
very hard to handle. The code is improved in handling of these
extensions by using captured expressions construct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264709 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-29 08:58:54 +00:00
Alexey Bataev 4bffc24d2f [OPENMP] Allow to use compound assignment operators.
Loop-based directives allow to use iterators as loop counters. Iterators are allowed to define their own operators. This patch allows to use compound assignment operators for iterators.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260957 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-16 12:13:49 +00:00
Alexey Bataev ee1775e00f [OPENMP] Do not allow to use threadprivate or thread local variables as loop iteration variables.
According to OpenMP the loop iteration variable may not appear in a threadprivate directive.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256417 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-25 13:38:08 +00:00
Akira Hatanaka 66bf0e5936 Produce a better diagnostic for global register variables.
Currently, when there is a global register variable in a program that
is bound to an invalid register, clang/llvm prints an error message that
is not very user-friendly.

This commit improves the diagnostic and moves the check that used to be
in the backend to Sema. In addition, it makes changes to error out if
the size of the register doesn't match the declared variable size.

e.g., volatile register int B asm ("rbp");

rdar://problem/23084219

Differential Revision: http://reviews.llvm.org/D13834


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253405 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 00:15:28 +00:00
Alexey Bataev 76f851a544 [OPENMP] Fix for http://llvm.org/PR24371: Assert failure compiling blender 2.75.
blender uses statements expression in condition of the loop under control of the '#pragma omp parallel for'. This condition is used several times in different expressions required for codegen of the loop directive. If there are some variables defined in statement expression, it fires an assert during codegen because of redefinition of the same variables.
We have to rebuild several expression to be sure that all variables are unique.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245041 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-14 12:25:37 +00:00
Alexey Bataev aca4fe314a [OPENMP 4.1] Allow references in init expression for loop-based constructs.
OpenMP 4.1 allows to use variables with reference types in private clauses and, therefore, in init expressions of the cannonical loop forms.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244209 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-06 12:30:57 +00:00
Alexey Bataev e77f872c9e [OPENMP 4.1] Support for 'linear' clause in loop directives.
OpenMP 4.1 allows 'linear' clause in loop directives. Patch adds support for it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243969 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-04 11:18:19 +00:00
Alexey Bataev 18ad179208 [OPENMP] Fixed detection of canonical loops with random access iterators.
Add handling of iterators with copy/move constructors with default arguments + converting template constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242382 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-16 04:19:43 +00:00
Alexey Bataev 4b96eb8f82 [OPENMP] -fopenmp enables OpenMP support (fix for http://llvm.org/PR23492)
-fopenmp turns on OpenMP support and links libiomp5 as OpenMP library. Also there is -fopenmp={libiomp5|libgomp} option that allows to override effect of -fopenmp and link libgomp library (if -fopenmp=libgomp is specified).
Differential Revision: http://reviews.llvm.org/D9736


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237769 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-20 04:24:19 +00:00
Alexey Bataev 29fafc4751 [OPENMP] Allow using of threadprivate variables as loop-control variables in lop based directives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237102 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-12 09:02:07 +00:00
Alexey Bataev 868284215f [OPENMP] Fixed messages about predetermined DSA for loop control variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236574 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 07:25:08 +00:00
Alexey Bataev af1d9f4a83 [OPENMP] Fix for http://llvm.org/PR23387: clang fails to compile magick/attribute.c
Allow to use variables with 'register' storage class as loop control variables in OpenMP loop based constructs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236571 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-06 06:34:55 +00:00
Alexey Bataev befe8d1ce6 [OPENMP] Allow to use global variables as lcv in loop-based directives.
For proper codegen we need to capture variable in the OpenMP region. In loop-based directives loop control variables are private by default and they must be captured in this region. There was a problem with capturing of globals, used as lcv, as they was not marked as private by default.
Differential Revision: http://reviews.llvm.org/D9336


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236201 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30 04:23:23 +00:00
Alexey Bataev 7b497ad067 [OPENMP] Temporary fix for processing of global variables in loops.
Currently there is a bug in processing of global variables used as loop control variables in 'omp for/simd' constructs: these globals must be captured as private variables, but currently they are nor. This is a temporary bug fix for this problem until the correct solution is prepared. If a global var used as lcv without explicit mark as a private/linear/lastprivate the error message is emitted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221970 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-14 04:08:45 +00:00
Alexander Musman 2dfdada16c [OPENMP] Loop collapsing and codegen for 'omp simd' directive.
This patch implements collapsing of the loops (in particular, in
presense of clause 'collapse'). It calculates number of iterations N
and expressions nesessary to calculate the nested loops counters
values based on new iteration variable (that goes from 0 to N-1)
in Sema. It also adds Codegen for 'omp simd', which uses
(and tests) this feature.

Differential Revision: http://reviews.llvm.org/D5184



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218743 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 06:03:56 +00:00
Alexey Bataev 05fbd2d2d1 [OPENMP] Added several test cases for clauses 'ordered' and 'nowait': if there are more than one 'nowait' or 'ordered' clause an error message is expected.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213496 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-21 02:45:36 +00:00
Alexey Bataev 36046a82fc [OPENMP] Added initial support for 'omp parallel for'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212453 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-07 13:01:15 +00:00
Alexey Bataev b23263a1ac [OPENMP] Initial support for '#pragma omp for' (fixed incompatibility with MSVC).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211140 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 04:14:57 +00:00
Rafael Espindola 7d2009b4cd Revert "[OPENMP] Initial support for '#pragma omp for'."
This reverts commit r211096. Looks like it broke the msvc build:

SemaOpenMP.cpp(140) : error C4519: default template arguments are only allowed on a class template

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211113 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-17 17:20:53 +00:00
Alexey Bataev 46c5afbd70 [OPENMP] Initial support for '#pragma omp for'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211096 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-17 11:49:22 +00:00