Commit Graph

4345 Commits

Author SHA1 Message Date
Andrzej Warzynski dd56939a4b [flang][driver] Add support for generating LLVM bytecode files
Support for generating LLVM BC files is added in Flang's compiler and
frontend drivers. This requires the `BitcodeWriterPass` pass to be run
on the input LLVM IR module and is implemented as a dedicated frontend
aciton. The new functionality as seen by the user (compiler driver):
```
flang-new -c -emit-llvm file.90
```
or (frontend driver):
```
flang-new -fc1 -emit-llvm-bc file.f90
```

The new behaviour is consistent with `clang` and `clang -cc1`.

Differential Revision: https://reviews.llvm.org/D123211
2022-04-13 10:19:56 +00:00
Jean Perier ce6ca8e71e [flang] D123388 fix - remove unused variable from test 2022-04-11 12:00:20 +02:00
Mats Petersson 3d0e0e1027 [flang][runtime] Prefer process time over thread time in CPU_TIME
Most Fortran compilers appear to return the process time
for calls to CPU_TIME, where the flang implementation
prior to this change was returning the time used by the
current thread. This would cause incorrect time being
reported when for example OpenMP is used to share work
across multiple CPUs.

This patch changes the order so the selection of "what
time to return" so that if there is a process time to
report, that is the reported value, and only if that is
not available, the thread time is considerd instead.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D123416
2022-04-11 10:44:33 +01:00
Kiran Chandramohan 07e16a2aae [Flang][OpenMP] Add implementation of privatisation
Privatisation creates local copies of variables in the OpenMP region.
Two functions `createHostAssociateVarClone` and `copyHostAssociateVar`
are added to create a clone of the variable for basic privatisation and to
copy the contents for first-privatisation.

Note: Tests for more data-types will be added when the fir.do_loop is
upstreamed.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: peixin, NimishMishra

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Peter Klausler <pklausler@nvidia.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Co-authored-by: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Co-authored-by: Nimish Mishra <neelam.nimish@gmail.com>
Co-authored-by: Peixin-Qiao <qiaopeixin@huawei.com>
2022-04-11 09:20:22 +00:00
jeanPerier 189cb7df91 [flang] Lower optionals in GET_COMMAND_ARGUMENT and GET_ENVIRONMENT_VARIABLE
Handle dynamic optional argument in GET_COMMAND_ARGUMENT and GET_ENVIRONMENT_VARIABLE
(previously compiled but caused segfaults). The previous code
handled static presence/absence aspects, but not when an absent dummy optional was
passed to one of the optional intrinsic arguments.

Simplify the runtime call lowering to simply lower the runtime call without
dealing with optionality there. This keeps the optional handling logic in
IntrinsicCall.cpp.

Note that the new code will generate some extra "if (not null addr )/then/else"
when the actual arguments are always there at runtime. That makes the implementation
a lot simpler/safer, and I think it is OK for now (I do not expect these runtime
function to be called in hot loop nests).

Differential Revision: https://reviews.llvm.org/D123388
2022-04-11 09:33:49 +02:00
Jean Perier 9cfa899b87 [flang] add a static assert in CheckUnitNumberInRangeImpl
Add a check that CheckUnitNumberInRangeImpl is not needlessly instantiated.

Differential Revision: https://reviews.llvm.org/D123285
2022-04-11 09:32:52 +02:00
Fangrui Song 30b1c1f23d [Driver] Simplify -f[no-]diagnostics-color handling. NFC
Make them aliases for -f[no-]color-diagnostics.
2022-04-10 01:07:44 -07:00
PeixinQiao 38c502b6c7 [flang] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build
Fix the warning from D122483.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D123455
2022-04-09 23:57:50 +08:00
Peixin-Qiao 2cbd4fc442 [flang] Support export/import OpenMP Threadprivate Flag
The information about OpenMP/OpenACC declarative directives in modules
should be carried in export mod files. This supports export OpenMP
Threadprivate directive and import OpenMP declarative directives.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D120396
2022-04-09 13:52:31 +08:00
Jennifer Yu 187ccc66fa [clang][OpenMP5.1] Initial parsing/sema for has_device_addr
Added basic parsing/sema/ support for the 'has_device_addr' clause.

Differential Revision: https://reviews.llvm.org/D123402
2022-04-08 21:19:38 -07:00
Valentin Clement ab8e1e6e5a
[flang] Do not fold fir.box_addr when it has a slice
This patch avoids to fold `fir.box_addr` when the defining `fir.embox` op
has a slice. If the op is folded the slice information are lost.

This kind of problem occurred with code like:

```
call check(y(half+1:))
```

where `y` is an array.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D123392
2022-04-08 21:16:55 +02:00
PeixinQiao eb4d5b852e [flang] Fix semantic analysis for "forall" targeted by "label"
As Fortran 2018 3.18 states, the branch target statement can be
`forall-construct-stmt`, but cannot be `forall-stmt`. `forall-stmt` is
wrapped by `Statement` in `action-stmt` and `action-stmt` can be one
branch target statement. Fix the semantic analysis and add two
regression test cases in lowering.

Reviewed By: Jean Perier

Differential Revision: https://reviews.llvm.org/D123373
2022-04-09 00:27:53 +08:00
Shraiysh Vaishay fa4b1e1e95 [flang][OpenMP] Added allocate clause translation for OpenMP block constructs
This patch adds translation for allocate clause for parallel and single
constructs.

Also added tests for block constructs.

This patch also adds tests for parallel construct which were not added earlier.

Reviewed By: NimishMishra, peixin

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

Co-authored-by: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
2022-04-08 20:01:22 +05:30
Jean Perier 4535bb9b80 [flang] Handle dynamically optional argument in EXIT
The actual argument passed to STATUS may be a dummy OPTIONAL or a
disassociated POINTER/unallocated ALLOCATABLE.

Differential Revision: https://reviews.llvm.org/D123380
2022-04-08 15:51:44 +02:00
Jean Perier f1cfa461f2 [flang][NFC] rename isAbsent to isStaticallyAbsent in IntrinsicCall.cpp
isAbsent/isPresent helpers only give information about static presence
of intrinsic arguments. Many intrinsic arguments optionality is dynamic
(an absent dummy can legally be passed to these intrinsics). This
requires a different handling (like `handleDynamicOptional`).

Rename the helpers to avoid misleading coder/reader into thinking all
optionality cases are covered by them.

Differential Revision: https://reviews.llvm.org/D123378
2022-04-08 13:49:30 +02:00
Markus Böck 0c789db541 [mlir] Add support for operation-produced successor arguments in BranchOpInterface
This patch revamps the BranchOpInterface a bit and allows a proper implementation of what was previously `getMutableSuccessorOperands` for operations, which internally produce arguments to some of the block arguments. A motivating example for this would be an invoke op with a error handling path:
```
invoke %function(%0)
  label ^success ^error(%1 : i32)

^error(%e: !error, %arg0 : i32):
  ...
```
The advantages of this are that any users of `BranchOpInterface` can still argue over remaining block argument operands (such as `%1` in the example above), as well as make use of the modifying capabilities to add more operands, erase an operand etc.

The way this patch implements that functionality is via a new class called `SuccessorOperands`, which is now returned by `getSuccessorOperands`. It basically contains an `unsigned` denoting how many operator produced operands exist, as well as a `MutableOperandRange`, which are the usual forwarded operands we are used to. The produced operands are assumed to the first few block arguments, followed by the forwarded operands afterwards. The role of `SuccessorOperands` is to provide various utility functions to modify and query the successor arguments from a `BranchOpInterface`.

Differential Revision: https://reviews.llvm.org/D123062
2022-04-08 08:28:16 +02:00
River Riddle af371f9f98 Reland [GreedPatternRewriter] Preprocess constants while building worklist when not processing top down
Reland Note: Adds a fix to properly mark a commutative operation as folded if we change the order
             of its operands. This was uncovered by the fact that we no longer re-process constants.

This avoids accidentally reversing the order of constants during successive
application, e.g. when running the canonicalizer. This helps reduce the number
of iterations, and also avoids unnecessary changes to input IR.

Fixes #51892

Differential Revision: https://reviews.llvm.org/D122692
2022-04-07 11:31:42 -07:00
Valentin Clement 02da964350
[mlir][CSE] Remove duplicated operations with MemRead side-effect
This patch enhances the CSE pass to deal with simple cases of duplicated
operations with MemoryEffects.

It allows the CSE pass to remove safely duplicate operations with the
MemoryEffects::Read that have no other side-effecting operations in
between. Other MemoryEffects::Read operation are allowed.

The use case is pretty simple so far so we can build on top of it to add
more features.

This patch is also meant to avoid a dedicated CSE pass in FIR and was
brought together afetr discussion on https://reviews.llvm.org/D112711.
It does not currently cover the full range of use cases described in
https://reviews.llvm.org/D112711 but the idea is to gradually enhance
the MLIR CSE pass to handle common use cases that can be used by
other dialects.

This patch takes advantage of the new CSE capabilities in Fir.

Reviewed By: mehdi_amini, rriddle, schweitz

Differential Revision: https://reviews.llvm.org/D122801
2022-04-07 10:08:55 +02:00
Jean Perier c58c64d05c [flang] Add runtime API to catch unit number out of range
Unit numbers must fit on a default integer. It is however possible that
the user provides the unit number in UNIT with a wider integer type.
In such case, lowering was previously silently narrowing
the value and passing the result to the BeginXXX runtime entry points.
Cases where the conversion caused overflow were not reported/caught.
Most existing compilers catch these errors and raise an IO error.
Add a CheckUnitNumberInRange runtime API to do the same in f18.

This runtime API has its own error management interface (i.e., does not
use GetIoMsg, EndIo, and EnableHandlers) because the usual error
management requires BeginXXX to be called to set up the error
management. But in this case, the BeginXXX cannot be called since
the bad unit number that would be provided to it overflew (and in the worst
case scenario, the narrowed value could point to a different valid unit
already in use). Hence I decided to make an API that must be called
before the BeginXXX and should trigger the whole BeginXXX/.../EndIoStatement
to be skipped in case the unit number is too big and the user enabled
error recovery.

Note that CheckUnitNumberInRange accepts negative numbers (as long as
they can fit on a default integer), because unit numbers may be negative
if they were created by NEWUNIT.

Differential Revision: https://reviews.llvm.org/D123157
2022-04-06 15:38:13 +02:00
Jean Perier 0601a0dc01 [flang] Fix fir.embox codegen with constant interior shape
Fix https://github.com/flang-compiler/f18-llvm-project/issues/1416.

The `constRows` variable was being decremented too soon, causing the
last constant interior dimension extent being used to multiply the GEP
offset. This lead to wrong address computation and caused segfaults.

Note: also upstream fir.embox tests that can be upstreamed.

Differential Revision: https://reviews.llvm.org/D123130
2022-04-05 17:27:03 +02:00
Jean Perier bb3afae99b [flang] Set lower bounds of array section fir.embox to one
Do not use the shift of a fir.embox to set lower bounds if there is
a fir.slice operand. This matches Fortran semantics where lower bounds
of array sections are ones.
Note that in case there is a fir.slice, the array shift may be provided
because it is used to calculate the origin/base address of an array slice.

Add a TODO for substring codegen since I noticed it was not upstreamed
yet and would cause some program to silently compile incorrectly.

Differential Revision: https://reviews.llvm.org/D123123
2022-04-05 17:25:48 +02:00
Andrzej Warzynski dda366ed37 [flang][cmake] Make CMake copy "omp_lib.h" into the build directory
Any header or module file in the Flang source directory is of no use to
the compiler unless it is copied into the build directory. Indeed, all
compiler search paths are relative to the compiler executable (flang-new
in our case). Hence, "omp_lib.h" should be copied into the build
directory alongside other compiler-provided files that can be "included"
(header files) or "used" (module files).

For now, "omp_lib.h" is copied into "<build-dir>/include/flang/OpenMP".
We may decide to change this in future. For example, Clang copies a
bunch of runtime headers into “<build-dir>/lib/clang/<version-number>”.
We could also consider using a similar header from a different
sub-project.

Flang's driver search path is updated accordingly. A rule for
"installing" the "omp_lib.h" header is _yet to be added_ (we will also
need to determine the suitable location for this).

Differential Revision: https://reviews.llvm.org/D122015
2022-04-05 08:25:26 +00:00
River Riddle 5e50dd048e [mlir] Rework the implementation of TypeID
This commit restructures how TypeID is implemented to ideally avoid
the current problems related to shared libraries. This is done by changing
the "implicit" fallback path to use the name of the type, instead of using
a static template variable (which breaks shared libraries). The major downside to this
is that it adds some additional initialization costs for the implicit path. Given the
use of type names for uniqueness in the fallback, we also no longer allow types
defined in anonymous namespaces to have an implicit TypeID. To simplify defining
an ID for these classes, a new `MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID` macro
was added to allow for explicitly defining a TypeID directly on an internal class.

To help identify when types are using the fallback, `-debug-only=typeid` can be
used to log which types are using implicit ids.

This change generally only requires changes to the test passes, which are all defined
in anonymous namespaces, and thus can't use the fallback any longer.

Differential Revision: https://reviews.llvm.org/D122775
2022-04-04 13:52:26 -07:00
PeixinQiao fbdcb3ce6b [flang] Add one semantic check for allocatable/pointer argument association
The actual argument shall have deferred the same type parameters as
the dummy argument if the argument is allocatable or pointer variable.
Currently programs not following this get one crash during execution.

Reviewed By: Jean Perier

Differential Revision: https://reviews.llvm.org/D122779
2022-04-04 23:16:30 +08:00
Andrzej Warzynski 03efa5a362 [flang] Update the conversion code for fir.coordinate_of
These are mostly small changes to make the code a bit clearer and more
consistent. Summary of changes:
  * add missing namespace qualifiers (that's the preference in Flang)
  * replace const member methods with static methods (to avoid passing
    the *this pointer unnecessarily)
  * rename `currentObjTy` (current object type) as `cpnTy` (component
    type) - the latter feels more fitting
  * remove redundant `return failure();` calls (` return
    mlir::emitError` gives the same result)
  * updated a few comments

Differential Revision: https://reviews.llvm.org/D122799
2022-04-04 10:15:14 +00:00
Valentin Clement d333b38270
[flang][NFC] Add tests for array-value-copy pass with array with pointers
This patch adds tests for the array-value-copy pass with array assignment
involving Fortran pointers.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D122878
2022-04-04 10:45:45 +02:00
Jean Perier b8e8f62d5e [flang] Fold instantiated PDT character component length when needed
In case a character component PDT length only depends on kind parameters,
fold it while instantiating the PDT. This is especially important if the
component has an initializer because later semantic phases (offset
computation or runtime type info generation) might get confused and
generate offset/type info that will lead to crashes in lowering.

Differential Revision: https://reviews.llvm.org/D122938
2022-04-04 09:47:15 +02:00
Valentin Clement 7dc492ed34
[flang][NFC] Add tests for fir.address_of
This patch adds FIR to LLVM test for fir.address_of.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-04-04 09:28:44 +02:00
Kiran Chandramohan 0000030b18 Revert "[Flang][OpenMP] Add semantic check for OpenMP Private, Firstprivate and Lastprivate clauses."
This reverts commit a2ca6bbda6.

D93213 performs some checks to ensure that variables that appear in
statement functions are not in privatisation clauses. The point at
which this check is currently performed, there can be misparses that
cause more constructs to be identified as statement functions. This
can lead to various kinds of errors, hence reverting.

This revert hopefully fixes:
https://github.com/llvm/llvm-project/issues/54477
https://github.com/llvm/llvm-project/issues/54161
https://github.com/llvm/llvm-project/issues/54163

Reviewed By: shraiysh

Differential Revision: https://reviews.llvm.org/D122650
2022-04-03 15:54:02 +00:00
Valentin Clement 3bcc928b1b
[flang][NFC] Add tests for fir.array_modify in array-value-copy pass
This patch adds some test for the `fir.array_modify` operation
in the array-value-copy pass

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-04-03 15:26:14 +02:00
Valentin Clement 0371f3e232
[flang][NFC] Add more test cases for the array-value-copy pass
This patch adds some test cases for the array-value-copy pass with slices.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-04-03 15:25:10 +02:00
Valentin Clement 602dd6bd32
[flang][NFC] Add tests for fir.is_present
This patch adds tests for the `fir.is_present`
translation.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-04-03 15:22:33 +02:00
Valentin Clement e0c782bdc0
[flang] Add global and global box initialization tests
This patch addes some global initialization and global
box initialization tests.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-04-03 15:20:55 +02:00
Valentin Clement 2fb57d628c
[flang][NFC] Add tests for select constructs
Add tests for fir.select_rank and
fir.select_case.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: schweitz

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-04-03 15:18:57 +02:00
Jean Perier 7c158e3e55 [flang] add evaluate::IsAllocatableDesignator helper
Previously, some semantic checks that are checking if an entity is an
allocatable were relying on the expression being a designator whose
last symbol has the allocatable attribute.

This is wrong since this was considering substrings and array sections of
allocatables as being allocatable. This is wrong (see NOTE 2 in
Fortran 2018 section 9.5.3.1).

Add evaluate::IsAllocatableDesignator to correctly test this.
Also add some semantic tests for ALLOCATED to test the newly added helper.
Note that ifort and nag are rejecting coindexed-named-object in
ALLOCATED (`allocated(coarray_scalar_alloc[2])`).
I think it is wrong given allocated argument is intent(in) as per
16.2.1 point 3.
So 15.5.2.6 point 4 regarding allocatable dummy is not violated (If the actual
argument is a coindexed object, the dummy argument shall have the INTENT (IN)
attribute.) and I think this is valid. gfortran accepts it.

The need for this helper was exposed in https://reviews.llvm.org/D122779.

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

Co-authored-by: Peixin-Qiao <qiaopeixin@huawei.com>
2022-04-01 22:34:19 +02:00
Mehdi Amini ba43d6f85c Revert "[GreedPatternRewriter] Preprocess constants while building worklist when not processing top down"
This reverts commit 59bbc7a085.

This exposes an issue breaking the contract of
`applyPatternsAndFoldGreedily` where we "converge" without applying
remaining patterns.
2022-04-01 06:16:55 +00:00
Valentin Clement 868c212f42
[flang] Keep fully qualified !fir.heap type for fir.freemem op
Re-introduce a fully qualified type on teh fir.freemem operation.
Since this is the only operation where the prefix gets elided in fir, this
patch make it fully qualified so the dialect syntax feels more consistent.

Reviewed By: vdonaldson

Differential Revision: https://reviews.llvm.org/D122839
2022-03-31 21:37:21 +02:00
River Riddle 59bbc7a085 [GreedPatternRewriter] Preprocess constants while building worklist when not processing top down
This avoids accidentally reversing the order of constants during successive
application, e.g. when running the canonicalizer. This helps reduce the number
of iterations, and also avoids unnecessary changes to input IR.

Fixes #51892

Differential Revision: https://reviews.llvm.org/D122692
2022-03-31 12:08:55 -07:00
Jean Perier 88d4b85f59 [flang] Allow user to recover from bad edit descriptor with INTEGER
Runtime was crashing when an INTEGER passed in formatted output with
a bad edit descriptor even when the user did provide IOSTAT. Flang
is already signaling an error when facing similar error with other
types. Do the same with INTEGERs.

The input case is already signaling an error in the related input error
case.

Differential Revision: https://reviews.llvm.org/D122749
2022-03-31 10:57:13 +02:00
Jean Perier 14c7754a35 [flang] Skip `D` when including D debug line
When including debug lines as code, the `D` should be considered as
a white space. Currently an error was raised about bad labels because
it the `D` remained a `D` when considering the source line as code.

Differential Revision: https://reviews.llvm.org/D122711
2022-03-31 10:56:25 +02:00
V Donaldson 09b1a6d673 [flang] Correct a typo when parsing format token white space
A format such as "( D   C, X6. 2  )" is parsed the same as "(DC,X6.2)".
2022-03-30 18:56:09 -07:00
serge-sans-paille c531171d99 Fix invalid overflow check in flang
Statically checking for overflow with

    if constexpr (sizeof(std::size_t) <= sizeof(std::int64_t)) {
         return static_cast<std::int64_t>(length);
    }

Doesn't work if `sizeof(std::size_t) == sizeof(std::int64_t)` because std::size_t
is unsigned.

if `length == std::numeric_limits<size_t>` casting it to `int64_t` is going to overflow.

This code would be much simpler if returning a `uint64_t` instead of a signed
value...

Differential Revision: https://reviews.llvm.org/D122705
2022-03-30 16:47:33 +02:00
Jean Perier ec13942e71 [flang] prevent undefined behavior in character MAXLOC folding
When folding MAXLOC/MINLOC, the current element being compared was moved twice
in row in case it became the new extremum. With numeric and logical types, it
made no difference (std::move is a no-op for them), but for characters
where the string storage is actually moved, it caused the new extremum to
be set to the empty string, leading to wrong results.

Note: I could have left the first std::move relating to logical Findloc, but it
brings nothing and makes the code less auditable, so I also removed it.

Differential Revision: https://reviews.llvm.org/D122590
2022-03-29 09:34:09 +02:00
Shraiysh Vaishay 1fe4b968c5 [flang][OpenMP] Added parallel sections translation
This patch adds translation for parallel sections from PFT to MLIR.

Reviewed By: kiranchandramohan, NimishMishra

Differential Revision: https://reviews.llvm.org/D122464
2022-03-29 11:16:38 +05:30
Emil Kieri 577827cbbf [flang][driver] Make --version and -version consistent with clang
This patch makes -version valid, and --version invalid, for
flang-new -fc1. The invocation
  flang-new --version
remains valid. This behaviour is consistent with clang
(and with clang -cc1 and clang -cc1as).

Previously, flang-new -fc1 accepted --version (as per Options.td), but
the frontend driver acutally checks for -version. As a result,
  flang-new -fc1 --version
triggered no action, emitted no message, and stalled waiting for
standard input.

Fixes #51438

Reviewed By: PeteSteinfeld, awarzynski

Differential Revision: https://reviews.llvm.org/D122542
2022-03-28 22:53:17 +02:00
Peter Klausler e619c07d16 [flang] Fold NEAREST() and its relatives
Implement constant folding for the intrinsic function NEAREST()
and the related functions IEEE_NEXT_AFTER(), IEEE_NEXT_UP(), and
IEEE_NEXT_DOWN().

Differential Revision: https://reviews.llvm.org/D122510
2022-03-28 11:33:40 -07:00
Mogball e51652f9bf [mlir] Simplify LoopLikeOpInterface
- Adds default implementations of `isDefinedOutsideOfLoop` and `moveOutOfLoop` since 99% of all implementations of these functions were identical
- `moveOutOfLoop` takes one operation and doesn't return anything anymore. 100% of all implementations of this function would always return `success` and uses would either respond with a pass failure or an `llvm_unreachable`.
2022-03-28 18:10:04 +00:00
Kiran Chandramohan c49af35a3d [Flang] Options to lower math intrinsics to relaxed, precise variants
Enable lowering to the relaxed and precise variants in the pgmath
library.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Peter Klausler <pklausler@nvidia.com>

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D122484
2022-03-28 17:17:51 +00:00
Valentin Clement 534b228313
[flang] Lower some coarray statements to their runtime functions
This patch adds the lowering of coarray statements to the runtime
functions. The runtime functions are currently not implemented.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D122466
2022-03-28 13:36:32 +02:00
Andrzej Warzynski 4ca111d4cb Revert "[flang] Add & use a better visit()"
This reverts commit 2ab9990c9e. It has
caused multiple build failures:
*  https://lab.llvm.org/buildbot/#/builders/177/builds/4346
*  https://lab.llvm.org/buildbot/#/builders/180/builds/3803
*  https://lab.llvm.org/buildbot/#/builders/175/builds/10419
*  https://lab.llvm.org/buildbot/#/builders/191/builds/4318
*  https://lab.llvm.org/buildbot/#/builders/173/builds/4274
*  https://lab.llvm.org/buildbot/#/builders/181/builds/4297

All these bots failed with a time-out:
```
command timed out: 1200 seconds without output running [b'ninja', b'-j', b'32'], attempting to kill
```
I'm guessing that that's due to template instantiations failing at some
point (https://reviews.llvm.org/D122441 introduced a custom
implementation of std::visit). Everything seems fine when either:
* building on X86 with GCC or Clang (tested with GCC 9.3 and Clang 12)
* building on AArch64 with GCC (tested with GCC 11)
2022-03-28 10:46:47 +00:00
Shraiysh Vaishay fcbf00f098 [mlir][OpenMP] Added ReductionClauseInterface
This patch adds the ReductionClauseInterface and also adds reduction
support for `omp.parallel` operation.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D122402
2022-03-28 14:24:28 +05:30
Jean Perier 479eed1850 [flang][runtime] Ensure PointerDeallocate actually deallocate pointers
PointerDeallocate was silently doing nothing because it relied on
Destroy that doe not do anything for Pointers. Add an option to Destroy
in order to destroy pointers.

Add a unit test for PointerDeallocate.

Differential Revision: https://reviews.llvm.org/D122492
2022-03-28 10:22:08 +02:00
Peter Klausler 435641bc3d [flang] Catch bad OPEN(STATUS=) cases
STATUS='NEW' and 'REPLACE' require FILE= to be present.
STATUS='SCRATCH' may not appear with FILE=.

These errors are caught at compilation time when constant character
strings are used in an OPEN statement, but the runtime needs
to enforce them as well to catch errors in OPEN statements
with character variables and expressions.

Differential Revision: https://reviews.llvm.org/D122509
2022-03-25 18:24:50 -07:00
Peter Klausler 5c116d50e4 [flang] Mark C_ASSOCIATED specific procedures as PURE
The interfaces to C_ASSOCIATED()'s specific procedures must be
PURE so that they are accepted for use in specification expressions.

Differential Revision: https://reviews.llvm.org/D122438
2022-03-25 15:04:26 -07:00
Peter Klausler 2ab9990c9e [flang] Add & use a better visit()
Adds flang/include/flang/Common/visit.h, which defines
a Fortran::common::visit() template function that is a drop-in
replacement for std::visit().  Modifies most use sites in
the front-end and runtime to use common::visit().

The C++ standard mandates that std::visit() have O(1) execution
time, which forces implementations to build dispatch tables.
This new common::visit() is O(log2 N) in the number of alternatives
in a variant<>, but that N tends to be small and so this change
produces a fairly significant improvement in compiler build
memory requirements, a 5-10% improvement in compiler build time,
and a small improvement in compiler execution time.

Building with -DFLANG_USE_STD_VISIT causes common::visit()
to be an alias for std::visit().

Calls to common::visit() with multiple variant arguments
are referred to std::visit(), pending further work.

Differential Revision: https://reviews.llvm.org/D122441
2022-03-25 13:15:20 -07:00
Peter Klausler 0363a164b6 [flang] Fix bogus error from assignment to CLASS(*)
Assignment semantics was coughing up bad errors and crashes for
intrinsic assignments to unlimited polymorphic entities while
looking for any (impossible) user defined ASSIGNMENT(=) generic
or intrinsic type conversion.

Differential Revision: https://reviews.llvm.org/D122440
2022-03-25 11:17:01 -07:00
Jean Perier 5bc9ee1b78 [flang][lowering] Handle zero extent case in LBOUND
Follow up of https://reviews.llvm.org/D121488. Ensure lower bounds
are `1` when the related dimension extent is zero. Note that lower
bounds from descriptors are now guaranteed to fulfill this property
after the runtime/codegen patches.

Also fixes explicit shape array extent lowering when instantiating
variables to deal with negative extent cases (issue found while testing
LBOUND edge case). This notably caused allocation crashes when dealing
with automatic arrays with reversed bounds or negative size
specification expression. The standard specifies that the extent of such
arrays is zero. This change has some ripple effect in the current lit
tests.

Add move two helpers as part of this change:
- Add a helper to tell if a fir::ExtendedValue describes an assumed size
  array (last dimension extent is unknown to the compiler, both at compile
  time and runtime).

- Move and share getIntIfConstant from Character.cpp so that it can be
  used elsewhere (NFC).

Differential Revision: https://reviews.llvm.org/D122467
2022-03-25 18:05:54 +01:00
Peter Klausler 174cabeda5 [flang] Fix cycle-catcher in procedure characterization
The "seenProcs" sets passed as arguments to the procedure and dummy
procedure characterization routines need to be passed by value so that
local updates to those sets do not become permanent.  They are
presently passed by reference and that has led to bogus errors about
recursively defined procedures in testing.

(It might be faster to pass the sets by reference and undo those local
updates in these functions, but that's error-prone, and the performance
difference is not expected to be detectable in practice.)

Differential Revision: https://reviews.llvm.org/D122439
2022-03-25 09:49:55 -07:00
Kiran Chandramohan 7babc8e6cd [Flang] Lower achar intrinsic
The intrinsic returns the character located at the position requested
in the ASCII sequence. The intrinsic is lowered to inline FIR code.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: clementval

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-25 14:23:32 +00:00
Jean Perier 6daa206b5d [flang][NFC] fix comment typo in SetLowerBound description 2022-03-25 01:32:57 -07:00
Jean Perier d3bc3a0400 [flang][codegen] ensure descriptor lower bounds are LBOUND compliant
Follow-up of https://reviews.llvm.org/D121488 to ensure all descriptors
created inline complies with LBOUND requirement that the lower bound is
`1` when the related dimension extent is zero.

Both fir.xrebox and fir.xembox codegen is updated to enforce this
constraint.

Also upstream the "normalized lower bound" attribute that was added in fir-dev
since embox codegen was upstreamed, it is conflicting with this patch
otherwise.

Differential Revision: https://reviews.llvm.org/D122419
2022-03-25 09:02:57 +01:00
Jean Perier 7f1adbaba9 [flang] Fix LBOUND rewrite on descriptor components
GetLowerBoundHelper rewrite in https://reviews.llvm.org/D121488 was
incorrect with POINTER/ALLOCATABLE components. The rewrite created a
descriptor inquiry to the component symbol only instead of the whole
named entity. The base information was lost, and not retrievable.
LBOUND(a(10)%p) became LBOUND(p).

Fix this regression, and also update DescriptorInquiry unparsing to
carry the kind information. DescriptorInquiries are KIND 8 expressions,
while LBOUND/SIZE/RANK, %LEN are default kind expressions.
This caused `print *,lbound(x,kind=8)` to unparse as `print*,lbound(x)` which is not
semantically the same (this unparsing issue was not an issue for
lowering, but I noticed it while writing my regression test).

Differential Revision: https://reviews.llvm.org/D122406
2022-03-25 09:00:56 +01:00
Valentin Clement 50354558a7
[flang] Lower mvbits intrinsic
This patch adds the lowering for the `mvbits`
intrinsic.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-03-25 08:01:27 +01:00
Peter Steinfeld df209b8038 [flang] Make not yet implemented messages more consistent
To make it easier to find things that are not yet implemented, I'm changing the
messages that appear in the compiler's output to all have the string "not yet
implemented:".

These changes apply to files in the front end.  I have another set of changes
to files in the lowering code.

Differential Revision: https://reviews.llvm.org/D122355
2022-03-24 15:19:40 -07:00
Valentin Clement a80bf18565
[flang][NFC] Remove unused variable 2022-03-24 20:43:11 +01:00
Valentin Clement 44b0ea44f2
[flang[OpenACC] Lower wait directive
This patch adds lowering for the `!$acc wait` directive
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D122399
2022-03-24 17:15:27 +01:00
Valentin Clement 5ee88e0ba5
[flang[OpenACC] Lower data directive
This patch adds lowering for the `!$acc data`
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D122384

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D122398
2022-03-24 15:30:31 +01:00
Valentin Clement c6a9ce2b6b
[flang][OpenACC] Lower update directive
This patch adds lowering for the `!$acc update`
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D122387

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D122396
2022-03-24 15:19:05 +01:00
Valentin Clement 39157b98fd
[flang][OpenACC] Lower init/shutdown directive
This patch adds lowering for the `!$acc init` and `!$acc shutdown`
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D122384

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D122387
2022-03-24 15:18:09 +01:00
Valentin Clement 67defe5067
[flang][OpenACC] Lower exit data directive
This patch adds lowering for the `!$acc exit data` directive
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D122384

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D122386
2022-03-24 15:15:56 +01:00
Valentin Clement 12d22cea73
[flang][OpenACC] Lower enter data directive
This patch adds lowering for the `!$acc enter data` directive
from the PFT to OpenACC dialect.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D122384
2022-03-24 15:01:05 +01:00
Valentin Clement 30b4421a74
[flang][NFC] Add lowering test for array expression
This patches adds lowering tests for some array
expressions use cases.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-24 14:59:33 +01:00
Peixin-Qiao 6ce82eae1f [NFC][flang] Remove unused code in lowerExplicitLowerBounds
There is no need to lower the implicit lower bounds for assumed-shape
array in lowerExplicitLowerBounds. Remove the unused code.

Reviewed By: Jean Perier

Differential Revision: https://reviews.llvm.org/D122280
2022-03-24 16:50:38 +08:00
Jean Perier ca46521a4d [flang] UBOUND() edge case: empty dimension
Similarly to LBOUND in https://reviews.llvm.org/D121488, UBOUND must
return zero for an empty dimension, no matter the specification
expression.

Add a GetUBOUND method to be used in expression rewrite that prevents
folding UBOUND to a bound specification expression if the extent is
not a compile time constant.

Fold the case where the extents is known to be zero (and also deal with
this case in LBOUND since we can and should to comply with constant
expression requirements).

Differential Revision: https://reviews.llvm.org/D122242
2022-03-24 09:07:15 +01:00
Nimish Mishra 88d5289fc6 [flang][OpenMP] Added lowering support for sections construct
This patch adds lowering support (from PFT to FIR) for sections construct

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D122302
2022-03-24 13:29:38 +05:30
Shraiysh Vaishay cd28353e3f [flang] Single construct translation from PFT to FIR
This patch adds translation for single construct along with nowait
clause from PFT to FIR.

Allocate clause is added as a TODO as handleAllocateClause is added in
D122302.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D122324
2022-03-24 12:00:44 +05:30
Kiran Chandramohan cf198e927d [Flang][NFC] Rearrange intrinsic generator functions
This patch rearranges the generator functions for various intrinsics.
The rearrangement will help to identify any missing functionality.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D122334
2022-03-24 02:03:12 +00:00
Valentin Clement d3ebefb154
[flang][NFC] Add forall lowering test
Add test for forall lowering use case.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-24 00:09:57 +01:00
Valentin Clement b914efc529
[flang][NFC] Add more lowering tests
This patch adds more lowering tests from the PFT to FIR.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-24 00:09:06 +01:00
Valentin Clement 00cc73044d
[flang][NFC] Add lowering tests for interfaces
This patch adds lowering tests for Fortran
interfaces.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-23 23:02:44 +01:00
Valentin Clement e847374e19
[flang][NFC] Add derived type lowering tests
Add more use cases of lowering of derived types.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Peter Steinfeld <psteinfeld@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2022-03-23 23:00:02 +01:00
Roger Ferrer Ibanez d2663fcc39 [flang][Evaluate] Fold DBLE
We can reuse the folding of REAL.

Differential Revision: https://reviews.llvm.org/D122214
2022-03-23 17:27:05 +00:00
Valentin Clement b38e78cc44
[flang][NFC] Add module lowering tests
This patch adds test for the lowering of Fortran modules.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-23 17:51:09 +01:00
Valentin Clement 850de56b06
[flang][NFC] Add nested where lowering test
this patch adds lowering tests for
netsed where statements

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-23 17:04:18 +01:00
Valentin Clement e539faced8
[flang][NFC] Add global lowering tests
This patch adds some lowering tests for globals.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-23 17:02:15 +01:00
Valentin Clement 3ea6727e33
[flang][NFC] Add IO related lowering tests
This patch adds lowering tests for IO related use cases.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-23 16:54:03 +01:00
Valentin Clement dd3e54213c
[flang][NFC] Add namelist lowering test
This patch adds a lowering test for the namelist.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Peter Steinfeld <psteinfeld@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2022-03-23 16:52:44 +01:00
Kiran Chandramohan 7a9891c598 [Flang] Lower sin, cos intrinsics
The intrinsic computes the sin, cosine values. By default they are lowered
to runtime calls to the pgmath library, for llvm lowering they are
lowered to llvm intrinsics. The generic and llvm lowering does not
lower floating point types with kind greater than 8, the llvm lowering
does not support the complex types.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: clementval

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-23 15:20:51 +00:00
Kiran Chandramohan 3d94851735 [Flang] Lower atan, sinh, cosh intrinsics
The intrinsic computes the tan and hyperbolic sin, cosine values. By
default they are lowered to runtime calls to the math library. Not all
types are supported currently. The generic and llvm lowering does not
lower floating point types with kind greater than 8, the llvm lowering
does not support the complex types.

Note: tanh is not present in fir-dev hence ignoring for now. We can add
support after upstreaming is complete. sin and cos will come in separate
patches since they have llvm intrinsic lowering.

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: William Moses <gh@wsmoses.com>
2022-03-23 14:46:41 +00:00
Valentin Clement c1e7296354
[flang][NFC] Add character lowering tests
This patch some lowering tests for characters related operations.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2022-03-23 15:28:29 +01:00
Valentin Clement e28e1b4b6d
[flang][NFC] Add call lowering tests
This patch adds various lowering test
for calls.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Mats Petersson <mats.petersson@arm.com>
2022-03-23 15:27:17 +01:00
Valentin Clement ac4c0d6431
[flang][NFC] Add misc lowering tests
This patch adds some lowering tests.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-23 15:24:40 +01:00
Valentin Clement dfb31a28ff
[flang] Add lowering C interoperability test
This patch adds a lowering test for the C
interoperability.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-23 15:23:34 +01:00
Danny Mösch a749e3295d Replace links to archived mailing lists by links to Discourse forums 2022-03-23 10:10:20 -04:00
Valentin Clement 2985d1c267
[flang][NFC] Fix lowering tests indent
Remove 2 spaces indent that was introduced by mistake
when upstreaming these files.
2022-03-23 09:24:18 +01:00
Shraiysh Vaishay 51433662e2 [flang] Flush and master constructs
This patch adds tests for flush and master constructs

This is part of the upstreaming effort from the fir-dev branch in [1].
[1] https://github.com/flang-compiler/f18-llvm-project

Reviewed By: kiranchandramohan

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

Co-authored By: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
2022-03-23 10:04:46 +05:30
Shraiysh Vaishay b244bba582 [mlir][OpenMP] Added assembly format for omp.wsloop and remove parseClauses
This patch
 - adds assembly format for `omp.wsloop` operation
 - removes the `parseClauses` clauses as it is not required anymore

This is expected to be the final patch in a series of patches for replacing
parsers for clauses with `oilist`.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D121367
2022-03-23 10:02:02 +05:30
Valentin Clement d8beb2c33d
[flang][NFC] Add forall lowering tests
This patch adds some lowering tests for the `forall` construct.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-03-22 21:34:59 +01:00
Valentin Clement 3de6b1ce0d
[flang][NFC] Add pointer dummy arguments tests
This patch adds test for calls with POINTER dummy arguments on the caller side.

It also fixes some formatting error that was introduced when upstreaming
the other pointer tests.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2022-03-22 20:57:15 +01:00
Peter Klausler bafbae238a [flang] Initial UTF-8 support in runtime I/O
Implements UTF-8 encoding and decoding for external units
with OPEN(ENCODING='UTF-8').  This encoding applies to default
CHARACTER values that are not 7-bit ASCII as well as to
the wide CHARACTER kinds 2 and 4.  Basic testing is in place
via direct calls to the runtime I/O APIs, but serious checkout
awaits lowering support of the wide CHARACTER kinds.

Differential Revision: https://reviews.llvm.org/D122038
2022-03-22 11:48:14 -07:00