Commit Graph

2809 Commits

Author SHA1 Message Date
Praveen G 7a91794d5b [Flang][OpenMP] Add semantic checks for OpenMP Private clause.
Add the semantic checks for the OpenMP 4.5 - 2.15.3.3 Private clause.

1. Pointers with the INTENT(IN) attribute may not appear in a private clause.
2. Variables that appear in namelist statements may not appear in a private clause.
   A flag 'InNamelist' is added to the Symbol::Flag to identify the symbols
   in Namelist statemnts.

Test cases : omp-private01.f90, omp-private02.f90

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D90210
2020-11-30 11:46:36 -05:00
Johannes Doerfert c557f549ba [Flang][Docs] Update call information and add two more calls
Call information have been updated and the OpenMP in LLVM as well as
Classic Flang call have been added.
2020-11-25 11:52:35 -06:00
Valentin Clement e73d8c793a [flang][openacc] Semantic check for cache directive
Add semantic check for the cache directive. According to section 2.10 from the specification:
A var in a cache directive must be a single array element or a simple subarray.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D90184
2020-11-25 10:28:14 -05:00
Yashaswini 29dffb0c8a Add Semantic check for Flang OpenMP 4.5 - 2.7.1 ordered and collapse clause
Semantic check added to check and restrict the value of the parameter in the COLLAPSE or ORDERED clause
if it is larger than the number of nested loops following the construct.

Test Cases:
omp-do-collapse-positivecases.f90
omp-do-collapse.f90
omp-do-ordered-positivecases.f90
omp-do-ordered.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan , Valentin Clement @clementval

Differential Revision: https://reviews.llvm.org/D89860
2020-11-22 18:38:57 +05:30
Yashaswini 3ee08e3819 Add Semantic check for Flang OpenMP 4.5 - 2.15.3.2 and 2.15.3.3 shared and private clause
Semantic check to restrict the appearance of a variable that is part of another variable
 (as an array or structure element) in a PRIVATE or SHARED clause.

Test Cases:

omp-parallel-private01.f90
omp-parallel-private02.f90
omp-parallel-private03.f90
omp-parallel-private04.f90
omp-parallel-shared01.f90
omp-parallel-shared02.f90
omp-parallel-shared03.f90
omp-parallel-shared04.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan , Valentin Clement @clementval

Differential Revision: https://reviews.llvm.org/D89395
2020-11-22 12:50:17 +05:30
clementval 952c9d3a91 [NFC] Fix typo in atomic 2020-11-21 14:32:31 -05:00
Valentin Clement aa179d8099 [flang][openmp] Separate memory-order-clause parser creating OmpClause node
This patch introduce the separate parser for the memory-order-clause from the general
OmpClauseList. This parser still creates OmpClause node and therefore can use all the feature
from TableGen and the OmpStructureChecker.
This is applied only for the Flush construct in this patch and it should be applied for
atomic as well.

This is the approach we disscussed several time during the weekly call.

Reviewed By: kiranchandramohan, sameeranjoshi

Differential Revision: https://reviews.llvm.org/D91839
2020-11-21 14:31:33 -05:00
sameeran joshi 1df8fa78e6 [Flang][OpenMP][NFC][2/2] Reorder OmpStructureChecker and simplify it.
`OmpStructureChecker` has too much boilerplate code in source file.

This patch:
  1. Use helpers from `check-directive-structure.h` and reduces the boilerplate.
  2. Use TableGen infrastructure as much as possible.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D90834
2020-11-21 22:37:35 +05:30
sameeran joshi 42ecf188b5 [flang][openmp] Fix bug in `OmpClause::Hint` clause which was missing to generate inside in OMP.cpp.inc file.
Before this patch "Hint" isn't found inside the generated file.
./bin/llvm-tblgen --gen-directive-gen ../llvm-project/llvm/include/llvm/Frontend/OpenMP/OMP.td -I ../llvm-project/llvm/include/ > OMP.cpp.in

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D91909
2020-11-21 19:02:34 +05:30
Valentin Clement 553e364194 [flang][openacc] Add clause validity tests for the host_data directive
Add some clause validity tests for the host_data directive to avoid future regressions.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D91889
2020-11-20 20:17:37 -05:00
Valentin Clement 755674b715 [flang][openacc] Add clause validity tests for the parallel directive
Add some clause validity tests for parallel directive.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D91871
2020-11-20 20:05:10 -05:00
Pete Steinfeld da02327b9c
Update OptionComparison.md 2020-11-20 10:33:21 -08:00
Andrzej Warzynski 1b749c0cb5 [flang][driver] Remove unnecessary CMake dependencies (nfc)
Remove clangFrontend from the list of dependencies. These should have
been removed in: 8d51d37e06. See also
https://reviews.llvm.org/D87774.
2020-11-20 16:44:11 +00:00
River Riddle 65fcddff24 [mlir][BuiltinDialect] Resolve comments from D91571
* Move ops to a BuiltinOps.h
* Add file comments
2020-11-19 11:12:49 -08:00
peter klausler 5349f99114 [flang] Correct handling of null pointer initializers
Fortran defines "null-init" null pointer initializers as
being function references, syntactically, that have to resolve
to calls to the intrinsic function NULL() with no actual
arguments.

Differential revision: https://reviews.llvm.org/D91657
2020-11-18 13:57:25 -08:00
Peter Steinfeld ea4973f206 [flang] Improve error message on bad LOGICAL compare operations
When comparing LOGICAL operands using ".eq." or ".ne." we were not
guiding users to the ".eqv." and ".neqv." operations.

Differential Revision: https://reviews.llvm.org/D91736
2020-11-18 13:53:29 -08:00
Peter Steinfeld 3fd7774033 [flang] Fix FIR test failures
When doing out-of-tree builds, FIR tests were failing.  I made a change
similar to the one by @jurahul to fix this.

Differential Revision: https://reviews.llvm.org/D91654
2020-11-17 12:25:15 -08:00
Andrzej Warzynski e8356a79ff [flang][nfc] Add missing dependency in CMake
This missing dependency has been causing the Flang buildbots
(with BUILD_SHARED_LIBS set to ON) to fail:
  * http://lab.llvm.org:8011/#/builders/66/builds/542
  * http://lab.llvm.org:8011/#/builders/33/builds/764

This missing dependency was exposed by this change:
  * https://reviews.llvm.org/D91461
This change is fine - the root cause of the failing builds is the
missing dependency.
2020-11-17 14:32:39 +00:00
River Riddle 73ca690df8 [mlir][NFC] Remove references to Module.h and Function.h
These includes have been deprecated in favor of BuiltinDialect.h, which contains the definitions of ModuleOp and FuncOp.

Differential Revision: https://reviews.llvm.org/D91572
2020-11-17 00:55:47 -08:00
Peter Steinfeld 681978d3b4 [flang] Duplicate names for ac-implied-do variables erroneously cause errors
According to section 19.4, paragraph 5, the scope of an ac-implied-do variable
is the enclosing ac-implied-do.  But we were not creating new scopes upon
entry to an ac-implied-do.  This was causing error messages to be erroneously
emitted.

I fixed, the code, added a test to array-constr-values.f90, added the test
folding15.f90 and corrected the test symbol05.f90.

Differential Revision: https://reviews.llvm.org/D91560
2020-11-16 18:57:13 -08:00
Rahul Joshi ba3317d0ba Fix flang MLIR unit test verification failures
- Eliminate public function declarations in these tests
2020-11-16 17:32:28 -08:00
Praveen G 2e26459fab [Flang][OpenMP] Add semantic checks for OpenMP Depend clause.
Add the semantic checks for the OpenMP 4.5 - 2.13.9 Depend clause.

1. List items in depend clause should not be zero length array sections.
2. A variable that is part of another variable like structure component
   should not be specified on a depend clause.

Test cases : omp-depend01.f90, omp-depend02.f90, omp-depend03.f90

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D89934
2020-11-16 13:11:28 -05:00
peter klausler df62afd559 [flang] Unsplit COMPLEX operations
COMPLEX negation, addition, subtraction, conversions of kind, and
equality/inequality were represented as component-wise REAL
operations.  It turns out to be easier for lowering if we
do not split and recombine these COMPLEX operations, and it
avoids a potential problem with COMPLEX valued function calls
in these contexts.  So add this suite of operations to the
typed expression representation in place of the component-wise
transformations, and support them in folding.

Differential revision: https://reviews.llvm.org/D91443
2020-11-16 09:39:03 -08:00
Andrzej Warzynski 6c02835d6c [flang][f18] Remove "-fdebug-resolve-names"
This option doesn't enable any unique feature/code-patch. Also, it is
neither tested nor documented.

Differential Revision: https://reviews.llvm.org/D91537
2020-11-16 15:49:55 +00:00
Peter Steinfeld 5795a81cba [flang] Fix "EQ" comparison of arrays
When comparing arrays whose shapes do not conform, the contant folding
code ran into problems trying to get the value of an extent that did not
exist.  There were actually two problems.  First, the routine
"CheckConformance()" was returning "true" when the compiler was unable
to get the extent of an array.  Second, the function
"ApplyElementwise()" was calling "CheckConformance()" prior to folding
the elements of two arrays, but it was ignoring the return value.

Differential Revision: https://reviews.llvm.org/D91440
2020-11-13 15:18:13 -08:00
peter klausler c2bccd66f6 [flang] Document DO CONCURRENT's problems (NFC)
Differential Revision: https://reviews.llvm.org/D86556
2020-11-12 15:30:43 -08:00
peter klausler 04a147987a [flang] Include source information in an invalid file-unit-number message
An io-unit that is an internal-file-variable is syntactically identical
to a file-unit-number expression that is a variable reference.  An
ambiguous unit is initially parsed as an internal-file-variable.  If
semantic analysis determines that the unit is not of character type,
it is rewritten as an internal-file-variable.  This modification must
retain source coordinate information.

Differential revision: https://reviews.llvm.org/D91375
2020-11-12 13:12:17 -08:00
peter klausler 6c516cda39 [flang] Recognize END FILE as ENDFILE in free form source
The ENDFILE statement may be spelled as two words.

Differential revision: https://reviews.llvm.org/D91377
2020-11-12 12:46:04 -08:00
peter klausler 3ce5f95716 fix clang build 2020-11-12 11:38:20 -08:00
peter klausler 8df28f0aa3 [flang] Implement runtime support for basic ALLOCATE/DEALLOCATE
Add error reporting infrastructure and support for ALLOCATE
and DEALLOCATE statements of intrinsic types without SOURCE=
or MOLD=.

Differential revision: https://reviews.llvm.org/D91215
2020-11-12 10:21:40 -08:00
peter klausler cc575dd2ce [flang][MSVC] Use list<Message> rather than forward_list<> in Messages
The implementation of Messages with forward_list<> makes some
nonstandard assumptions about the validity of iterators that don't
hold up with MSVC's implementation.  Use list<> instead.  The
measured performance is comparable.

This change obviated a distinction between two member functions
of Messages, and the uses of one have been replaced with calls
to the other.

Similar usage in CharBuffer was also replaced for consistency.

Differential revision: https://reviews.llvm.org/D91210
2020-11-11 16:38:38 -08:00
peter klausler 67b13e9785 [flang] Fix CheckSpecificationExpr handling of associated names
Avoid a spurious error message about a dummy procedure reference
in a specification expression by restructuring the handling of
use-associated and host-associated symbols.

Updated to fix a circular dependence between shared library
binaries that was introduced by the original patch.

Differential revision: https://reviews.llvm.org/D91286
2020-11-11 13:51:42 -08:00
peter klausler b781a04f6a [flang] Allow labels on END statements.
F18 clause 5.3.3 explicitly allows labels on program unit END statements.
Label resolution code accounts for this for singleton program units,
but incorrectly generates an error for host subprograms with internal
subprograms.

   subroutine s(n)
      call s1(n)
      if (n == 0) goto 88 ! incorrect error
      print*, 's'
   contains
      subroutine s1(n)
         if (n == 0) goto 77 ! ok
         print*, 's1'
   77 end subroutine s1
   88 end

Label resolution code makes a sequential pass over an entire file to
collect label information for all subprograms, followed by a pass through
that information for semantics checks.  The problem is that END statements
may be separated from prior subprogram code by internal subprogram
definitions, so an END label can be associated with the wrong subprogram.

There are several ways to fix this.  Labels are always local to a
subprogram.  So the two separate passes over the entire file could probably
instead be interleaved to perform analysis on a subprogram as soon as the
end of the subprogram is reached, using a small stack.  The stack structure
would account for the "split" code case.  This might work.

It is possible that there is some not otherwise apparent advantage to
the current full-file pass design.  The parse tree has productions that
provide access to a subprogram END statement "in advance".  An alternative
is to access this information to solve the problem.  This PR implements
this latter option.

Differential revision: https://reviews.llvm.org/D91217
2020-11-11 13:06:19 -08:00
peter klausler 2d5b850751 [flang] Use IMPLICIT from scope of external function reference
Implicitly typed references to external functions are applying
the IMPLICIT typing rules of the global scope in which their
symbols were created, not the IMPLICIT typing rules in force in
the scope from which they were referenced.

Differential revision: https://reviews.llvm.org/D91214
2020-11-11 12:12:24 -08:00
peter klausler 29fa451870 [flang] Add isnan() extension intrinsic function, with folding
It's nonstandard, but commonly implemented.

Differential revision: https://reviews.llvm.org/D91213
2020-11-11 11:40:57 -08:00
Andrzej Warzynski fdbc7e505c [flang][driver] Make sure that `-###` is marked as supported (NFC)
`-###` has always been supported in the new flang driver. This patch
merely makes sure that it's included when printing the help screen (i.e.
`flang-new -help`).
2020-11-11 13:12:51 +00:00
Andrzej Warzynski eae2d63571 Revert "[flang] Fix CheckSpecificationExpr handling of associated names"
This reverts commit b670189975.

This patch causes shared library builds (BUILD_SHARED_LIBS=ON) to fail:
* http://lab.llvm.org:8011/#/builders/33/builds/626

I wasn't able to identify any easy fix, hence reverting.
2020-11-11 11:33:16 +00:00
Yashaswini c3b1395384 Add Semantic check for Flang OpenMP 4.5 - 2.7.1 schedule clause
Semantic check for the positive chunk size.

Test Cases:
omp-do-schedule01.f90
omp-do-schedule02.f90
omp-do-schedule03.f90
omp-do-schedule04.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan

Differential Revision: https://reviews.llvm.org/D89546
2020-11-11 15:56:18 +05:30
peter klausler b670189975 [flang] Fix CheckSpecificationExpr handling of associated names
Avoid a spurious error message about a dummy procedure reference
in a specification expression by restructuring the handling of
use-associated and host-associated symbols.

Differential revision: https://reviews.llvm.org/D91209
2020-11-10 16:19:13 -08:00
sameeran joshi 2f7a41b2a7 [Flang][OpenMP] Fix 'Internal: no symbol found' for OpenMP aligned and linear clause.
The initial approach was to go with changing parser nodes from `std::list<parser::Name>` to `OmpObjectList`, but that might have lead to illegal programs.
Resolving the symbols inside `OmpAttributeVisitor`.
Fix a couple of `XFAIL` tests.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D90538
2020-11-10 22:47:13 +05:30
sameeran joshi 7282d9e170 [Flang][Docs] Fix warnings when building docs.
Following warning were seen with recommonmark(0.5.0) and sphinx(1.8.5).
`parser.py:75: UserWarning: Container node skipped: type=document warn("Container node skipped: type={0}".format(mdnode.t))`

The warnings are due to an issue in recommonmark's(a python package) older versions.
A better solution is to use the latest version of recommonmark(>=0.6.0) to avoid
these issue in the first place.
This patch fixes the warnings for older versions.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D91117
2020-11-10 22:24:49 +05:30
Peter Steinfeld 66a9607557 [flang] Avoid calling the linker when "-c" option is used
The title says it all.
2020-11-09 10:22:13 -08:00
Valentin Clement 9914a8737f [flang][openacc] Add parsing tests and semantic check for set directive
This patch add some parsing and clause validity tests for the set directive.
It makes use of the possibility introduces in patch D90770 to check the restriction
were one of the default_async, device_num and device_type clauses is required but also
not more than once on the set directive.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D90771
2020-11-05 22:57:58 -05:00
Andrzej Warzynski 93c94139e6 [flang][f18] Remove unimplemented options (NFC)
These options are in practice passes to the external tool (defined with
F18_FC), i.e. fall into "unrecognised" category. No need to keep them
among other options that are actually parsed.
2020-11-05 18:35:35 +00:00
Andrzej Warzynski a7bcb3b9eb [Flang][f18] Remove unimplemented options from `flang -help` (NFC) 2020-11-05 12:47:42 +00:00
Alex Zinenko cc2a2bb5ce [flang] update ODS syntax to use OpBuidlerDAG instead of OpBuilder
Upstream MLIR has deprecated OpBuilder in ODS.

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D90226
2020-11-05 09:28:20 +01:00
Valentin Clement 1dad9d4282 [flang][openacc] Lower wait directive
This patch upstream the lowering of Wait directive that was initially done in
https://github.com/flang-compiler/f18-llvm-project/pull/532

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D90489
2020-11-04 21:15:52 -05:00
Valentin Clement 4ec7f7e45a [flang][openacc] Lower init and shutdown directive
This patch upstream the lowering of Init and Shutdown directives that was initially done in
https://github.com/flang-compiler/f18-llvm-project/pull/529

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D90488
2020-11-04 19:30:46 -05:00
Valentin Clement b45ea4451a [flang][openacc] Lower update directive
This patch upstream the lowering of Update directive that was initially done in
https://github.com/flang-compiler/f18-llvm-project/pull/528

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D90472
2020-11-04 15:48:07 -05:00
Valentin Clement c71adeff24 [flang][openacc] Lower enter data directive
This patch upstream the lowering of Enter Data directive that was initially done in
https://github.com/flang-compiler/f18-llvm-project/pull/526

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D90470
2020-11-04 15:17:50 -05:00