|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init |
|
| #
baec06a9 |
| 16-Jul-2022 |
Peter Klausler <[email protected]> |
[flang] Fold calls to ISHFTC()
The integer arithmetic template supports ISHFTC() but the integer intrinsic folding code had yet to call it; finish the job.
Differential Revision: https://reviews.ll
[flang] Fold calls to ISHFTC()
The integer arithmetic template supports ISHFTC() but the integer intrinsic folding code had yet to call it; finish the job.
Differential Revision: https://reviews.llvm.org/D130379
show more ...
|
| #
ae93d8ea |
| 05-Jul-2022 |
Peter Klausler <[email protected]> |
[flang] Fold TRANSFER()
Fold usage of the raw data reinterpretation intrinsic function TRANSFER().
Differential Revision: https://reviews.llvm.org/D129671
|
| #
23c2bedf |
| 01-Jul-2022 |
Peter Klausler <[email protected]> |
[flang] Establish a single source of target information for semantics
Create a TargetCharacteristics class to centralize the few items of target specific information that are relevant to semantics.
[flang] Establish a single source of target information for semantics
Create a TargetCharacteristics class to centralize the few items of target specific information that are relevant to semantics. Use the new class for all target queries, including derived type component layout modeling.
Future work will initialize this class with target information provided or forwarded by the drivers, and use it to fold layout-dependent intrinsic functions like TRANSFER().
Differential Revision: https://reviews.llvm.org/D129018
Updates: Attempts to work around build issues on Windows.
show more ...
|
|
Revision tags: llvmorg-14.0.6, llvmorg-14.0.5 |
|
| #
ed71a0b4 |
| 02-Jun-2022 |
Peter Klausler <[email protected]> |
[flang] When folding FINDLOC, convert operands to a common type
For example, FINDLOC(A,X) should convert both A and X to COMPLEX(8) if the operands are REAL(8) and COMPLEX(4), so that comparisons ca
[flang] When folding FINDLOC, convert operands to a common type
For example, FINDLOC(A,X) should convert both A and X to COMPLEX(8) if the operands are REAL(8) and COMPLEX(4), so that comparisons can be done without losing inforation. The current implementation unconditionally converts X to the type of the array A.
Differential Revision: https://reviews.llvm.org/D127030
show more ...
|
|
Revision tags: llvmorg-14.0.4, llvmorg-14.0.3 |
|
| #
35cc2ec4 |
| 28-Apr-2022 |
Mike Kashkarov <[email protected]> |
[flang] Support FINDLOC/MAXLOC/MINLOC with scalar mask
Previously MASK= elements were accessed in assumption that mask is an array of input argument rank (and in combination with explicit DIM= argum
[flang] Support FINDLOC/MAXLOC/MINLOC with scalar mask
Previously MASK= elements were accessed in assumption that mask is an array of input argument rank (and in combination with explicit DIM= argument we had out-of-bounds access), but for MAXLOC/MINLOC/FINDLOC mask should be be conformable and could be scalar.
Add new regression tests with scalar mask for verification.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D124408
show more ...
|
| #
92e22c97 |
| 28-Apr-2022 |
Mike Kashkarov <[email protected]> |
[flang] Fix UBOUND() constant folding for parentheses expr
Similarly to LBOUND((x)) in https://reviews.llvm.org/D123838 - fix UBOUND((x)) folding for constant arrays to return shape instead of recur
[flang] Fix UBOUND() constant folding for parentheses expr
Similarly to LBOUND((x)) in https://reviews.llvm.org/D123838 - fix UBOUND((x)) folding for constant arrays to return shape instead of recurse scan.
Depends on D123520
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D123944
show more ...
|
| #
d8b4ea48 |
| 27-Apr-2022 |
Mike Kashkarov <[email protected]> |
[flang] Fix UBOUND() folding for constant arrays
Similarly to LBOUND in https://reviews.llvm.org/D123237, fix UBOUND() folding for constant arrays (for both w/ and w/o DIM=): convert GetConstantArra
[flang] Fix UBOUND() folding for constant arrays
Similarly to LBOUND in https://reviews.llvm.org/D123237, fix UBOUND() folding for constant arrays (for both w/ and w/o DIM=): convert GetConstantArrayLboundHelper into common helper class for both lower/upper bounds.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D123520
show more ...
|
|
Revision tags: llvmorg-14.0.2 |
|
| #
39ee23ed |
| 20-Apr-2022 |
Mike Kashkarov <[email protected]> |
[flang] Set LBOUND() folding for (x) expression as ones
Set LBOUND() constant folding for parentheses expr. as ones
Array bounds should not propagate throught omitted bounds specifications or tempo
[flang] Set LBOUND() folding for (x) expression as ones
Set LBOUND() constant folding for parentheses expr. as ones
Array bounds should not propagate throught omitted bounds specifications or temporary variables - fix constant folding in case of Parentheses<T> expression by explicitly returning array of ones (or scalar in case of DIM=).
Add set of tests for (x) bounds checks (w/ and w/o 'parameter' arrays)
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D123838
show more ...
|
| #
bd5371e4 |
| 20-Apr-2022 |
Mike Kashkarov <[email protected]> |
[flang] Fix LBOUND() folding for constant arrays
Previously constant folding uses 'dim' without checks which leads to ICE if we do not have DIM= parameter. And for inputs without DIM= we need to for
[flang] Fix LBOUND() folding for constant arrays
Previously constant folding uses 'dim' without checks which leads to ICE if we do not have DIM= parameter. And for inputs without DIM= we need to form an array of rank size with computed bounds instead of single value.
Add additional PackageConstant function to simplify 'if (dim)' handling since we need to distinguish between scalar initialization in case of DIM= argument and rank=1 array.
Also add a few more tests with 'parameter' type to verify folding for constant arrays.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D123237
show more ...
|
|
Revision tags: llvmorg-14.0.1 |
|
| #
cd03e96f |
| 23-Mar-2022 |
Peter Klausler <[email protected]> |
[flang] Add & use a better visit() (take 2)
Adds flang/include/flang/Common/log2-visit.h, which defines a Fortran::common::visit() template function that is a drop-in replacement for std::visit().
[flang] Add & use a better visit() (take 2)
Adds flang/include/flang/Common/log2-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.
This change is enabled only for GCC builds with GCC >= 9; an earlier attempt (D122441) ran into bugs in some versions of clang and was reverted rather than simply disabled; and it is not well tested with MSVC. In non-GCC and older GCC builds, common::visit() is simply an alias for std::visit().
show more ...
|
| #
34cc706b |
| 31-Mar-2022 |
Peter Klausler <[email protected]> |
[flang] Fold IBITS() intrinsic function
Implement constant folding of IBITS(); add test.
Differential Revision: https://reviews.llvm.org/D123707
|
| #
ec13942e |
| 28-Mar-2022 |
Jean Perier <[email protected]> |
[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
[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
show more ...
|
| #
4ca111d4 |
| 28-Mar-2022 |
Andrzej Warzynski <[email protected]> |
Revert "[flang] Add & use a better visit()"
This reverts commit 2ab9990c9eb79682a4d4b183dfbc7612d3e55328. It has caused multiple build failures: * https://lab.llvm.org/buildbot/#/builders/177/build
Revert "[flang] Add & use a better visit()"
This reverts commit 2ab9990c9eb79682a4d4b183dfbc7612d3e55328. 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)
show more ...
|
| #
2ab9990c |
| 23-Mar-2022 |
Peter Klausler <[email protected]> |
[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
[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
show more ...
|
| #
ca46521a |
| 24-Mar-2022 |
Jean Perier <[email protected]> |
[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 Ge
[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
show more ...
|
|
Revision tags: llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3 |
|
| #
3b61587c |
| 09-Mar-2022 |
Peter Klausler <[email protected]> |
[flang] LBOUND() edge case: empty dimension
LBOUND must return 1 for an empty dimension, no matter what explicit expression might appear in a declaration or arrive in a descriptor.
Differential Rev
[flang] LBOUND() edge case: empty dimension
LBOUND must return 1 for an empty dimension, no matter what explicit expression might appear in a declaration or arrive in a descriptor.
Differential Revision: https://reviews.llvm.org/D121488
show more ...
|
| #
a53967cd |
| 07-Mar-2022 |
Peter Klausler <[email protected]> |
[flang] Distinguish usage and portability warning messages
Using recently established message severity codes, upgrade non-fatal messages to usage and portability warnings as appropriate.
Differenti
[flang] Distinguish usage and portability warning messages
Using recently established message severity codes, upgrade non-fatal messages to usage and portability warnings as appropriate.
Differential Revision: https://reviews.llvm.org/D121246
show more ...
|
|
Revision tags: llvmorg-14.0.0-rc2 |
|
| #
4133a85c |
| 18-Feb-2022 |
Peter Klausler <[email protected]> |
[flang] Accommodate arrays with a zero-extent dimension in location folding
The index incrementation code used for FINDLOC, MAXLOC, and MINLOC folding would crash if the array had a zero extent on t
[flang] Accommodate arrays with a zero-extent dimension in location folding
The index incrementation code used for FINDLOC, MAXLOC, and MINLOC folding would crash if the array had a zero extent on the dimension selected with a DIM= argument since the subscript passed to IncrementSubscripts would have a value less than the lower bound. Fix, and add tests.
Differential Revision: https://reviews.llvm.org/D121125
show more ...
|
| #
39157895 |
| 09-Feb-2022 |
Eric Schweitz <[email protected]> |
Folding in the front end was replacing calls to LEN and dropping arguments even in situations where the arguments are required to compute the LEN value at runtime.
Add tests.
Differential Revision:
Folding in the front end was replacing calls to LEN and dropping arguments even in situations where the arguments are required to compute the LEN value at runtime.
Add tests.
Differential Revision: https://reviews.llvm.org/D119373
show more ...
|
|
Revision tags: llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2 |
|
| #
5c5bde1b |
| 30-Dec-2021 |
Peter Klausler <[email protected]> |
[flang] Fold SCALE()
Fold references to the intrinsic function SCALE().
(Also work around some MSVC headaches somehow exposed by this patch: disable a bogus MSVC warning that began to appear in unr
[flang] Fold SCALE()
Fold references to the intrinsic function SCALE().
(Also work around some MSVC headaches somehow exposed by this patch: disable a bogus MSVC warning that began to appear in unrelated source files, and avoid the otherwise-necessary use of the "template" keyword in a call to a template member function of a class template.)
Differential Revision: https://reviews.llvm.org/D117150
show more ...
|
| #
d393ce3b |
| 05-Jan-2022 |
Peter Klausler <[email protected]> |
[flang] Support extension intrinsic function variations on ABS
Accept the legacy specific intrinsic names BABS, IIABS, JIABS, KIABS, and ZABS as well.
Differential Revision: https://reviews.llvm.or
[flang] Support extension intrinsic function variations on ABS
Accept the legacy specific intrinsic names BABS, IIABS, JIABS, KIABS, and ZABS as well.
Differential Revision: https://reviews.llvm.org/D117155
show more ...
|
| #
fb3faa8b |
| 10-Jan-2022 |
Jean Perier <[email protected]> |
[flang] Do not lose call in shape inquiry on function reference
Currently, something like `print *, size(foo(n,m))` was rewritten to `print *, size(foo_result_symbol)` when foo result is a non const
[flang] Do not lose call in shape inquiry on function reference
Currently, something like `print *, size(foo(n,m))` was rewritten to `print *, size(foo_result_symbol)` when foo result is a non constant shape array. This cannot be processed by lowering or reprocessed by a Fortran compiler since the syntax is wrong (`foo_result_symbol` is unknown on the caller side) and the arguments are lost when they might be required to compute the result shape.
It is not possible (and probably not desired) to make GetShape fail in general in such case since returning nullopt seems only expected for scalars or assumed rank (see GetRank usage in lib/Semantics/check-call.cpp), and returning a vector with nullopt extent may trigger some checks to believe they are facing an assumed size (like here in intrinsic argument checks: https://github.com/llvm/llvm-project/blob/196204c72c68a577c72af95d70f18e3550939a5e/flang/lib/Evaluate/intrinsics.cpp#L1530).
Hence, I went for a solution that limits the rewrite change to folding (where the original expression is returned if the shape depends on a non constant shape from a call).
I added a non default option to GetShapeHelper that prevents the rewrite of shape inquiry on calls to descriptor inquiries. At first I wanted to avoid touching GetShapeHelper, but it would require to re-implement all its logic to determine if the shape comes from a function call or not (the expression could be `size(1+foo(n,m))`). So added an alternate entry point to GetShapeHelper seemed the cleanest solution to me.
Differential Revision: https://reviews.llvm.org/D116933
show more ...
|
|
Revision tags: llvmorg-13.0.1-rc1 |
|
| #
f70343d9 |
| 27-Oct-2021 |
peter klausler <[email protected]> |
[flang] Fix combined folding of FINDLOC/MAXLOC/MINLOC
The tests for folding these intrinsics neglected to name the logical scalars with a leading "test_", so test failures caused by recent work to i
[flang] Fix combined folding of FINDLOC/MAXLOC/MINLOC
The tests for folding these intrinsics neglected to name the logical scalars with a leading "test_", so test failures caused by recent work to implement a combined constant folding facility for these intrinsics wasn't catching some bugs. This patch fixes the tests and the bugs.
Differential Revision: https://reviews.llvm.org/D112741
show more ...
|
| #
d5074c71 |
| 20-Oct-2021 |
peter klausler <[email protected]> |
[flang] Fix bogus folding error for ISHFT(x, negative)
Negative shift counts are of course valid for ISHFT when shifting to the right. This patch decouples the folding of ISHFT from that of SHIFTA/
[flang] Fix bogus folding error for ISHFT(x, negative)
Negative shift counts are of course valid for ISHFT when shifting to the right. This patch decouples the folding of ISHFT from that of SHIFTA/L/R and adds tests.
Differential Revision: https://reviews.llvm.org/D112244
show more ...
|
| #
0620b122 |
| 08-Oct-2021 |
Peter Steinfeld <[email protected]> |
[flang] Fix capitalization of "ishft"
We weren't recognizing the ISHFT intrinsic because the code had incorrectly capitalized it.
Differential Revision: https://reviews.llvm.org/D111449
|