Commit Graph

3071 Commits

Author SHA1 Message Date
Peter Steinfeld 085d794c5f [flang] Make the symbol count used for collating symbols static
I changed the declaration of symbolCount_ in the type Symbols to be
static to avoid possible problems in the future when we might have
multiple objects of type Symbols.  Thanks to Peter for pointing out the
need for this change.

Differential Revision: https://reviews.llvm.org/D98357
2021-03-12 10:56:39 -08:00
Yashaswini 96716e6749 Add Semantic check for Flang OpenMP 4.5 - 2.15.3.6 Reduction clause
Implementation of Reduction clause restriction checks.

Files:

flang/lib/Semantics/check-directive-structure.h
flang/lib/Semantics/check-omp-structure.cpp
flang/lib/Semantics/check-omp-structure.h
flang/lib/Semantics/resolve-directives.cpp

Testcases:

flang/test/Semantics/omp-reduction01.f90
flang/test/Semantics/omp-reduction02.f90
flang/test/Semantics/omp-reduction03.f90
flang/test/Semantics/omp-reduction04.f90
flang/test/Semantics/omp-reduction05.f90
flang/test/Semantics/omp-reduction06.f90
flang/test/Semantics/omp-reduction07.f90
flang/test/Semantics/omp-reduction08.f90
flang/test/Semantics/omp-reduction09.f90
flang/test/Semantics/omp-reduction10.f90
flang/test/Semantics/omp-symbol08.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan and Valentin Clement @clementval.

Differential Revision: https://reviews.llvm.org/D90697
2021-03-12 22:58:14 +05:30
River Riddle 31bb8efd69 [mlir][StorageUniquer] Properly call the destructor on non-trivially destructible storage instances
This allows for storage instances to store data that isn't uniqued in the context, or contain otherwise non-trivial logic, in the rare situations that they occur. Storage instances with trivial destructors will still have their destructor skipped. A consequence of this is that the storage instance definition must be visible from the place that registers the type.

Differential Revision: https://reviews.llvm.org/D98311
2021-03-11 11:35:32 -08:00
Peter Steinfeld 868187df21 [flang] Handle type-bound procedures with alternate returns
If you specify a type-bound procedure with an alternate return, there
will be no symbol associated with that dummy argument.  In such cases,
the compiler's list of dummy arguments will contain a nullptr.  In our
analysis of the PASS arguments of type-bound procedures, we were
assuming that all dummy arguments had non-null symbols associated with
them and were using that assumption to get the name of the dummy
argument.  This caused the compiler to try to dereference a nullptr.

I fixed this by explicitly checking for a nullptr and, in such cases, emitting
an error message.  I also added tests that contain type-bound procedures with
alternate returns in both legal and illegal constructs to ensure that semantic
analysis is working for them.

Differential Revision: https://reviews.llvm.org/D98430
2021-03-11 10:20:34 -08:00
Arnamoy Bhattacharyya e361afb6c5 [flang][OpenMP] Add semantic check for occurrence of multiple list items in aligned clause for simd directive
Reviewed By: kiranchandramohan, clementval

Differential Revision: https://reviews.llvm.org/D97964
2021-03-11 10:01:21 -05:00
Arnamoy Bhattacharyya 1fd4beecc8 [flang][driver] Add -fdebug-module-writer option 2021-03-11 08:04:37 -05:00
Leonard Chan baf637dcde Rename top-level LICENSE.txt files to LICENSE.TXT
This makes all the license filenames uniform across subprojects.

Differential Revision: https://reviews.llvm.org/D98380
2021-03-10 21:26:24 -08:00
Arnamoy Bhattacharyya 361e9bf97e [flang][driver] Formatting OpenMP sema check as per clang-format 2021-03-10 16:54:07 -05:00
Peter Steinfeld 40e261803b [flang] Fix call to CHECK() on overriding an erroneous type-bound procedure
You can define a base type with a type-bound procedure which is erroneously
missing a NOPASS attribute and then define another type that extends the base
type and overrides the erroneous procedure.  In this case, when we perform
semantic checking on the overriding procedure, we verify the "pass index" of
the overriding procedure.  The attempt to get the procedure's pass index fails
a call to CHECK().

I fixed this by calling SetError() on the symbol of the overridden procedure in
the base type.  Then, I check HasError() before executing the code that invokes
the failing call to CHECK().  I also added a test that will cause the compiler
to fail the call to CHECK() without this change.

Differential Revision: https://reviews.llvm.org/D98355
2021-03-10 09:38:29 -08:00
Andrzej Warzynski 547624af19 [flang][driver] Revert RUN-line change
In https://reviews.llvm.org/D98283, the RUN line in pre-fir-tree04.f90
was updated to use `%flang_fc1` instead of `%f18` (so that the test is
shared between the old and the new driver). Unfortunately, the new
driver does not know yet how to find standard intrinsics modules. As a
result, the test fails when `FLANG_BUILD_NEW_DRIVER` is set to On.

I'm restoring the original RUN line. This is rather straightforward, so
sending without a review. This should make Flang builders happy.
2021-03-10 16:58:24 +00:00
Eric Schweitz 987ee6e3cc [flang][fir] Upstream the pre-FIR tree changes.
The PFT has been updated to support Fortran 77.
clang-tidy cleanup.

Authors: Val Donaldson, Jean Perier, Eric Schweitz, et.al.

Differential Revision: https://reviews.llvm.org/D98283
2021-03-10 07:45:58 -08:00
Andrzej Warzynski 523d7bc6f4 [flang][driver] Add `-fdebug-dump-parsing-log`
This patch adds `-fdebug-dump-parsing-log` in the new driver. This option is
semantically identical to `-fdebug-instrumented-parse` in `f18` (the
former is added as an alias in `f18`).

As dumping the parsing log makes only sense for instrumented parses, we
set Fortran::parser::Options::instrumentedParse to `True` when
`-fdebug-dump-parsing-log` is used. This is consistent with `f18`.

To facilitate tweaking the configuration of the frontend based on the
action being requested, `setUpFrontendBasedOnAction` is introduced in
CompilerInvocation.cpp.

Differential Revision: https://reviews.llvm.org/D97457
2021-03-10 12:09:16 +00:00
Andrzej Warzynski 45da495f73 [flang][driver] Merge test/Driver and test/Flang-Driver directories
Until now we've been maintaining 2 test directories for Flang's drivers:
  * test/Driver for `f18` (the current driver)
  * test/Flang-Driver for `flang-new` (the new driver)
As we have started sharing tests between the drivers, this separation is
no longer required. This patch merges the two test directories. As
suggested in the review, moving forward we'll avoid having tests
specifically for the old driver.

A few notable changes:
  * Driver/version-test.f90 and Driver/no-files.f90 are deleted. The
  versions for the new driver are more robust, but tricky to share.
  * Driver/write-module.f90 is deleted in favour of
    Flang-Driver/write-module.f90 (see https://reviews.llvm.org/D97197
    for more context)

Differential Revision: https://reviews.llvm.org/D98257
2021-03-10 11:38:13 +00:00
Mehdi Amini 890afad954 Fix Flang build after MLIR API changes around `generatedTypeParser` 2021-03-09 23:19:30 +00:00
Peter Steinfeld 63200a058e [flang] Sort symbols by creation order
We have a "<" operator defined on the type semantics::Symbol that's based on
the symbols' locations in the cooked character stream.  This is potentially
problematic when comparing symbols from .mod files when the cooked character
streams themselves might be allocated to varying memory locations.

This change fixes that by using the order in which symbols are created as the
basis for the "<" operator.  Thanks to Tim and Peter for consultation on the
necessity of doing this and the idea for what to use as the basis of the sort.

This change in the "<" operator changed the expected results for three of the
tests.  I manually inspected the new results, and they look OK to me.  The
differences in data05.f90 and typeinfo01.f90 are entirely the order, offsets,
and sizes of the derived type components.  The changes in resolve102.f90 are
due to the new, different "<" operator used for sorting.

Differential Revision: https://reviews.llvm.org/D98225
2021-03-09 12:35:32 -08:00
Andrzej Warzynski b04fbc1913 [flang][driver] Refine tests for module search directories
This patch refactors include-module.f90:
  * rename the test file as use-module.f90 to better highlight which
  driver feature is being tested
  * move tests for diagnostics to use-module-error.f90 (it tests that
  `-J/-module-dir` can only be used once)
  * make sure that `f18` is tested when `FLANG_BUILD_NEW_DRIVER` is
  set to `Off`
  * add tests for when all module files are successfully discovered and
  loaded

With this patch, there should be a clear separation into 3 scenarios in
use-module.f90:
  * Everything is OK
  * One module file wasn't found (missing include path for
  basictestingmoduletwo.mod)
  * Two module files are found, but the test requires
  `basictestingmoduleone.mod` from both `Inputs` and `Inputs/module-dir`.
  Only the latter is found.

Reviewed By: tskeith

Differential Revision: https://reviews.llvm.org/D97197
2021-03-09 15:26:48 +00:00
Asher Mancinelli 95193ac5ba [flang] update character tests to use gtest
Move character tests to gtest, according to reviews from revision
D97349. Create a new temporary directory parallel to old runtime
unittests directory to facilitate the transition. Once patches for all
tests have been accepted using GTest, the old directory may be removed.
The new directory is required because LLVM's CMake unit test
infrastructure requires that the test depends on all source files in
the `CMAKE_CURRENT_SOURCE_DIR` directory.

Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D97403
2021-03-09 08:31:20 +00:00
Peter Steinfeld cfd7d8123a [flang] Fix bad dereference of NULLIFY pointer object
When we have a subprogram that has been determined to contain errors, we do not
perform name resolution on its execution part.  In this case, if the subprogram
contains a NULLIFY statement, the parser::Name of a pointer object in a NULLIFY
statement will not have had name resolution performed on it.  Thus, its symbol
will not have been set.  Later, however, we do semantic checking on the NULLIFY
statement.  The code that did this assumed that the parser::Name of the
pointer object was non-null.

I fixed this by just removing the null pointer check for the "symbol" member of
the "parser::Name" of the pointer object when doing semantic checking for
NULLIFY statements.  I also added a test that will make the compiler crash
without this change.

Differential Revision: https://reviews.llvm.org/D98184
2021-03-08 15:01:36 -08:00
Yashaswini a89a3c2c7d Add Semantic check for Flang OpenMP 4.5 - 2.7.1 Do Loop restrictions for Threadprivate.
Implementation of Do loop threadprivate check.

Files:

resolve-directives.cpp

Testcases:

omp-do04-positivecase.f90
omp-do04.f90

Reviewed by: Kiran Chandramohan @kiranchandramohan

Differential Revision: https://reviews.llvm.org/D96686
2021-03-08 20:32:26 +05:30
Valentin Clement c3e5f504a0 [flang][fir] Add FIR Types parser diagnostic tests + cleanup
Add diagnostic tests for Types parsers and remove duplicated diagnostics handled by the MLIR
parser.

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D97643
2021-03-05 14:58:44 -05:00
Valentin Clement d090f42778 [flang][fir] Add diagnostic tests for FIR ops verifier
Add diagnostic tests with fir-opt for the diagnostics emitted by the ops verifier

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D97996
2021-03-05 10:21:17 -05:00
Eric Schweitz 21c8e1b00a [flang][fir][NFC] Update comments. 2021-03-04 13:31:21 -08:00
Arnamoy Bhattacharyya ab971c29a5 [flang][driver] Add options for -fdefault* and -flarge-sizes
Add support for the following Fortran dialect options:
  - -default*
  - -flarge-sizes

It also adds two test cases:
  # For checking whether `flang-new` is passing options correctly to `flang-new -fc1`.
  # For checking if `fdefault-` arguments are processed properly.

Also moves the Dialect related option parsing to a dedicated function
and adds a member `defaultKinds()` to `CompilerInvocation`

Depends on: D96032

Differential Revision: https://reviews.llvm.org/D96344
2021-03-04 13:29:07 +00:00
Alex Zinenko 32c49c7d73 [mlir] ODS: change OpBuilderDAG to OpBuilder
We no longer have the non-DAG version.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D97856
2021-03-04 10:55:02 +01:00
Alex Zinenko 19db802e7b [mlir] make implementations of translation to LLVM IR interfaces private
There is no need for the interface implementations to be exposed, opaque
registration functions are sufficient for all users, similarly to passes.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D97852
2021-03-04 09:16:32 +01:00
River Riddle 64be3fcb7a Fix flang build after D97804 2021-03-03 15:07:03 -08:00
Peter Steinfeld 1c2935a772 [flang] Prohibit MODULE procedures in the global scope
We were allowing procedures with the MODULE prefix to be declared at the global
scope.  This is prohibited by C1547 and was causing an internal check of the
compiler to fail.

I fixed this by adding a check.  I also added a test that would trigger a crash
without this change.

Differential Revision: https://reviews.llvm.org/D97875
2021-03-03 11:50:50 -08:00
Peter Steinfeld 16005fd979 [flang] Detect circularly defined interfaces of procedures
It's possible to define a procedure whose interface depends on a procedure
which has an interface that depends on the original procedure.  Such a circular
definition was causing the compiler to fall into an infinite loop when
resolving the name of the second procedure.  It's also possible to create
circular dependency chains of more than two procedures.

I fixed this by adding the function HasCycle() to the class DeclarationVisitor
and calling it from DeclareProcEntity() to detect procedures with such
circularly defined interfaces.  I marked the associated symbols of such
procedures by calling SetError() on them.  When processing subsequent
procedures, I called HasError() before attempting to analyze their interfaces.
Unfortunately, this did not work.

With help from Tim, we determined that the SymbolSet used to track the
erroneous symbols was instantiated using a "<" operator which was defined using
the location of the name of the procedure.  But the location of the procedure
name was being changed by a call to ReplaceName() between the times that the
calls to SetError() and HasError() were made.  This caused HasError() to
incorrectly report that a symbol was not in the set of erroneous symbols.

I fixed this by changing SymbolSet to be an unordered set that uses the
contents of the name of the symbol as the basis for its hash function.  This
works because the contents of the name of the symbol is preserved by
ReplaceName() even though its location changes.

I also fixed the error message used when reporting recursively defined
dummy procedure arguments by removing extra apostrophes and sorting the
list of symbols.

I also added tests that will crash the compiler without this change.

Note that the "<" operator is used in other contexts, for example, in the map
of characterized procedures, maps of items in equivalence sets, maps of
structure constructor values, ...  All of these situations happen after name
resolution has been completed and all calls to ReplaceName() have already
happened and thus are not subject to the problem I ran into when ReplaceName()
was called when processing procedure entities.

Note also that the implementation of the "<" operator uses the relative
location in the cooked character stream as the basis of its implementation.
This is potentially problematic when symbols from diffent compilation units
(for example symbols originating in .mod files) are put into the same map since
their names will appear in two different source streams which may not be
allocated in the same relative positions in memory.  But I was unable to create
a test that caused a problem.  Using a direct comparison of the content of the
name of the symbol in the "<" operator has problems.  Symbols in enclosing or
parallel scopes can have the same name.  Also using the location of the symbol
in the cooked character stream has the advantage that it preserves the the
order of the symbols in a structure constructor constant, which makes matching
the values with the symbols relatively easy.

This patch supersedes D97749.

Differential Revision: https://reviews.llvm.org/D97774
2021-03-02 15:18:12 -08:00
Peter Steinfeld 95540f9dbf [flang] Detect circularly defined interfaces of procedures
It's possible to define a procedure whose interface depends on a procedure
which has an interface that depends on the original procedure.  Such a circular
definition was causing the compiler to fall into an infinite loop when
resolving the name of the second procedure.  It's also possible to create
circular dependency chains of more than two procedures.

I fixed this by adding the function HasCycle() to the class DeclarationVisitor
and calling it from DeclareProcEntity() to detect procedures with such
circularly defined interfaces.  I marked the associated symbols of such
procedures by calling SetError() on them.  When processing subsequent
procedures, I called HasError() before attempting to analyze their interfaces.
Unfortunately, this did not work.

With help from Tim, we determined that the SymbolSet used to track the
erroneous symbols was instantiated using a "<" operator which was defined using
the location of the name of the procedure.  But the location of the procedure
name was being changed by a call to ReplaceName() between the times that the
calls to SetError() and HasError() were made.  This caused HasError() to
incorrectly report that a symbol was not in the set of erroneous symbols.

I fixed this by changing SymbolSet to be an unordered set that uses the
contents of the name of the symbol as the basis for its hash function.  This
works because the contents of the name of the symbol is preserved by
ReplaceName() even though its location changes.

I also fixed the error message used when reporting recursively defined
dummy procedure arguments by removing extra apostrophes and sorting the
list of symbols.

I also added tests that will crash the compiler without this change.

Note that the "<" operator is used in other contexts, for example, in the map
of characterized procedures, maps of items in equivalence sets, maps of
structure constructor values, ...  All of these situations happen after name
resolution has been completed and all calls to ReplaceName() have already
happened and thus are not subject to the problem I ran into when ReplaceName()
was called when processing procedure entities.

Note also that the implementation of the "<" operator uses the relative
location in the cooked character stream as the basis of its implementation.
This is potentially problematic when symbols from diffent compilation units
(for example symbols originating in .mod files) are put into the same map since
their names will appear in two different source streams which may not be
allocated in the same relative positions in memory.  But I was unable to create
a test that caused a problem.  Using a direct comparison of the content of the
name of the symbol in the "<" operator has problems.  Symbols in enclosing or
parallel scopes can have the same name.  Also using the location of the symbol
in the cooked character stream has the advantage that it preserves the the
order of the symbols in a structure constructor constant, which makes matching
the values with the symbols relatively easy.

This patch supersedes D97749.

Differential Revision: https://reviews.llvm.org/D97774
2021-03-02 10:53:44 -08:00
Andrzej Warzynski bf4dbc4984 [flang][f18] Add missing line in help text (nfc) 2021-03-02 18:14:21 +00:00
Arnamoy Bhattacharyya 563ea45052 [flang][driver] Fix -fdefault* family bug
This patch provides a fix for the `fdefault-*` family in f18

(Please consult `D96344` for details)

Differential Revision: https://reviews.llvm.org/D97724
2021-03-02 17:37:02 +00:00
Andrzej Warzynski 1253009eb2 Revert "[flang] Detect circularly defined interfaces of procedures"
This reverts commit 93c5e6bb49.

This patch updates resolve102.f90 which is now failing in 6 out 8 of our
public buildbots:
  * http://lab.llvm.org:8011/#/builders/21/builds/9625
  * http://lab.llvm.org:8011/#/builders/134/builds/2395
  * http://lab.llvm.org:8011/#/builders/79/builds/6298
  * http://lab.llvm.org:8011/#/builders/66/builds/2084
  * http://lab.llvm.org:8011/#/builders/135/builds/2485
  * http://lab.llvm.org:8011/#/builders/32/builds/3551

Please see the following revisions for more context:
  * https://reviews.llvm.org/D97201
  * https://reviews.llvm.org/D97749
2021-03-02 14:55:41 +00:00
Peter Steinfeld 93c5e6bb49 [flang] Detect circularly defined interfaces of procedures
It's possible to define a procedure whose interface depends on a procedure
which has an interface that depends on the original procedure.  Such a circular
definition was causing the compiler to fall into an infinite loop when
resolving the name of the second procedure.  It's also possible to create
circular dependency chains of more than two procedures.

I fixed this by adding the function HasCycle() to the class DeclarationVisitor
and calling it from DeclareProcEntity() to detect procedures with such
circularly defined interfaces.  I marked the associated symbols of such
procedures by calling SetError() on them.  When processing subsequent
procedures, I called HasError() before attempting to analyze their interfaces.
Unfortunately, this did not work.

With help from Tim, we determined that the SymbolSet used to track the
erroneous symbols was instantiated using a "<" operator which was defined using
the location of the name of the procedure.  But the location of the procedure
name was being changed by a call to ReplaceName() between the times that the
calls to SetError() and HasError() were made.  This caused HasError() to
incorrectly report that a symbol was not in the set of erroneous symbols.

I fixed this by changing SymbolSet to be an unordered set that uses the
contents of the name of the symbol as the basis for its hash function.  This
works because the contents of the name of the symbol is preserved by
ReplaceName() even though its location changes.

I also fixed the error message used when reporting recursively defined dummy
procedure arguments.

I also added tests that will crash the compiler without this change.

Note that the "<" operator is used in other contexts, for example, in the map
of characterized procedures, maps of items in equivalence sets, maps of
structure constructor values, ...  All of these situations happen after name
resolution has been completed and all calls to ReplaceName() have already
happened and thus are not subject to the problem I ran into when ReplaceName()
was called when processing procedure entities.

Note also that the implementation of the "<" operator uses the relative
location in the cooked character stream as the basis of its implementation.
This is potentially problematic when symbols from diffent compilation units
(for example symbols originating in .mod files) are put into the same map since
their names will appear in two different source streams which may not be
allocated in the same relative positions in memory.  But I was unable to create
a test that caused a problem.  Using a direct comparison of the content of the
name of the symbol in the "<" operator has problems.  Symbols in enclosing or
parallel scopes can have the same name.  Also using the location of the symbol
in the cooked character stream has the advantage that it preserves the the
order of the symbols in a structure constructor constant, which makes matching
the values with the symbols relatively easy.

This change supersedes D97201.

Differential Revision: https://reviews.llvm.org/D97749
2021-03-01 19:07:03 -08:00
peter klausler 5a451a4289 [flang] Runtime: SCAN and VERIFY
Implement the related character intrinsic functions
SCAN and VERIFY.

Differential Revision: https://reviews.llvm.org/D97580
2021-03-01 12:15:29 -08:00
Praveen 75ef78ffee [Flang][OpenMP] Add semantic checks for OpenMP clauses.
Semantic checks for the following OpenMP 4.5 clauses.

1. 2.15.4.2 - Copyprivate clause
2. 2.15.3.4 - Firstprivate clause
3. 2.15.3.5 - Lastprivate clause

Add related test cases and resolve test cases marked as XFAIL.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D91920
2021-03-01 19:54:41 +05:30
Andrzej Warzynski 00e6513374 Revert "[flang] Detect circularly defined interfaces of procedures"
This reverts commit 07de0846a5.

The original patch has caused 6 out 8 of Flang's public buildbots to
fail. As I'm not sure what the fix should be, I'm reverting this for
now. Please see https://reviews.llvm.org/D97201 for more context and
discussion.
2021-03-01 10:34:49 +00:00
Eric Schweitz ac473bb2b2 [flang][fir] Upstream utility function valueHasFirAttribute()
This function will be used in subsequent upstreaming merges.

Author: Jean Perier

Differential Revision: https://reviews.llvm.org/D97502
2021-02-26 18:31:32 -08:00
Eric Schweitz 0b785a46b7 [flang][fir] Add remaining Ops. Updates to pre-existing Ops.
- add ops: rebox, insert_on_range, absent, is_present
  - embox, coordinate_of: replace old hand-written parser/pretty-printer with assembly format
  - remove dead floating point ops, since buitlins work for all types
  - update call op
  - update documentation
  - misc. NFC to formatting
  - add op round trip tests

Authors: Eric Schweitz, Jean Perier, Zachary Selk, Kiran Chandramohan, et.al.

Differential Revision: https://reviews.llvm.org/D97500
2021-02-26 17:21:35 -08:00
Eric Schweitz 5077d42cfa [flang][fir][NFC] Removes deprecated messages in builds. 2021-02-26 16:12:49 -08:00
Peter Steinfeld 07de0846a5 [flang] Detect circularly defined interfaces of procedures
It's possible to define a procedure whose interface depends on a procedure
which has an interface that depends on the original procedure.  Such a circular
definition was causing the compiler to fall into an infinite loop when
resolving the name of the second procedure.  It's also possible to create
circular dependency chains of more than two procedures.

I fixed this by adding the function HasCycle() to the class DeclarationVisitor
and calling it from DeclareProcEntity() to detect procedures with such
circularly defined interfaces.  I marked the associated symbols of such
procedures by calling SetError() on them.  When processing subsequent
procedures, I called HasError() before attempting to analyze their interfaces.
Unfortunately, this did not work.

With help from Tim, we determined that the SymbolSet used to track the
erroneous symbols was instantiated using a "<" operator which was
defined using the name of the procedure.  But the procedure name was
being changed by a call to ReplaceName() between the times that the
calls to SetError() and HasError() were made.  This caused HasError() to
incorrectly report that a symbol was not in the set of erroneous
symbols.  I fixed this by making SymbolSet be an ordered set, which does
not use the "<" operator.

I also added tests that will crash the compiler without this change.
And I fixed the formatting on an error message from a previous update.

Differential Revision: https://reviews.llvm.org/D97201
2021-02-26 14:44:35 -08:00
Eric Schweitz 67360decc3 [flang][fir] Add array value operations.
We lower expressions with rank > 0 to a set of high-level array operations.
These operations are then analyzed and refined to more primitve
operations in subsequent pass(es).

This patch upstreams these array operations and some other helper ops.

Authors: Eric Schweitz, Rajan Walia, Kiran Chandramohan, et.al.

https://github.com/flang-compiler/f18-llvm-project/pull/565

Differential Revision: https://reviews.llvm.org/D97421
2021-02-25 19:16:43 -08:00
Christian Sigg 8c074cb0b7 [mlir] Mark OpState::getAttrs() deprecated.
Fix call sites.

The method will be removed 2 weeks later.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D97464
2021-02-25 20:54:42 +01:00
Shao-Ce Sun ad14ccc8c2 [clang][flang] Improve the consistency of the code-base
In clang:
Replace argc_ with Argc
Replace argv_ with Argv
Replace argv with Args
In flang:
Replace argc_ with argc
Replace argv_ with argv
Replace argv with args

Reviewed By: awarzynski, aganea

Differential Revision: https://reviews.llvm.org/D97138
2021-02-25 21:25:43 +08:00
Andrzej Warzynski baebc1162f [clang][driver] Set the input type to Fortran when reading from stdin
This patch makes sure that for the following invocation of the new Flang
driver, clangDriver sets the input type to Fortran:
```
flang-new -E -
```
This change does not affect `clang`, i.e. for the following invocation
the input type is set to C:
```
clang -E -
```

This change leverages the fact that for `flang-new` the driver is in
Flang mode.

Differential Revision: https://reviews.llvm.org/D96777
2021-02-25 13:13:42 +00:00
Eric Schweitz 082ec3ab07 [flang][fir][NFC] Remove dead code.
This patch removes OpaqueAttr as it is no longer used.

Differential Revision: https://reviews.llvm.org/D97424
2021-02-24 17:31:23 -08:00
Valentin Clement 841f6995cd [flang][fir][NFC] Move remaining types to TableGen type definition
Move the remaing of FIR types to TableGen type definition. This follow suggestion in D96422.

Reviewed By: schweitz, jeanPerier, rriddle

Differential Revision: https://reviews.llvm.org/D96987
2021-02-24 20:23:31 -05:00
Jean Perier b146dfe527 [flang] add attribute to trim runtime implementation establish call
CFI allocatable attribute is needed so that the descriptor for the
result can be allocated/deallocated.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D97395
2021-02-24 18:53:55 +01:00
Eric Schweitz 3304061432 [flang][fir] Add zero_bits operation.
This patch adds the new zero_bits operation and upstrams other changes
including the following:

  - update tablegen syntax to newer forms
  - update memory effects annotations
  - update documentation [NFC]
  - other NFC, such as whitespace and formatting

Differential revision: https://reviews.llvm.org/D97331
2021-02-24 08:15:16 -08:00
Eric Schweitz 6740694742 [flang][fir][NFC] remove dead code
Removes unused function from FatalError.h.

Differential revision: https://reviews.llvm.org/D97328
2021-02-23 13:21:15 -08:00
Andrzej Warzynski 5e54bef4d2 [flang][test] Share all driver test dirs between `f18` and `flang-new`
Originally, when we added the new driver, we created dedicated test
directories for `flang-new`. This way we separated the tests for the
`throwaway` and the new driver.

As we are increasing test coverage and starting to share tests between
the two drivers, it makes sense to share all directories and instead
rely on:
```
! REQUIRES: new-flang-driver
```
to mark tests as exclusively for the new driver.

Differential Revision: https://reviews.llvm.org/D97207
2021-02-23 18:21:32 +00:00