aboutsummaryrefslogtreecommitdiff
path: root/flang
AgeCommit message (Collapse)AuthorFilesLines
2023-07-25Clear release notes for 18.xllvmorg-18-initTobias Hieta1-21/+1
2023-07-24[flang] Add PowerPC vec_abs, vec_nmadd, vec_msub and vec_sel intrinsicsKelvin Li6-1/+1047
Co-authored-by: Paul Scoropan <1paulscoropan@gmail.com> Differential Revision: https://reviews.llvm.org/D154985
2023-07-24[flang][hlfir] Fixed KindMapping for HLFIR intrinsics lowering.Slava Zakharin10-50/+95
hlfir.count lowering was using incorrect default integer kind by ignoring the kind specified in the ModuleOp. Reviewed By: tblah Differential Revision: https://reviews.llvm.org/D156017
2023-07-24[flang][hlfir] Inherit constant length for the result of hlfir.transpose.Slava Zakharin2-0/+49
Character length may be unknown for the type of Fortran::evaluate::FunctionRef expression, but we can try to propagate it from the argument of TRANSPOSE if it is known constant. Alternatively, we could relax hlfir.transpose verification (i.e. allow character types mismatch for the argument and the result). Depends on D155912 Reviewed By: tblah Differential Revision: https://reviews.llvm.org/D155913
2023-07-24[flang][openacc] Keep original array size in reduction init region with sliceValentin Clement2-32/+4
Keep the original array size when materializing the private copy. Depends on D155882 Reviewed By: razvanlupusoru Differential Revision: https://reviews.llvm.org/D155893
2023-07-24[flang][openacc] Update materialization recipe for private copy in reduction ↵Valentin Clement8-234/+381
init region Update the code generated in the init region to materialize the private copy. Reviewed By: razvanlupusoru Differential Revision: https://reviews.llvm.org/D155882
2023-07-22[test] Fix compiler_version.f90 for -DLLVM_APPEND_VC_REV=OFF builds after ↵Fangrui Song1-1/+1
D152572 Checking the patch version is too strict. Just check major and minor versions as in clang/test/Driver/immediate-options.c.
2023-07-22[Frontend] Sort featuresVec for AMDGPU target featuresFangrui Song2-5/+5
D145579 leverages the iteration order of StringSet, which is not guaranteed to be deterministic.
2023-07-21[flang][openacc] Fix hasDynamicShape logicValentin Clement1-3/+12
Reviewed By: razvanlupusoru Differential Revision: https://reviews.llvm.org/D155897
2023-07-21[flang] Fix portability warning that was incorrectly an "else if"Peter Klausler2-3/+7
A semantics check for an assumed-length dummy procedure pointer was inappropriately part of an "else" clause for a preceding check, causing it to not be applied in all situations. Differential Revision: https://reviews.llvm.org/D155975
2023-07-21[flang] Emit just one warning for a bad format edit descriptorPeter Klausler2-23/+21
An attempt to use an edit descriptor (other than A or L) in a FORMAT statement without arequired 'w' width will elicit warnings from both the parser and the I/O checker in semantics. Remove the warning from the parser. Differential Revision: https://reviews.llvm.org/D155977
2023-07-21[flang][runtime] Fix NORM2([negative, ...])Peter Klausler1-1/+1
NORM2 is broken for arrays that start with a negative number because it sets the initial running max_ value to that number rather than to its absolute value. Differential Revision: https://reviews.llvm.org/D155976
2023-07-21[flang] Strengthen procedure compatibility checkingPeter Klausler3-1/+52
Add more checks to procedure compatibility testing for procedure pointer assignments, actual procedure arguments, &c. Specifically, don't allow corresponding dummy data objects to differ in their use of polymorphism, assumed size arrays, or assumed shape arrays. Differential Revision: https://reviews.llvm.org/D155974
2023-07-21[flang] Portability warning and documentation for an obscure extensionPeter Klausler3-0/+20
A quotation mark can appear in a Fortran character literal by doubling it; for example, PRINT *, "'""'" prints '"'. When those doubled quotation marks are split by a free form line continuation, the continuation line should have an ampersand before the second quotation mark. But most compilers, including this one, allow the second quotation mark to appear as the first character on the continuation line, too. So this works: print *, "'"& "'" but it really should be written as: print *, "'"& &"'" Emit a portability warning and document that we support this near-universal extension. Differential Revision: https://reviews.llvm.org/D155973
2023-07-21[flang] Rename new test filePeter Klausler1-0/+0
A recent patch added a new test file whose name conflicts with an existing test on case-insensitive filesystems. Rename it.
2023-07-21[flang] Ensure that NULL(without MOLD=) not passed to dummy argument with ↵Peter Klausler2-2/+36
assumed type parameters A dummy argument with an assumed (*) character length or derived type parameter value specification needs to be associated with an actual argument that can supply a value for it, so make sure that a NULL without a MOLD= is not being passed. Differential Revision: https://reviews.llvm.org/D155971
2023-07-21[flang] Disallow ASYNCHRONOUS for subroutinePeter Klausler2-5/+8
The check for inappropriate usage of the ASYNCHRONOUS attribute needed to be moved in declaration checking so that it can catch attempts to use it on a subroutine. Differential Revision: https://reviews.llvm.org/D155970
2023-07-21[flang] Enforce F'2023 C7125Peter Klausler2-1/+10
An item whose declared type is ABSTRACT may not appear in an array constructor. Differential Revision: https://reviews.llvm.org/D155969
2023-07-21[flang] Catch case of character array constructor with indeterminable lengthPeter Klausler2-7/+42
F'2023 7.8 para 5 requires that an implied DO loop with no iterations in a character array constructor should have items whose lengths are constant expressions independent of the value of the implied DO loop index. Differential Revision: https://reviews.llvm.org/D155968
2023-07-21[flang][runtime] Detect NEWUNIT= without FILE= or STATUS='SCRATCH'Peter Klausler5-7/+18
It is an error to open a new unit with OPEN(NEWUNIT=) and have neither a file name nor a scratch status. Catch it, and report a new error code. Differential Revision: https://reviews.llvm.org/D155967
2023-07-21[flang] Preserve errors from generic matchingPeter Klausler2-10/+42
When searching for a matching specific procedure for a set of actual arguments in a type-bound generic interface for a defined operator, don't discard any error messages that may have been produced for the specific that was found. Tweak the code to preserve those messages and add them to the context's messages, and add a test. Differential Revision: https://reviews.llvm.org/D155966
2023-07-21[flang][hlfir] Added missing fir.convert for i1 result of hlfir.dot_product.Slava Zakharin2-7/+36
Some operations using the result of hlfir.dot_product can tolerate that the type of the result changes from !fir.logical to i1 during intrinsics lowering, but some won't. I added a separate LIT case with fir.store to mimic one of the nag tests. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D155914
2023-07-21[flang][hlfir] Preserve polymorphism for the result of hlfir.transpose.Slava Zakharin2-3/+21
Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D155912
2023-07-21[NFC][flang] Distinguish MATMUL and MATMUL-TRANSPOSE printouts.Slava Zakharin1-6/+11
When MatmulTranpose reports incorrect shapes of the arguments it cannot represent itself as MATMUL, because the reading of the first argument's shape will be confusing. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D155911
2023-07-21[flang] Stricter checking of DIM= arguments to LBOUND/UBOUND/SIZEPeter Klausler3-48/+75
DIM= arguments with constant values can be checked for validity even when other arguments to an intrinsic function can't be folded. Handle errors with assumed-rank arguments as well. Differential Revision: https://reviews.llvm.org/D155964
2023-07-21[flang] Finalize &/or destroy ABSTRACT typesPeter Klausler2-6/+29
The runtime type information tables always flag ABSTRACT types as needing neither destruction in general nor finalization in particular. This is incorrect. Although an ABSTRACT type may not itself have a FINAL procedure -- its argument cannot be polymorphic, but ABSTRACT types in declarations must always be so -- it can still have finalizable components &/or components requiring deallocation. Differential Revision: https://reviews.llvm.org/D155965
2023-07-21[flang] Support implicit global external as procedure pointer targetPeter Klausler2-1/+15
A name that has been used to reference an undeclared global external procedure should be accepted as the target of a procedure pointer assignment statement. Fixes llvm-test-suite/Fortran/gfortran/regression/proc_ptr_45.f90. Differential Revision: https://reviews.llvm.org/D155963
2023-07-21[flang] Compare component types In AreSameComponent()Peter Klausler2-8/+118
The subroutine AreSameComponent() of the predicate AreSameDerivedType() had a TODO about checking component types that needed completion in order to properly detect that two specific procedures of a generic are distinguishable in the llvm-test-suite/Fortran/gfortran/regression test import7.f90. Differential Revision: https://reviews.llvm.org/D155962
2023-07-21[flang] Accept an assumed-rank array as operand of ASSOCIATED()Peter Klausler2-5/+28
The ASSOCIATED() intrinsic was mistakenly defined in the intrinsic function table as requiring operands of known rank, which unintentionally prevented assumed-rank dummy arguments from being tested. Fixes llvm-test-suite/Fortran/gfortran/regression/pr88932.f90. Differential Revision: https://reviews.llvm.org/D155498
2023-07-21[flang][nfc] Clarify the usage of llvmArgs and mlirArgsAndrzej Warzynski1-1/+6
Differential Revision: https://reviews.llvm.org/D155931
2023-07-20[flang][hlfir] Avoid expr buffer reuse when end_associate may cycle.Slava Zakharin2-1/+72
If end_associate may execute more times than the expr value producer, then it cannot take ownership of the expr buffer. Otherwise, it may result in double-free errors. Note that the LIT test exposes a different issue with fir.alloca inside the do-loop produced for hlfir.elemental. This may cause out-of-stack conditions in valid Fortran programs that are not expected to run out of stack. I will create an issue for this. Reviewed By: tblah Differential Revision: https://reviews.llvm.org/D155778
2023-07-20[Flang][OpenMP] Fix unit test using AMDGPU triple without requiring itSergio Afonso1-0/+2
2023-07-20[MLIR][OpenMP][OMPIRBuilder] Use target triple to initialize `IsGPU` flagSergio Afonso8-21/+73
This patch modifies the construction of the `OpenMPIRBuilder` in MLIR to initialize the `IsGPU` flag using target triple information passed down from the Flang frontend. If not present, it will default to `false`. This replicates the behavior currently implemented in Clang, where the `CodeGenModule::createOpenMPRuntime()` method creates a different `CGOpenMPRuntime` instance depending on the target triple, which in turn has an effect on the `IsGPU` flag of the `OpenMPIRBuilderConfig` object. Differential Revision: https://reviews.llvm.org/D151903
2023-07-19[flang] Add PowerPC vec_convert, vec_ctf and vec_cvf intrinsicKelvin Li6-5/+2896
Co-authored-by: Paul Scoropan <1paulscoropan@gmail.com> Differential Revision: https://reviews.llvm.org/D155235
2023-07-19[flang][hlfir] Removed incorrect clean-up in the implied-do lowering.Slava Zakharin3-1/+50
The lowering of calls/expressions unconditionally inserts DestroyOp clean-up for hlfir.expr values, which is wrong in the case where the value is used as a result of the elemental operation created during the implied-do lowering. A cleaner fix could be to avoid DestroyOp insertion at all, but I have not figure out an easy way to do it. The DestroyOp look-up I used seems to be quite reliable, so it should just work. Reviewed By: clementval Differential Revision: https://reviews.llvm.org/D155665
2023-07-19[flang][hlfir] Fixed finalization in hlfir.assign codegen.Slava Zakharin4-3/+53
When hlfir.assign is lowered into simple load/store, we may still need to finalize the LHS. The patch passes `needFinalization` to `genScalarAssignment` for LHS of any derived type, so some `Destroy` calls might be redundant. They can be removed later by propagating/deducing IsFinalizable information about the LHS type. Reviewed By: clementval Differential Revision: https://reviews.llvm.org/D155664
2023-07-19[flang] Fix complex libm use logic problemsRazvan Lupusoru6-25/+36
Fix the various complex libm selection logic issues from D155310: - disableMlirComplex is set to false. This means that using mlir complex is enabled. Yet, the current code still selects libm. - If we enable mlir complex, we should not check if use approx is enabled. Namely, we should use mlir complex either if we enable mlir complex OR use approx is enabled. To fix the issues, we flip the logic of `disableMlirComplex` to enable instead. We set it to false by default since the intention from D155310 is to use libm by default. Then we use a logical `&&` with use approx so that we select libm when BOTH mlir complex and use approx are disabled. Reviewed By: vzakhari Differential Revision: https://reviews.llvm.org/D155737
2023-07-19[flang] Represent unknown extent correctly in getTypeAsStringValentin Clement2-2/+11
Reviewed By: razvanlupusoru Differential Revision: https://reviews.llvm.org/D155655
2023-07-19[mlir][flang] Convert TBAA metadata to an attribute representationMarkus Böck4-224/+134
The current representation of TBAA is the very last in-tree user of the `llvm.metadata` operation. Using ops to model metadata has a few disadvantages: * Building a graph has to be done through some weakly typed indirection mechanism such as `SymbolRefAttr` * Creating the metadata has to be done through a builder within a metadata op. * It is not multithreading safe as operation insertion into the same block is not thread-safe This patch therefore converts TBAA metadata into an attribute representation, in a similar manner as it has been done for alias groups and access groups in previous patches. This additionally has the large benefit of giving us more "correctness by construction" as it makes things like cycles in a TBAA graph, or references to an incorrectly typed metadata node impossible. Differential Revision: https://reviews.llvm.org/D155444
2023-07-19[flang] Implement tand intrinsicDavid Truby4-0/+45
This implements the tand intrinsic by performing a multiplication by pi/180 to the argument before calling tan inline. This is a commonly provided extension that is used by OpenRadioss Differential Revision: https://reviews.llvm.org/D154614
2023-07-19[flang] Use libm functions for complex operations by defaultDavid Truby9-30/+34
This patch changes the default lowering for complex operations to use the more accurate libm operations as opposed to the mlir complex operations. This is necessary due to precision issues in the mlir complex dialect that cause failures in e.g. the LAPACK tests. The mlir complex dialect lowering will still be used when `-fapprox-func` is set (and by extension `-ffast-math` and `-Ofast`) Differential Revision: https://reviews.llvm.org/D155310
2023-07-19[flang] Simplify macros for the vec_sld and vec_sldw intrinsicsKelvin Li1-63/+38
The ignore_tkr directive is applied to the third argument so that the number of interfaces can be reduced. Differential Revision: https://reviews.llvm.org/D155624
2023-07-18[flang][openacc] Support static slice in reduction loweringValentin Clement3-25/+66
Lower static array slices reduction with the correct type. Reviewed By: razvanlupusoru Differential Revision: https://reviews.llvm.org/D155519
2023-07-18[Flang][OpenMP] Disable function filtering for hostAndrew Gozillon3-4/+50
This should be a temporary fix while we work towards enabling function filtering for host again via a future patch.
2023-07-18[flang][openacc] Update data clause attribute in testsRazvan Lupusoru11-192/+192
Update Fortran OpenACC tests to use the updated data clause attribute format for better readability. Depends on D155605 Reviewed By: clementval Differential Revision: https://reviews.llvm.org/D155603
2023-07-18[flang][unittests] Fix recent snprintf() changes to use correct buffer lengthsPeter Klausler2-2/+4
A recent patch replaced two sprintf() calls with snprintf(), but didn't use the right length for the remaining space in the buffer. Differential Revision: https://reviews.llvm.org/D155224
2023-07-18[flang][hlfir] Support polymorphic hlfir.expr values.Slava Zakharin7-28/+254
This patch sets 'polymorphic' attribute of hlfir::ExprType when the value is created from a polymorphic entity. Memoization of such ExprType involves creating a mutable descriptor on the stack, which is initialized (as a null box) and passed to AllocatableApplyMold with the mold being the entity from which the ExprType value is being created. This patch fixes "creating polymorphic temporary" TODO and also several cases of "'fir.convert' op invalid type conversion" error. Reviewed By: tblah Differential Revision: https://reviews.llvm.org/D155541
2023-07-18[Flang] Remove unused variable 'converter' in genCustomIntrinsicRefCoreJie Fu1-2/+1
/data/workspace/llvm-project/flang/lib/Lower/ConvertCall.cpp:1281:9: error: unused variable 'converter' [-Werror,-Wunused-variable] auto &converter = callContext.converter; ^ 1 error generated.
2023-07-18[Flang] Include logical default with default-integer-8Kiran Chandramohan6-10/+15
Other compilers include the logical default also with the default-integer-8 setting. This patch does the same for flang. Reviewed By: awarzynski, sscalpone Differential Revision: https://reviews.llvm.org/D155279
2023-07-18[flang][hlfir][NFC] catch dynamically optional args with no loweringTom Eccles1-0/+2
These should be lowered with genOptionalValue as in D154897, but I haven't found any cases where this code path is actually hit (flang tests, gfortran test suite), so I don't think it would be testable. Adding an assertion for if this code path ever becomes live. Differential Revision: https://reviews.llvm.org/D155477