| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[flang]Fix tests broken on non-Aarch64 builds (#68306) No other change intended. | 2 年前 | |
[flang][cuda] Add support for cluster_block_index in cooperative groups (#169427) | 8 个月前 | |
[flang] simplify pointer assignments (#168732) Pointer assignment lowering was done in different ways depending on contexts and types, sometimes still using runtime calls when this is not needed and the complexity of doing this inline is very limited (the pointer and target descriptors were already prepared inline, the runtime is just doing the descriptor assignment and ensuring the pointer descriptor keep its pointer flag). Slightly extent the inline version that was used for Forall and use it for all cases. When lowering without HLFIR is removed, this will allow removing more code. | 8 个月前 | |
[Flang] Add -ffast-real-mod back for further control of MOD optimizations (#167118) It turns out that having -ffast-math as the only option to control optimizations for MOD for REAL kinds (PR #160660) is too coarse-grained for some applications. Thus, this PR adds back -ffast-real-mod to have more control over the optimization. The -ffast-math flag will still enable the optimization, and -fno-fast-real-mod allows one to disable it. | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (3 of N) Only the fortran source files in flang/test have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (5 of N) Only the fortran source files in flang/test/Lower/OpenACC have been modified. The other files in flang/test will be cleaned up in subsequent commits | 8 个月前 | |
[OpenMP][flang] Lowering of OpenMP custom reductions to MLIR (#168417) This patch add support for lowering of custom reductions to MLIR. It also enhances the capability of the pass to automatically mark functions as "declare target" by traversing custom reduction initializers and combiners. | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][RISCV] Add target-abi ModuleFlag. (#126188) This is needed to generate proper ABI flags in the ELF header for LTO builds. If these flags aren't set correctly, we can't link with objects that were built with the correct flags. For non-LTO builds the mcpu/mattr in the TargetMachine will cause the backend to infer an ABI. For LTO builds the mcpu/mattr aren't set. I've only added lp64, lp64f, and lp64d ABIs. ilp32* requires riscv32 which is not yet supported in flang. lp64e requires a different DataLayout string and would need additional plumbing. Fixes #115679 | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[Flang] Generate math.sinh op for single and double precision sinh (#162734) Fixes issue with double precision sinh when using OpenMP offloading with AMD GPUs. The machinery to convert the op to a ROCDL call is already in place. https://github.com/llvm/llvm-project/issues/162733 | 9 个月前 | |
[flang][NFC] Move lowering test to correct folder | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Enable polymorphic lowering by default (#83285) Polymorphic entity lowering status is good. The main remaining TODO is to allow lowering of vector subscripted polymorphic entity, but this does not deserve blocking all application using polymorphism. Remove experimental option and enable lowering of polymorphic entity by default. | 2 年前 | |
| 1 年前 | ||
[flang][NFC] Characterize allocation based on MemAlloc effect instead of pattern matching (#166806) Flang alias analysis used to find allocation site by pattern matching allocation ops in mainly FIR dialect. This MR extends the characterization to instead characterize based on whether the result of an op has MemAlloc effect. | 8 个月前 | |
| 1 年前 | ||
[flang] Correctly prepare allocatable runtime call arguments (#138727) When lowering allocatables, the generated calls to runtime functions were not using the runtime::createArguments utility which handles the required conversions. createArguments is where I added the implicit volatile casts to handle converting volatile variables to the appropriate type based on their volatility in the callee. Because the calls to allocatable runtime functions were not using this function, their arguments were not casted to have the appropriate volatility. Add a test to demonstrate that volatile and allocatable class/box/reference types are appropriately casted before calling into the runtime library. Instead of using a recursive variadic template to perform the conversions in createArguments, map over the arguments directly so that createArguments can be called with an ArrayRef of arguments. Some cases in Allocatable.cpp already had a vector of values at the point where createArguments needed to be called - the new overload allows calling with a vector of args or the variadic version with each argument spelled out at the callsite. This change resulted in the allocatable runtime calls having their arguments converted left-to-right, which changed some of the test results. I used CHECK-DAG to ignore the order. Add some missing handling of volatile class entities, which I previously missed because I had not yet enabled volatile class entities in Lower. | 1 年前 | |
[flang] Correctly prepare allocatable runtime call arguments (#138727) When lowering allocatables, the generated calls to runtime functions were not using the runtime::createArguments utility which handles the required conversions. createArguments is where I added the implicit volatile casts to handle converting volatile variables to the appropriate type based on their volatility in the callee. Because the calls to allocatable runtime functions were not using this function, their arguments were not casted to have the appropriate volatility. Add a test to demonstrate that volatile and allocatable class/box/reference types are appropriately casted before calling into the runtime library. Instead of using a recursive variadic template to perform the conversions in createArguments, map over the arguments directly so that createArguments can be called with an ArrayRef of arguments. Some cases in Allocatable.cpp already had a vector of values at the point where createArguments needed to be called - the new overload allows calling with a vector of args or the variadic version with each argument spelled out at the callsite. This change resulted in the allocatable runtime calls having their arguments converted left-to-right, which changed some of the test results. I used CHECK-DAG to ignore the order. Add some missing handling of volatile class entities, which I previously missed because I had not yet enabled volatile class entities in Lower. | 1 年前 | |
[flang] Correctly prepare allocatable runtime call arguments (#138727) When lowering allocatables, the generated calls to runtime functions were not using the runtime::createArguments utility which handles the required conversions. createArguments is where I added the implicit volatile casts to handle converting volatile variables to the appropriate type based on their volatility in the callee. Because the calls to allocatable runtime functions were not using this function, their arguments were not casted to have the appropriate volatility. Add a test to demonstrate that volatile and allocatable class/box/reference types are appropriately casted before calling into the runtime library. Instead of using a recursive variadic template to perform the conversions in createArguments, map over the arguments directly so that createArguments can be called with an ArrayRef of arguments. Some cases in Allocatable.cpp already had a vector of values at the point where createArguments needed to be called - the new overload allows calling with a vector of args or the variadic version with each argument spelled out at the callsite. This change resulted in the allocatable runtime calls having their arguments converted left-to-right, which changed some of the test results. I used CHECK-DAG to ignore the order. Add some missing handling of volatile class entities, which I previously missed because I had not yet enabled volatile class entities in Lower. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Fix lowering tests indent Remove 2 spaces indent that was introduced by mistake when upstreaming these files. | 4 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[MLIR] Add new complex.powi op (#158722) This PR adds a new complex.powi operation to MLIR's complex dialect for computing complex numbers raised to integer powers. Key changes include: - Addition of the new PowiOp operation definition in the Complex dialect - Integration with algebraic simplification passes for optimization - Support for conversion to ROCDL library calls - Updates to Flang frontend to generate the new operation This depends on #158642. | 10 个月前 | |
[flang] Handle allocatable dummy arguments This patch handles allocatable dummy argument lowering in function and subroutines. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: schweitz Differential Revision: https://reviews.llvm.org/D120483 Co-authored-by: Jean Perier <jperier@nvidia.com> | 4 年前 | |
[mlir][flang] add fast math attribute to fcmp (#74315) llvm.fcmp does support fast math attributes therefore so should arith.cmpf. The heavy churn in flang tests are because flang sets fastmath<contract> by default on all operations that support the fast math interface. Downstream users of MLIR should not be so effected. This was requested in https://github.com/llvm/llvm-project/issues/74263 | 2 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang] replace fir.complex usages with mlir complex (#110850) Core patch of https://discourse.llvm.org/t/rfc-flang-replace-usages-of-fir-complex-by-mlir-complex-type/82292. After that, the last step is to remove fir.complex from FIR types. | 1 年前 | |
[flang][nfc] Initial changes needed to use llvm intrinsics instead of regular calls (#134170) Flang uses fir.call <llvm intrinsic> in a few places. This means consumers of the IR need to strcmp every fir.call if they want to find a particular LLVM intrinsic. Emit LLVM memcpy intrinsics instead. | 1 年前 | |
| 10 个月前 | ||
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang] Add lowering tests Add lowering tests left behind during the upstreaming. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D128721 Co-authored-by: Jean Perier <jperier@nvidia.com> Co-authored-by: Eric Schweitz <eschweitz@nvidia.com> | 4 年前 | |
| 1 年前 | ||
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] replace fir.complex usages with mlir complex (#110850) Core patch of https://discourse.llvm.org/t/rfc-flang-replace-usages-of-fir-complex-by-mlir-complex-type/82292. After that, the last step is to remove fir.complex from FIR types. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Main program symbol no longer conflicts with the other symbols (#149169) The following code is now accepted: module m end program m use m end The PROGRAM name doesn't really have an effect on the compilation result, so it shouldn't result in symbol name conflicts. This change makes the main program symbol name all uppercase in the cooked character stream. This makes it distinct from all other symbol names that are all lowercase in cooked character stream. Modified the tests that were checking for lower case main program name. | 1 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
Reland "[flang] Set LLVM specific attributes to fir.call's of Fortran runtime. (#128093)" This change is inspired by a case in facerec benchmark, where performance of scalar code may improve by about 6%@aarch64 due to getting rid of redundant loads from Fortran descriptors. These descriptors are corresponding to subroutine local ALLOCATABLE, SAVE variables. The scalar loop nest in LocalMove subroutine contains call to Fortran runtime IO functions, and LLVM globals-aa analysis cannot prove that these calls do not modify the globalized descriptors with internal linkage. This patch sets and propagates llvm.memory_effects attribute for fir.call operations calling Fortran runtime functions. In particular, it tries to set the Other memory effect to NoModRef. The Other memory effect includes accesses to globals and captured pointers, so we cannot set it for functions taking Fortran descriptors with one exception for calls where the Fortran descriptor arguments are all null. As long as different calls to the same Fortran runtime function may have different attributes, I decided to attach the attributes to the calls rather than functions. Moreover, attaching the attributes to func.func will require propagating these attributes to llvm.func, which is not happening right now. In addition to llvm.memory_effects, the new pass sets llvm.nosync and llvm.nocallback attributes that may also help LLVM alias analysis (e.g. see #127707). These attributes are ignored currently. I will support them in LLVM IR dialect in a separate patch. I also added another pass for developers to be able to print declarations/calls of all Fortran runtime functions that are recognized by the attributes setting pass. It should help with maintenance of the LIT tests. | 1 年前 | |
[flang] translate pure and elemental attribute in FIR (#109954) Follow-up from a previous patch that turned bind_c into an enum for procedure attribute. This patch carries the elemental and pure Fortran attribute into FIR so that the optimizer can leverage that info in the future (I think debug info may also need to know these aspects since DWARF has DW_AT_elemental and DW_AT_pure nodes). SIMPLE from F2023 will be translated once it is handled in the front-end. NON_RECURSIVE is only meaningful on func.func since we are not guaranteed to know that aspect on the caller side (it is not part of Fortran characteristics). There is a DW_AT_recursive DWARF node. I will do it while dealing with func.func attributes. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
| 1 年前 | ||
[flang] Nonconformant assigned gotos Modify code generation for assigned gotos to generate a runtime error for most cases that violate F90 Clause 8.2.4, rather than treating a nonconformant GOTO as a nop. For example, generate a runtime error for a GOTO that attempts to branch to a label for a FORMAT statement. Relax the requirement that an assigned GOTO with a label list must branch to a label in the list, and instead allow a branch to any valid assigned GOTO target in scope. | 3 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Enable polymorphic lowering by default (#83285) Polymorphic entity lowering status is good. The main remaining TODO is to allow lowering of vector subscripted polymorphic entity, but this does not deserve blocking all application using polymorphism. Remove experimental option and enable lowering of polymorphic entity by default. | 2 年前 | |
[flang] Add FIR attributes and apply them to dummy arguments (#115686) To determine if a function's dummy argument is nocapture, add the asynchronous attribute to the FIR attribute. The volatile attribute will also be used to determine nocapture assignment, but this will remain a TODO until other processing using volatile is implemented. I will post another patch to apply nocapture. See also the discussion in the following discourse post. https://discourse.llvm.org/t/applying-the-nocapture-attribute-to-reference-passed-arguments-in-fortran-subroutines/81401 | 1 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] do not hard code KIND 10 and 16 in lowering tests (#124966) KIND 10 and 16 are platform dependent and it will soon be a hard error to use them when not available (PR124655) Update some tests that used them to use SELECTED_REAL_KIND + lit conditional checks to make the tests usable on all platform. Also update all those tests to use HFLIR lowering while modifying them since the goal is to remove the legacy lowering at some point. | 1 年前 | |
[flang] Main program symbol no longer conflicts with the other symbols (#149169) The following code is now accepted: module m end program m use m end The PROGRAM name doesn't really have an effect on the compilation result, so it shouldn't result in symbol name conflicts. This change makes the main program symbol name all uppercase in the cooked character stream. This makes it distinct from all other symbol names that are all lowercase in cooked character stream. Modified the tests that were checking for lower case main program name. | 1 年前 | |
[flang] Add lowering for basic empty SUBROUTINE This patch adds the ability to lower an empty subroutine. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D118695 | 4 年前 | |
[flang] Updating drivers to create data layout before semantics (#73301) Preliminary patch to change lowering/code generation to use llvm::DataLayout information instead of generating "sizeof" GEP (see https://github.com/llvm/llvm-project/issues/71507). Fortran Semantic analysis needs to know about the target type size and alignment to deal with common blocks, and intrinsics like C_SIZEOF/TRANSFER. This information should be obtained from the llvm::DataLayout so that it is consistent during the whole compilation flow. This change is changing flang-new and bbc drivers to: 1. Create the llvm::TargetMachine so that the data layout of the target can be obtained before semantics. 2. Sharing bbc/flang-new set-up of the SemanticConstext.targetCharateristics from the llvm::TargetMachine. For now, the actual part that set-up the Fortran type size and alignment from the llvm::DataLayout is left TODO so that this change is mostly an NFC impacting the drivers. 3. Let the lowering bridge set-up the mlir::Module datalayout attributes since it is doing it for the target attribute, and that allows the llvm data layout information to be available during lowering. For flang-new, the changes are code shuffling: the llvm::TargetMachine instance is moved to CompilerInvocation class so that it can be used to set-up the semantic contexts. setMLIRDataLayout is moved to flang/Optimizer/Support/DataLayout.h (it will need to be used from codegen pass for fir-opt target independent testing.)), and the code setting-up semantics targetCharacteristics is moved to Tools/TargetSetup.h so that it can be shared with bbc. As a consequence, LLVM targets must be registered when running semantics, and it is not possible to run semantics for a target that is not registered with the -triple option (hence the power pc specific modules can only be built if the PowerPC target is available. | 2 年前 | |
[flang] Updating drivers to create data layout before semantics (#73301) Preliminary patch to change lowering/code generation to use llvm::DataLayout information instead of generating "sizeof" GEP (see https://github.com/llvm/llvm-project/issues/71507). Fortran Semantic analysis needs to know about the target type size and alignment to deal with common blocks, and intrinsics like C_SIZEOF/TRANSFER. This information should be obtained from the llvm::DataLayout so that it is consistent during the whole compilation flow. This change is changing flang-new and bbc drivers to: 1. Create the llvm::TargetMachine so that the data layout of the target can be obtained before semantics. 2. Sharing bbc/flang-new set-up of the SemanticConstext.targetCharateristics from the llvm::TargetMachine. For now, the actual part that set-up the Fortran type size and alignment from the llvm::DataLayout is left TODO so that this change is mostly an NFC impacting the drivers. 3. Let the lowering bridge set-up the mlir::Module datalayout attributes since it is doing it for the target attribute, and that allows the llvm data layout information to be available during lowering. For flang-new, the changes are code shuffling: the llvm::TargetMachine instance is moved to CompilerInvocation class so that it can be used to set-up the semantic contexts. setMLIRDataLayout is moved to flang/Optimizer/Support/DataLayout.h (it will need to be used from codegen pass for fir-opt target independent testing.)), and the code setting-up semantics targetCharacteristics is moved to Tools/TargetSetup.h so that it can be shared with bbc. As a consequence, LLVM targets must be registered when running semantics, and it is not possible to run semantics for a target that is not registered with the -triple option (hence the power pc specific modules can only be built if the PowerPC target is available. | 2 年前 | |
[flang] Add lowering tests Add lowering tests left behind during the upstreaming. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D128721 Co-authored-by: Jean Perier <jperier@nvidia.com> Co-authored-by: Eric Schweitz <eschweitz@nvidia.com> | 4 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] add fir.proc_attrs attributes to func.func (#110002) BIND(C) ABI need care in the TargetRewrite pass. currently, we are not able to accurately identify fun.func that are BIND(C) in FIR (the fir.bindc_name is used in other contexts, like for program names). This patch adds the fir.proc_attrs to func.func just like it was done for calls recently. This replace the previous named attribute for PURE/ELEMENTAL/RECURSIVE (note that RECURSIVE is changed to NON_RECURSIVE, which brings more data since RECURSIVE is the default for procedures that do not have explicit RECURSIVE/NON_RECUSRIVE attributes). | 1 年前 | |
[flang][NFC] use llvm.intr.stacksave/restore instead of opaque calls (#108562) The new LLVM stack save/restore intrinsic operations are more convenient than function calls because they do not add function declarations to the module and therefore do not block the parallelisation of passes. Furthermore they could be much more easily marked with memory effects than function calls if that ever proved useful. This builds on top of #107879. Resolves #108016 | 1 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang][Lower] Emit exiting branches from within constructs (#92455) When lowering IfConstruct, CaseConstruct, and SelectTypeConstruct, emit branches that exit the construct in each block that is still unterminated after the FIR has been generated in it. The same thing may be needed for SelectRankConstruct, once it's supported. This eliminates the need for inserting branches in genFIR(Evaluation). Follow-up to PR https://github.com/llvm/llvm-project/pull/91614. | 2 年前 | |
[flang] Handle BINC(C) variables and add TODO for corner cases - BIND(C) was ignored in lowering for objects (it can be used on module and common blocks): use the bind name as the fir.global name. - When an procedure is declared BIND(C) indirectly via an interface, it should have a BIND(C) name. This was not the case because GetBindName()/bindingName() return nothing in this case: detect this case in mangler.cpp and use the symbol name. Add TODOs for corner cases: - BIND(C) module variables may be initialized on the C side. This does not fit well with the current linkage strategy. Add a TODO until this is revisited. - BIND(C) internal procedures should not have a binding label (see Fortran 2018 section 18.10.2 point 2), yet we currently lower them as if they were BIND(C) external procedure. I think this and the indirect interface case should really be handled by symbol.GetBindName instead of adding more logic in lowering to deal with this case: add a TODO. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D128340 Co-authored-by: Jean Perier <jperier@nvidia.com> | 4 年前 | |
[flang] update fir.coordinate_of to carry the fields (#127231) This patch updates fir.coordinate_op to carry the field index as attributes instead of relying on getting it from the fir.field_index operations defining its operands. The rational is that FIR currently has a few operations that require DAGs to be preserved in order to be able to do code generation. This is the case of fir.coordinate_op, which requires its fir.field operand producer to be visible. This makes IR transformation harder/brittle, so I want to update FIR to get rid if this. Codegen/printer/parser of fir.coordinate_of and many tests need to be updated after this change. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] update fir.coordinate_of to carry the fields (#127231) This patch updates fir.coordinate_op to carry the field index as attributes instead of relying on getting it from the fir.field_index operations defining its operands. The rational is that FIR currently has a few operations that require DAGs to be preserved in order to be able to do code generation. This is the case of fir.coordinate_op, which requires its fir.field operand producer to be visible. This makes IR transformation harder/brittle, so I want to update FIR to get rid if this. Codegen/printer/parser of fir.coordinate_of and many tests need to be updated after this change. | 1 年前 | |
[flang] replace fir.complex usages with mlir complex (#110850) Core patch of https://discourse.llvm.org/t/rfc-flang-replace-usages-of-fir-complex-by-mlir-complex-type/82292. After that, the last step is to remove fir.complex from FIR types. | 1 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang] update fir.coordinate_of to carry the fields (#127231) This patch updates fir.coordinate_op to carry the field index as attributes instead of relying on getting it from the fir.field_index operations defining its operands. The rational is that FIR currently has a few operations that require DAGs to be preserved in order to be able to do code generation. This is the case of fir.coordinate_op, which requires its fir.field operand producer to be visible. This makes IR transformation harder/brittle, so I want to update FIR to get rid if this. Codegen/printer/parser of fir.coordinate_of and many tests need to be updated after this change. | 1 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] update some old tests to HLFIR lowering (#127230) Update some LIT tests that are using the legacy lowering to use HLFIR. This makes testing more modular and is a step towards getting rid of the legacy lowering (that is only kept because of the tests). There are many more. I deleted a couple file that were very specific to the legacy lowering (e.g. array-copy). | 1 年前 | |
[flang] Enforce C815 A Fortran program may not specify a particular attribute multiple times for the same entity in a scope. Differential Revision: https://reviews.llvm.org/D136991 | 3 年前 | |
[flang] fix ignore_tkr(tk) with character dummy (#108168) The test code with ignore_tkr(tk) on character dummy passed by fir.boxchar<> was crashing the compiler in [an assert](https://github.com/llvm/llvm-project/blob/2afe678f0a246387977a8ca694d4489e2c868991/flang/lib/Optimizer/Dialect/FIRType.cpp#L632) in changeElementType. It makes little sense to call changeElementType on a fir.boxchar since this type is lossy (the shape is not part of it). Just skip it in the code dealing with ignore(tk) when hitting this case | 1 年前 | |
[flang] add fir.proc_attrs attributes to func.func (#110002) BIND(C) ABI need care in the TargetRewrite pass. currently, we are not able to accurately identify fun.func that are BIND(C) in FIR (the fir.bindc_name is used in other contexts, like for program names). This patch adds the fir.proc_attrs to func.func just like it was done for calls recently. This replace the previous named attribute for PURE/ELEMENTAL/RECURSIVE (note that RECURSIVE is changed to NON_RECURSIVE, which brings more data since RECURSIVE is the default for procedures that do not have explicit RECURSIVE/NON_RECUSRIVE attributes). | 1 年前 | |
[flang] Fixed regression with CDEFINED linkage (#164616) https://github.com/llvm/llvm-project/pull/162722 introduced a regression that started creating initializers for CDEFINED variables. CDEFINED variables cannot have initializers, because their storage is expected come from elsewhere, likely outside of Fortran. Fixed the regression and improved the regression test to catch the incorrect initialization case. Also, based on the code review feedback, made CDEFINED variable initialization a hard error and updated tests accordingly. | 9 个月前 | |
[flang][NFC] update some old tests to HLFIR lowering (#127230) Update some LIT tests that are using the legacy lowering to use HLFIR. This makes testing more modular and is a step towards getting rid of the legacy lowering (that is only kept because of the tests). There are many more. I deleted a couple file that were very specific to the legacy lowering (e.g. array-copy). | 1 年前 | |
[flang] Replace lowering of character compare. (#155458) Lower character comparison into hlfir.cmpchar operation and then lower the operation into a runtime call at intrinsic lowering. | 11 个月前 | |
[flang] Retain internal and BIND(C) host procedure link in FIR (#87796) Currently, it is not possible to find back which fun.func is the host procedure of some internal procedure because the mangling of the internal procedure does not contain info about the BIND(C) name of the host. This info may be useful to ensure dwarf DW_TAG_subprogram of internal procedures are nested under DW_TAG_subprogram of host procedures for instance. | 2 年前 | |
[flang][NFC] Characterize allocation based on MemAlloc effect instead of pattern matching (#166806) Flang alias analysis used to find allocation site by pattern matching allocation ops in mainly FIR dialect. This MR extends the characterization to instead characterize based on whether the result of an op has MemAlloc effect. | 8 个月前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Carry over alignment computed by frontend for COMMON (#94280) The frontend computes the necessary alignment for COMMON blocks but this information is never carried over to the code generation and can lead to segfault for COMMON block that requires a non default alignment. This patch add an optional attribute on fir.global and carries over the information. | 2 年前 | |
[flang] Update f128 tests Update test that require flang-supports-f128-math after #126929. | 1 年前 | |
[flang][test] Fix REQUIRES and options for a few x86 specific tests (#146872) These should have been looking for the "x86" target not "x64_64". When run on AArch64 they failed because bbc tried to compile for AArch64. Add a target option to fix that, as these tests are x86 specific. | 1 年前 | |
[mlir][flang] Make use of the new GEPArg builder of GEP Op to simplify code This is the follow up on https://reviews.llvm.org/D130730 which goes through upstream code and removes creating constant values in favour of using the constant indices in GEP directly. This leads to less and more readable code and more compact IR as well. Differential Revision: https://reviews.llvm.org/D130731 | 3 年前 | |
[flang] replace fir.complex usages with mlir complex (#110850) Core patch of https://discourse.llvm.org/t/rfc-flang-replace-usages-of-fir-complex-by-mlir-complex-type/82292. After that, the last step is to remove fir.complex from FIR types. | 1 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang][NFC] use llvm.intr.stacksave/restore instead of opaque calls (#108562) The new LLVM stack save/restore intrinsic operations are more convenient than function calls because they do not add function declarations to the module and therefore do not block the parallelisation of passes. Furthermore they could be much more easily marked with memory effects than function calls if that ever proved useful. This builds on top of #107879. Resolves #108016 | 1 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Remove double pointer indirection for _QQEnvironmentDefaults (#90615) A double pointer was being passed to the call to FortranStart rather than just a pointer to the EnvironmentDefaults.list. This now passes null directly when there's no EnvironmentDefaults.list and passes the list directly when there is, removing the original global variable which was a pointer to a pointer containing null or the EnvironmentDefaults.list global. Fixes #90537 | 2 年前 | |
[flang] Fix lowering of host associated cray pointee symbols (#86121) Cray pointee symbols can be host associated from a module or host procedure while the related cray pointer is not explicitly associated. This caused the "not yet implemented: lowering symbol to HLFIR" to fire when lowering a reference to the cray pointee and fetching the cray pointer. This patch: - Ensures cray pointers are always instantiated when instantiating a cray pointee. - Fix internal procedure lowering to deal with cray pointee host association like it does for pointers (the lowering strategy for cray pointee is to create a pointer that is updated with the cray pointer value before being fetched). This should fix the bug reported in https://github.com/llvm/llvm-project/issues/85420. | 2 年前 | |
[flang] Attach proper storage to [hl]fir.declare in lowering. (#155742) As described in https://discourse.llvm.org/t/rfc-flang-representation-for-objects-inside-physical-storage/88026, [hl]fir.declare should carry information about the layout of COMMON/EQUIVALENCE variables within the physical storage. This patch modifes Flang lowering to attach this information. | 10 个月前 | |
[flang][test] Fix Lower/default-initialization-globals.f90 on SPARC (#103722) Flang :: Lower/default-initialization-globals.f90 FAILs on SPARC, both Solaris/sparcv9 and Linux/sparc64. The failure mode is same as on AIX/PowerPC, so both targets being big-endian, this patch treats them the same. Tested on sparcv9-sun-solaris2.11, sparc64-unknown-linux-gnu, amd64-pc-solaris2.11, and x86_64-pc-linux-gnu. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[RFC][flang] Replace special symbols in uniqued global names. (#104859) This change addresses more "issues" as the one resolved in #71338. Some targets (e.g. NVPTX) do not accept global names containing .. In particular, the global variables created to represent the runtime information of derived types use . in their names. A derived type's descriptor object may be used in the device code, e.g. to initialize a descriptor of a variable of this type. Thus, the runtime type info objects may need to be compiled for the device. Moreover, at least the derived types' descriptor objects may need to be registered (think of omp declare target) for the host-device association so that the addendum pointer can be properly mapped to the device for descriptors using a derived type's descriptor as their addendum pointer. The registration implies knowing the name of the global variable in the device image so that proper host code can be created. So it is better to name the globals the same way for the host and the device. CompilerGeneratedNamesConversion pass renames all uniqued globals such that the special symbols (currently .) are replaced with X. The pass is supposed to be run for the host and the device. An option is added to FIR-to-LLVM conversion pass to indicate whether the new pass has been run before or not. This setting affects how the codegen computes the names of the derived types' descriptors for FIR derived types. fir::NameUniquer now allows X to be part of a name, because the name deconstruction may be applied to the mangled names after CompilerGeneratedNamesConversion pass. | 1 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang] update fir.coordinate_of to carry the fields (#127231) This patch updates fir.coordinate_op to carry the field index as attributes instead of relying on getting it from the fir.field_index operations defining its operands. The rational is that FIR currently has a few operations that require DAGs to be preserved in order to be able to do code generation. This is the case of fir.coordinate_op, which requires its fir.field operand producer to be visible. This makes IR transformation harder/brittle, so I want to update FIR to get rid if this. Codegen/printer/parser of fir.coordinate_of and many tests need to be updated after this change. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Main program symbol no longer conflicts with the other symbols (#149169) The following code is now accepted: module m end program m use m end The PROGRAM name doesn't really have an effect on the compilation result, so it shouldn't result in symbol name conflicts. This change makes the main program symbol name all uppercase in the cooked character stream. This makes it distinct from all other symbol names that are all lowercase in cooked character stream. Modified the tests that were checking for lower case main program name. | 1 年前 | |
| 11 个月前 | ||
[flang][NFC] use hlfir.declare first result when both results are raw pointers (#132261) Currently, the helpers to get fir::ExtendedValue out of hlfir::Entity use hlfir.declare second result ( #1) in most cases. This is because this result is the same as the input and matches what FIR was getting before lowering to HLFIR. But this creates odd situations when both hlfir.declare are raw pointers and either result ends-up being used in the IR depending on whether the code was generated by a helper using fir::ExtendedValue, or via "pure HLFIR" helpers using the first result. This will typically prevent simple CSE and easy identification that two operation (e.g load/store) are touching the exact same memory location without using alias analysis or "manual detection" (looking for common hlfir.declare defining op). Hence, when hlfir.declare results are both raw pointers, use #0 when producing fir::ExtendedValue. When #0 is a fir.box, keep using #1 because these are not the same. The only code change is in HLFIRTools.cpp and is pretty small, but there is a big test fallout of #1 to #0. | 1 年前 | |
[flang][AIX] add use of the variables (NFC) (#168073) After https://github.com/llvm/llvm-project/commit/bf3b704c60cc521b79ec54bd57fcf72368178a52, the type definition is no longer generated without using the variables. This patch is to add the use of the derived type variables. | 8 个月前 | |
[flang][NFC] Cache derived type translation in lowering (#80179) Derived type translation is proving expensive in modern fortran apps with many big derived types with dozens of components and parents. Extending the cache that prevent recursion is proving to have little cost on apps with small derived types and significant gain (can divide compile time by 2) on modern fortran apps. It is legal since the cache lifetime is less than the MLIRContext lifetime that owns the cached mlir::Type. Doing so also exposed that the current caching was incorrect, the type symbol is the same for kind parametrized derived types regardless of the kind parameters. Instances with different kinds should lower to different MLIR types. See added test. Using the type scopes fixes the problem. | 2 年前 | |
[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 | 4 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Enable polymorphic lowering by default (#83285) Polymorphic entity lowering status is good. The main remaining TODO is to allow lowering of vector subscripted polymorphic entity, but this does not deserve blocking all application using polymorphism. Remove experimental option and enable lowering of polymorphic entity by default. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][fir] Lower do concurrent loop nests to fir.do_concurrent (#137928) Adds support for lowering do concurrent nests from PFT to the new fir.do_concurrent MLIR op as well as its special terminator fir.do_concurrent.loop which models the actual loop nest. To that end, this PR emits the allocations for the iteration variables within the block of the fir.do_concurrent op and creates a region for the fir.do_concurrent.loop op that accepts arguments equal in number to the number of the input do concurrent iteration ranges. For example, given the following input: fortran do concurrent(i=1:10, j=11:20) end do the changes in this PR emit the following MLIR: mlir fir.do_concurrent { %22 = fir.alloca i32 {bindc_name = "i"} %23:2 = hlfir.declare %22 {uniq_name = "_QFsub1Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) %24 = fir.alloca i32 {bindc_name = "j"} %25:2 = hlfir.declare %24 {uniq_name = "_QFsub1Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) fir.do_concurrent.loop (%arg1, %arg2) = (%18, %20) to (%19, %21) step (%c1, %c1_0) { %26 = fir.convert %arg1 : (index) -> i32 fir.store %26 to %23#0 : !fir.ref<i32> %27 = fir.convert %arg2 : (index) -> i32 fir.store %27 to %25#0 : !fir.ref<i32> } } | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
Revert "[flang] Enable delayed localization by default for do concurrent (#144074)" (#144476) This reverts commit b5dbf8210a57b986b9802304745f4c5c108cf37b. Reverting again due to gfortran failure: https://lab.llvm.org/buildbot/#/builders/17/builds/8868 | 1 年前 | |
Revert "[flang] Enable delayed localization by default for do concurrent (#144074)" (#144476) This reverts commit b5dbf8210a57b986b9802304745f4c5c108cf37b. Reverting again due to gfortran failure: https://lab.llvm.org/buildbot/#/builders/17/builds/8868 | 1 年前 | |
[flang] Do not re-localize loop ivs when nested inside blocks (#153350) Consider the following example: fortran implicit none integer :: i, j do concurrent (i=1:10) local(j) block do j=1,20 end do end block end do Without the fix introduced in this PR, the compiler would "re-localize" the j variable inside the fir.do_concurrent loop: mlir fir.do_concurrent { %7 = fir.alloca i32 {bindc_name = "j"} %8:2 = hlfir.declare %7 {uniq_name = "_QFloop_in_nested_blockEj"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) ... fir.do_concurrent.loop (%arg0) = (%5) to (%6) step (%c1) local(@_QFloop_in_nested_blockEj_private_i32 %4#0 -> %arg1 : !fir.ref<i32>) { %12:2 = hlfir.declare %arg1 {uniq_name = "_QFloop_in_nested_blockEj"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) ... %17:2 = fir.do_loop %arg2 = %14 to %15 step %c1_1 iter_args(%arg3 = %16) -> (index, i32) { fir.store %arg3 to %8#0 : !fir.ref<i32> ... } } } This happened because we did a shallow look-up of j and since the loop is nested inside a block, the look-up failed and we re-created a local allocation for j inside the parent fir.do_concurrent loop. This means that we ended up not using the actual localized symbol which is passed as a region argument to the fir.do_concurrent.loop op. In case of j, we do not need to do a shallow look-up. The shallow look-up is only needed if a symbol is an OpenMP private one or an iteration variable of a do concurrent loop. Neither of which applies to j. With the fix, j is properly resolved to the local region argument: mlir fir.do_concurrent { ... fir.do_concurrent.loop (%arg0) = (%5) to (%6) step (%c1) local(@_QFloop_in_nested_blockEj_private_i32 %4#0 -> %arg1 : !fir.ref<i32>) { ... %10:2 = hlfir.declare %arg1 {uniq_name = "_QFloop_in_nested_blockEj"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) ... %15:2 = fir.do_loop %arg2 = %12 to %13 step %c1_1 iter_args(%arg3 = %14) -> (index, i32) { fir.store %arg3 to %10#0 : !fir.ref<i32> ... } } } | 11 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][do concurrent] Extned getAllocaBlock() and emit yields correctly (#146853) Handles some loose ends in do concurrent reduction declarations. This PR extends getAllocaBlock to handle declare ops, and also emit fir.yield in all regions. | 1 年前 | |
[flang] Support do concurrent ... reduce for associating names (#148597) Extends reduction support for do concurrent, in particular, for associating names. Consider the following input: fortran subroutine dc_associate_reduce integer :: i real, allocatable, dimension(:) :: x associate(x_associate => x) do concurrent (i = 1:10) reduce(+: x_associate) end do end associate end subroutine The declaration of x_associate is emitted as follows: mlir %13:2 = hlfir.declare %10(%12) {uniq_name = "...."} : (!fir.heap<!fir.array<?xf32>>, !fir.shapeshift<1>) -> (!fir.box<!fir.array<?xf32>>, !fir.heap<!fir.array<?xf32>>) where the HLFIR base type is an array descriptor (i.e. the allocatable/heap attribute is dropped as stipulated by the spec; section 11.1.3.3). The problem here is that declare_reduction ops accept only reference types. This restriction is already partially handled for fir::BaseBoxType's by allocating a stack slot for the descriptor and storing the box in that stack allocation. We have to modify this a littble bit for associate since the HLFIR and FIR base types are different (unlike most scenarios). | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Characterize allocation based on MemAlloc effect instead of pattern matching (#166806) Flang alias analysis used to find allocation site by pattern matching allocation ops in mainly FIR dialect. This MR extends the characterization to instead characterize based on whether the result of an op has MemAlloc effect. | 8 个月前 | |
[flang] Simplify copy-in copy-out runtime API (#95822) The runtime API for copy-in copy-out currently only has an entry only for the copy-out. This entry has a "skipInit" boolean that is never set to false by lowering and it does not deal with the deallocation of the temporary. The generated code was a mix of inline code and runtime calls This is not a big deal, but this is unneeded compiler and generated code complexity. With assumed-rank, it is also more cumbersome to establish a temporary descriptor. Instead, this patch: - Adds a CopyInAssignment API that deals with establishing the temporary descriptor and does the copy. - Removes unused arg to CopyOutAssign, and pushes destruction/deallocation responsibility inside it. Note that this runtime API are still not responsible for deciding the need of copying-in and out. This is kept as a separate runtime call to IsContiguous, which is easier to inline/replace by inline code with the hope of removing the copy-in/out calls after user function inlining. @vzakhari has already shown that always inlining all the copy part increase Fortran compilation time due to loop optimization attempts for loops that are known to have little optimization profitability (the variable being copied from and to is not contiguous). | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Do not pass derived type by descriptor when not needed A missing "!" in the call interface lowering caused all derived type arguments without length parameters that require and explicit interface to be passed via fir.box (runtime descriptor). This was not the intent: there is no point passing a simple derived type scalars or explicit shapes by descriptor just because they have an attribute like TARGET. This would actually be problematic with existing code that is not always 100% compliant: some code implicitly calls procedures with TARGET dummy attributes (this is not something a compiler can enforce if the call and procedure definition are not in the same file). Add a Scope::IsDerivedTypeWithLengthParameter to avoid passing derived types with only kind parameters by descriptor. There is no point, the callee knows about the kind parameter values. Differential Revision: https://reviews.llvm.org/D123990 | 4 年前 | |
[flang] Simplify copy-in copy-out runtime API (#95822) The runtime API for copy-in copy-out currently only has an entry only for the copy-out. This entry has a "skipInit" boolean that is never set to false by lowering and it does not deal with the deallocation of the temporary. The generated code was a mix of inline code and runtime calls This is not a big deal, but this is unneeded compiler and generated code complexity. With assumed-rank, it is also more cumbersome to establish a temporary descriptor. Instead, this patch: - Adds a CopyInAssignment API that deals with establishing the temporary descriptor and does the copy. - Removes unused arg to CopyOutAssign, and pushes destruction/deallocation responsibility inside it. Note that this runtime API are still not responsible for deciding the need of copying-in and out. This is kept as a separate runtime call to IsContiguous, which is easier to inline/replace by inline code with the hope of removing the copy-in/out calls after user function inlining. @vzakhari has already shown that always inlining all the copy part increase Fortran compilation time due to loop optimization attempts for loops that are known to have little optimization profitability (the variable being copied from and to is not contiguous). | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang] Give internal linkage to internal procedures (#81929) Internal procedures cannot be called directly from outside the host procedure, so there is no point giving them external linkage. The only reason flang did is because it is the default in MLIR. Giving external linkage to them: - prevents deleting them when not used/inlined by LLVM - causes bugs with shared libraries (at least on linux x86-64) because the call to the internal function could lead to a dynamic loader call that would overwrite r10 register (the static chain pointer) due to system calls and did not restore (it seems it does not expect r10 to be used for PLT calls). This patch gives internal linkage to internal procedures: Note: the llvm.linkage attribute name cannot be obtained via a getLinkageAttrName since it is not the same name as the one used in the LLVM dialect. It is just a placeholder defined in mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp until the func dialect gets a real linkage model. So simply avoid hard coding it too many times in lowering. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] do not finalize or initialize unused entry dummy (#125482) Dummy arguments from other entry statement that are not live in the current entry have no backing storage, user code referring to them is not allowed to be reached. The compiler was generating initialization/destruction code for them when INTENT(OUT), causing undefined behaviors. | 1 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang] Remove double pointer indirection for _QQEnvironmentDefaults (#90615) A double pointer was being passed to the call to FortranStart rather than just a pointer to the EnvironmentDefaults.list. This now passes null directly when there's no EnvironmentDefaults.list and passes the list directly when there is, removing the original global variable which was a pointer to a pointer containing null or the EnvironmentDefaults.list global. Fixes #90537 | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
| 1 年前 | ||
[flang][test] Fix filecheck annotation typos (#92387) | 1 年前 | |
[flang] Attach proper storage to [hl]fir.declare in lowering. (#155742) As described in https://discourse.llvm.org/t/rfc-flang-representation-for-objects-inside-physical-storage/88026, [hl]fir.declare should carry information about the layout of COMMON/EQUIVALENCE variables within the physical storage. This patch modifes Flang lowering to attach this information. | 10 个月前 | |
[flang] Attach proper storage to [hl]fir.declare in lowering. (#155742) As described in https://discourse.llvm.org/t/rfc-flang-representation-for-objects-inside-physical-storage/88026, [hl]fir.declare should carry information about the layout of COMMON/EQUIVALENCE variables within the physical storage. This patch modifes Flang lowering to attach this information. | 10 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang] Avoid segfault when defining op is not a fir::Convert The previous code made the assumption that the defining operation is a fir::ConvertOp without checking. This results in segmentation fault in code like the added test. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D129077 | 4 年前 | |
[flang] Do not produce result for void runtime call (#123155) Runtime function call to a void function are producing a ssa value because the FunctionType result is set to NoneType with is later translated to a empty struct. This is not an issue when going to LLVM IR but it breaks when lowering a gpu module to PTX. This patch update the RTModel to correctly set the FunctionType result type to nothing. This is one runtime call before this patch at the LLVM IR dialect step. %45 = llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> !llvm.struct<()> After the patch the call would be correctly formed llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> () Without the patch it would lead to error like: ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 10; error : Output parameter cannot be an incomplete array. ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 125; error : Call has wrong number of parameters The change is pretty much mechanical. | 1 年前 | |
[flang] Add -ffast-math and -Ofast clang -cc1 accepts -Ofast. I did not add it to flang -fc1 because this seems redundant because the compiler driver will always resolve -Ofast into -O3 -ffast-math (I added a test for this). -menable-infs is removed from the frontend-forwarding test because if all of the fast-math component flags are present, these will be resolved into the fast-math flag. Instead -menable-infs is tested in the fast-math test. Specifying -ffast-math to the compiler driver causes linker invocations to include crtfastmath.o. RFC: https://discourse.llvm.org/t/rfc-the-meaning-of-ofast/66554 Differential Revision: https://reviews.llvm.org/D138675 | 3 年前 | |
[flang][NFC] Strip trailing whitespace from tests (6 of N) Only the fortran source files in flang/test/Lower/PowerPC and some in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Fixed regression in copy-in/copy-out (#161259) Fixed the polymprphic check for copy-in/copy-out, added regression tests. Changed MayNeedCopy() to return std::optional<bool> and renamed it to ActualArgNeedsCopy(). This function now returns true/false when it's known that actual arguments needs copy in/out, or std::nullopt to signify that it's now known, whether copy in/out is needed. Fixes #159149 | 8 个月前 | |
[flang] Runtime assigned format errors Generate a runtime error message for a reference to an invalid assigned format such as: if (.true.) print n end | 2 年前 | |
[flang][driver] add negative from of -fsave-main-program (#124110) Add the -fno form for consistency and to make it easy to switch the default for downstream users. | 1 年前 | |
[flang] add fir.proc_attrs attributes to func.func (#110002) BIND(C) ABI need care in the TargetRewrite pass. currently, we are not able to accurately identify fun.func that are BIND(C) in FIR (the fir.bindc_name is used in other contexts, like for program names). This patch adds the fir.proc_attrs to func.func just like it was done for calls recently. This replace the previous named attribute for PURE/ELEMENTAL/RECURSIVE (note that RECURSIVE is changed to NON_RECURSIVE, which brings more data since RECURSIVE is the default for procedures that do not have explicit RECURSIVE/NON_RECUSRIVE attributes). | 1 年前 | |
[flang] Fix crash resolving interface procedure type. (#162205) When generic interface name shadows specific, bypass to specific procedure while resolving its type. | 9 个月前 | |
[flang] Change uniqueCGIdent separator from . to X (#71338) Change the separator in the uniqueCGIdent method to X. This change is required to enable OpenMP offloading for the NVPTX target, as dots are not valid identifiers in PTX and uniqueCGIdent is used to mangle some literals. Follow up patches will change the remainder of . appearances in names to X and add support for the NVPTX target. | 2 年前 | |
[flang] Give internal linkage to internal procedures (#81929) Internal procedures cannot be called directly from outside the host procedure, so there is no point giving them external linkage. The only reason flang did is because it is the default in MLIR. Giving external linkage to them: - prevents deleting them when not used/inlined by LLVM - causes bugs with shared libraries (at least on linux x86-64) because the call to the internal function could lead to a dynamic loader call that would overwrite r10 register (the static chain pointer) due to system calls and did not restore (it seems it does not expect r10 to be used for PLT calls). This patch gives internal linkage to internal procedures: Note: the llvm.linkage attribute name cannot be obtained via a getLinkageAttrName since it is not the same name as the one used in the LLVM dialect. It is just a placeholder defined in mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp until the func dialect gets a real linkage model. So simply avoid hard coding it too many times in lowering. | 2 年前 | |
| 1 年前 | ||
[flang] Do not produce result for void runtime call (#123155) Runtime function call to a void function are producing a ssa value because the FunctionType result is set to NoneType with is later translated to a empty struct. This is not an issue when going to LLVM IR but it breaks when lowering a gpu module to PTX. This patch update the RTModel to correctly set the FunctionType result type to nothing. This is one runtime call before this patch at the LLVM IR dialect step. %45 = llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> !llvm.struct<()> After the patch the call would be correctly formed llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> () Without the patch it would lead to error like: ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 10; error : Output parameter cannot be an incomplete array. ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 125; error : Call has wrong number of parameters The change is pretty much mechanical. | 1 年前 | |
[flang][NFC] use llvm.intr.stacksave/restore instead of opaque calls (#108562) The new LLVM stack save/restore intrinsic operations are more convenient than function calls because they do not add function declarations to the module and therefore do not block the parallelisation of passes. Furthermore they could be much more easily marked with memory effects than function calls if that ever proved useful. This builds on top of #107879. Resolves #108016 | 1 年前 | |
[flang] Attach proper storage to [hl]fir.declare in lowering. (#155742) As described in https://discourse.llvm.org/t/rfc-flang-representation-for-objects-inside-physical-storage/88026, [hl]fir.declare should carry information about the layout of COMMON/EQUIVALENCE variables within the physical storage. This patch modifes Flang lowering to attach this information. | 10 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (7 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Allow flexible name in llvm.ident (NFC) (#104543) | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Source code location for IF statements and constructs (#90853) Make source code locations for IF statements and IF construct component statements more accurate. Make similar changes to ASSOCIATE, BLOCK, and SELECT TYPE construct component statements. | 2 年前 | |
[flang] Removed old option -fdebug-dump-pre-fir (#168008) This option has long been replaced by -fc1 -fdebug-dump-pft. Removed the old option and updated one test that still used it. | 8 个月前 | |
[flang] replace fir.complex usages with mlir complex (#110850) Core patch of https://discourse.llvm.org/t/rfc-flang-replace-usages-of-fir-complex-by-mlir-complex-type/82292. After that, the last step is to remove fir.complex from FIR types. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Clean-up for fir.do_loop generation in lowering. (#160630) This patch changes two things: 1. We do not need to use the loop counter's last value for regular do-loops in Lowering. 2. The loop counter's increment is implied by fir.do_loop operation, so there is no need to increment it explicitly. The last point has been especially confusing to me, because it was unclear why we have an explicit increment if it is implied. It looks like CFGConversion somehow still makes the final code correct, i.e. the counter is not incremented twice. Anyway, the new lowering should look more concise. | 10 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] use hlfir.declare first result when both results are raw pointers (#132261) Currently, the helpers to get fir::ExtendedValue out of hlfir::Entity use hlfir.declare second result ( #1) in most cases. This is because this result is the same as the input and matches what FIR was getting before lowering to HLFIR. But this creates odd situations when both hlfir.declare are raw pointers and either result ends-up being used in the IR depending on whether the code was generated by a helper using fir::ExtendedValue, or via "pure HLFIR" helpers using the first result. This will typically prevent simple CSE and easy identification that two operation (e.g load/store) are touching the exact same memory location without using alias analysis or "manual detection" (looking for common hlfir.declare defining op). Hence, when hlfir.declare results are both raw pointers, use #0 when producing fir::ExtendedValue. When #0 is a fir.box, keep using #1 because these are not the same. The only code change is in HLFIRTools.cpp and is pretty small, but there is a big test fallout of #1 to #0. | 1 年前 | |
[flang] Add fastmath flags to localBuilder in IntrinsicCall Currently the local builder used in IntrinsicCall doesn't have the fastmath flags passed to it. This results in the fastmath attribute not being added to certain runtime calls. This patch simply forwards the fastmath flags from the parent builder. Differential Revision: https://reviews.llvm.org/D154611 | 3 年前 | |
[flang][NFC] use hlfir.declare first result when both results are raw pointers (#132261) Currently, the helpers to get fir::ExtendedValue out of hlfir::Entity use hlfir.declare second result ( #1) in most cases. This is because this result is the same as the input and matches what FIR was getting before lowering to HLFIR. But this creates odd situations when both hlfir.declare are raw pointers and either result ends-up being used in the IR depending on whether the code was generated by a helper using fir::ExtendedValue, or via "pure HLFIR" helpers using the first result. This will typically prevent simple CSE and easy identification that two operation (e.g load/store) are touching the exact same memory location without using alias analysis or "manual detection" (looking for common hlfir.declare defining op). Hence, when hlfir.declare results are both raw pointers, use #0 when producing fir::ExtendedValue. When #0 is a fir.box, keep using #1 because these are not the same. The only code change is in HLFIRTools.cpp and is pretty small, but there is a big test fallout of #1 to #0. | 1 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang] Enable polymorphic lowering by default (#83285) Polymorphic entity lowering status is good. The main remaining TODO is to allow lowering of vector subscripted polymorphic entity, but this does not deserve blocking all application using polymorphism. Remove experimental option and enable lowering of polymorphic entity by default. | 2 年前 | |
[flang] Allow -fdefault-integer-8 with defined I/O (#148927) Defined I/O subroutines have UNIT= and IOSTAT= dummy arguments that are required to have type INTEGER with its default kind. When that default kind is modified via -fdefault-integer-8, calls to defined I/O subroutines from the runtime don't work. Add a flag to the two data structures shared between the compiler and the runtime support library to indicate that a defined I/O subroutine was compiled under -fdefault-integer-8. This has been done in a compatible manner, so that existing binaries are compatible with the new library and new binaries are compatible with the old library, unless of course -fdefault-integer-8 is used. Fixes https://github.com/llvm/llvm-project/issues/148638. | 1 年前 | |
[flang] Clean-up for fir.do_loop generation in lowering. (#160630) This patch changes two things: 1. We do not need to use the loop counter's last value for regular do-loops in Lowering. 2. The loop counter's increment is implied by fir.do_loop operation, so there is no need to increment it explicitly. The last point has been especially confusing to me, because it was unclear why we have an explicit increment if it is implied. It looks like CFGConversion somehow still makes the final code correct, i.e. the counter is not incremented twice. Anyway, the new lowering should look more concise. | 10 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][runtime] Don't use -1 in I/O API for "default unit" (#76642) The I/O runtime's API allows -1 to be passed for a unit number in a READ, WRITE, or PRINT statement, where it gets replaced by 5 or 6 as appropriate. This turns out to have been a bad idea, as it prevents the I/O runtime from detecting and reporting a program's invalid attempt to use -1 as an I/O unit number. So just pass 5 or 6 as appropriate. | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang] Do not produce result for void runtime call (#123155) Runtime function call to a void function are producing a ssa value because the FunctionType result is set to NoneType with is later translated to a empty struct. This is not an issue when going to LLVM IR but it breaks when lowering a gpu module to PTX. This patch update the RTModel to correctly set the FunctionType result type to nothing. This is one runtime call before this patch at the LLVM IR dialect step. %45 = llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> !llvm.struct<()> After the patch the call would be correctly formed llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> () Without the patch it would lead to error like: ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 10; error : Output parameter cannot be an incomplete array. ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 125; error : Call has wrong number of parameters The change is pretty much mechanical. | 1 年前 | |
[flang] Set default to -ffpcontract=fast Following RFC at https://discourse.llvm.org/t/rfc-ffp-contract-default-value/66301 This adds the fastmath<contract> attribute to fir.call and some floating point arithmetic operations (hence the many test changes). Instead of testing for this specific attribute, I am using a regular expression to match any attributes. | 3 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Add lowering tests Add lowering tests left behind during the upstreaming. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D128721 Co-authored-by: Jean Perier <jperier@nvidia.com> Co-authored-by: Eric Schweitz <eschweitz@nvidia.com> | 4 年前 | |
[flang] Implement !DIR$ IVDEP directive (#133728) This directive tells the compiler to ignore vector dependencies in the following loop and it must be placed before a do loop. Sometimes the compiler may not have sufficient information to decide whether a particular loop is vectorizable due to potential dependencies between iterations and the directive is here to tell to the compiler that vectorization is safe with parallelAccesses metadata. This directive is also equivalent to #pragma clang loop assume(safety) in C++ | 8 个月前 | |
[flang] Implement -mcmodel flag (#95411) This patch implements the -mcmodel flag from clang, allowing the Code Model to be changed for the LLVM module. The same set of mcmodel flags are accepted as in clang and the same Code Model attributes are added to the LLVM module for those flags. Also add -mlarge-data-threshold for x86-64, which is automatically set by the shared command-line code (see below). This is also added as an attribute into the LLVM module and on the target machine. A function is created for addMCModel that is copied out of clang's argument handling so that it can be shared with flang. --------- Co-authored-by: Mats Petersson <mats.petersson@arm.com> | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Enhance location information (#95862) Add inclusion location information by using FusedLocation with attribute. More context here: https://discourse.llvm.org/t/rfc-enhancing-location-information/79650 | 2 年前 | |
[flang] Enhance location information (#95862) Add inclusion location information by using FusedLocation with attribute. More context here: https://discourse.llvm.org/t/rfc-enhancing-location-information/79650 | 2 年前 | |
[flang] Set default to -ffpcontract=fast Following RFC at https://discourse.llvm.org/t/rfc-ffp-contract-default-value/66301 This adds the fastmath<contract> attribute to fir.call and some floating point arithmetic operations (hence the many test changes). Instead of testing for this specific attribute, I am using a regular expression to match any attributes. | 3 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Characterize allocation based on MemAlloc effect instead of pattern matching (#166806) Flang alias analysis used to find allocation site by pattern matching allocation ops in mainly FIR dialect. This MR extends the characterization to instead characterize based on whether the result of an op has MemAlloc effect. | 8 个月前 | |
[flang] Clean-up for fir.do_loop generation in lowering. (#160630) This patch changes two things: 1. We do not need to use the loop counter's last value for regular do-loops in Lowering. 2. The loop counter's increment is implied by fir.do_loop operation, so there is no need to increment it explicitly. The last point has been especially confusing to me, because it was unclear why we have an explicit increment if it is implied. It looks like CFGConversion somehow still makes the final code correct, i.e. the counter is not incremented twice. Anyway, the new lowering should look more concise. | 10 个月前 | |
[flang][do concurrent] Re-model reduce to match reductions are modelled in OpenMP and OpenACC (#145837) This PR proposes re-modelling reduce specifiers to match OpenMP and OpenACC. In particular, this PR includes the following: * A new fir op: fir.delcare_reduction which is identical to OpenMP's omp.declare_reduction op. * Updating the reduce clause on fir.do_concurrent.loop to use the new op. * Re-uses the ReductionProcessor component to emit reductions for do concurrent just like we do for OpenMP. To do this, the ReductionProcessor had to be refactored to be more generalized. * Upates mapping do concurrent to fir.loop ... unordered nests using the new reduction model. Unfortunately, this is a big PR that would be difficult to divide up in smaller parts because the bottom of the changes are the fir table-gen changes to do concurrent. However, doing these MLIR changes cascades to the other parts that have to be modified to not break things. This PR goes in the same direction we went for private/local speicifiers. Now the do concurrent and OpenMP (and OpenACC) dialects are modelled in essentially the same way which makes mapping between them more trivial, hopefully. PR stack: - https://github.com/llvm/llvm-project/pull/145837 (this one) - https://github.com/llvm/llvm-project/pull/146025 - https://github.com/llvm/llvm-project/pull/146028 - https://github.com/llvm/llvm-project/pull/146033 | 1 年前 | |
[flang] Get ProvenanceRange from CharBlock starting with expanded macro (#77791) When a CharBlock starts with an expanded macro but does not end in this macro expansion, GetProvenanceRange fails to return a ProvenanceRange which may cause error message to be emitted without location or lowering to emit code without source location (which is problematic if this code contains calls to procedures defined in the same file since LLVM will later crash with the error: "inlinable function call in a function with a DISubprogram location must have a debug location" Fix this situation by returning the ProvenanceRange starting at the replaced macro reference. | 2 年前 | |
[flang] Fixed fir.dummy_scope generation to work for TBAA. (#136382) The nesting of fir.dummy_scope operations defines the roots of the TBAA forest. If we do not generate fir.dummy_scope in functions that do not have any dummy arguments, then the globals accessed in the function and the dummy arguments accessed by the callee may end up in different sub-trees of the same root. The added tbaa-with-dummy-scope2.fir demonstrates the issue. | 1 年前 | |
[flang] Avoid ICE in case of subprogram name clash with runtime namespace. This is related to llvm-project#61074. In general, it is undefined behavior if user subprogram is declared with a name that matches a name of function from any runtime library that Flang is using (e.g. FortranRuntime, libm, etc.). With this change-set we avoid ICE for invalid calls generated during math lowering by type casing the function before the call. This happens when a user function call is lowered before the math function call with the same name. To detect the name clash in cases when the math function call is lowered before the user function call we set fir.runtime attribute for the math functions and check it when we lower the user function call. The warnings are currently emitted only in debug compiler and under llvm debug options. I think they should be reported in the same way as regular Flang warnings. Note that this change-set does not resolve issues with the conversion passes that might introduce libm calls after the lowering. Differential Revision: https://reviews.llvm.org/D145653 | 3 年前 | |
[flang] Fix failing test (#97634) Add requires line to not test when the target architecture isn't supported. Technically we could make it a bit less restrictive, but want green builds. | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang] Clean-up for fir.do_loop generation in lowering. (#160630) This patch changes two things: 1. We do not need to use the loop counter's last value for regular do-loops in Lowering. 2. The loop counter's increment is implied by fir.do_loop operation, so there is no need to increment it explicitly. The last point has been especially confusing to me, because it was unclear why we have an explicit increment if it is implied. It looks like CFGConversion somehow still makes the final code correct, i.e. the counter is not incremented twice. Anyway, the new lowering should look more concise. | 10 个月前 | |
[flang] Give internal linkage to internal procedures (#81929) Internal procedures cannot be called directly from outside the host procedure, so there is no point giving them external linkage. The only reason flang did is because it is the default in MLIR. Giving external linkage to them: - prevents deleting them when not used/inlined by LLVM - causes bugs with shared libraries (at least on linux x86-64) because the call to the internal function could lead to a dynamic loader call that would overwrite r10 register (the static chain pointer) due to system calls and did not restore (it seems it does not expect r10 to be used for PLT calls). This patch gives internal linkage to internal procedures: Note: the llvm.linkage attribute name cannot be obtained via a getLinkageAttrName since it is not the same name as the one used in the LLVM dialect. It is just a placeholder defined in mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp until the func dialect gets a real linkage model. So simply avoid hard coding it too many times in lowering. | 2 年前 | |
flang: Fix module-debug-file-loc-linux.f90 in standalone In a standalone build, there is no guarantee that flang code would be saved in a directory named flang. Check only the path under flang's root directory. Reviewed By: #flang, kiranchandramohan Differential Revision: https://reviews.llvm.org/D157642 | 2 年前 | |
[Flang] Add/Restore basic debug support (1/n) Recent changes to MLIR meant that Flang does not generate any debug line table information. This patch adds a pass that provides some foundation work with which basic line table debug info can be generated. A walk is performed on all the func ops in the module and they are decorated with a fusedLoc op that contains the debug metadata for the subroutine along with location information. Alternatives include populating this info during lowering or during FIR to LLVM Dialect conversion. Note: Patches in future will add -> more realistic debug info for types and other fields. -> driver flags to control generation of debug. Fixes #58634. Reviewed By: awarzynski, vzakhari Differential Revision: https://reviews.llvm.org/D137956 | 3 年前 | |
| 1 年前 | ||
[flang] Represent TARGET for globals with 'target' attribute. TARGET dummy arguments have fir.target attribute attached to them, but globals do not have any sign of TARGET. This patch adds target attribute for globals, which can be queried via ::fir::GlobalOp::getTarget(). Differential Revision: https://reviews.llvm.org/D135313 | 3 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
| 9 个月前 | ||
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Set default to -ffpcontract=fast Following RFC at https://discourse.llvm.org/t/rfc-ffp-contract-default-value/66301 This adds the fastmath<contract> attribute to fir.call and some floating point arithmetic operations (hence the many test changes). Instead of testing for this specific attribute, I am using a regular expression to match any attributes. | 3 年前 | |
[flang] Clean-up for fir.do_loop generation in lowering. (#160630) This patch changes two things: 1. We do not need to use the loop counter's last value for regular do-loops in Lowering. 2. The loop counter's increment is implied by fir.do_loop operation, so there is no need to increment it explicitly. The last point has been especially confusing to me, because it was unclear why we have an explicit increment if it is implied. It looks like CFGConversion somehow still makes the final code correct, i.e. the counter is not incremented twice. Anyway, the new lowering should look more concise. | 10 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][nfc] Use llvm memmove intrinsic over regular call (#134294) Follow up to #134170. We should be using the LLVM intrinsics instead of plain fir.calls when we can. Existing code creates a declaration for the llvm intrinsic and a regular fir.call, which makes it hard for consumers of the IR to find all the intrinsic calls. | 1 年前 | |
[Flang] Fix crash with parametrized derived types usage (#150289) The current mangleName implementation doesn't take a FoldingContext, which prevents the proper evaluation of expressions containing parameter references to an integer constant. Since parametrized derived types are not yet implemented, the compiler will crash there in some cases (see example in issue #127424). This is a workaround so that doesn't happen until the feature is properly implemented. Fixes #127424 | 1 年前 | |
[NFC][flang] Removed literal numerical references from some LIT tests. (#136346) | 1 年前 | |
[flang] Enable polymorphic lowering by default (#83285) Polymorphic entity lowering status is good. The main remaining TODO is to allow lowering of vector subscripted polymorphic entity, but this does not deserve blocking all application using polymorphism. Remove experimental option and enable lowering of polymorphic entity by default. | 2 年前 | |
[flang][test] Fix filecheck annotation typos (#92387) | 1 年前 | |
[Flang] Make handling of %VAL consistent with gfortran (#157873) Prevent fir.convert operation from being generated between logical and pointer types. | 10 个月前 | |
| 10 个月前 | ||
[flang] Lower assumed length character allocatable and pointer arguments It seems the needed functionality was already implemented for host associations, so turn that code into a function and move it into a (hopefully appropriate) common location and reuse it. Differential Revision: https://reviews.llvm.org/D135481 | 3 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang] canonicalize shape in pointer remapping lowering (#157472) Fix for #153221. Canonicalize the new shape of the pointer when lowering pointer assignment with bounds remapping. This is done by using the existing helper that generates a compare to zero + select like in the other situation where shapes are lowered. Note that this only needs to be done for the extents here because lower bounds are canonicalized in LBOUND inquiries and descriptor creation (embox/rebox codegen) based on the extent value. | 10 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
Reland " [flang] Rely on global initialization for simpler derived types" (#130290) Currently, all derived types are initialized through _FortranAInitialize, which is functionally correct, but bears poor runtime performance. This patch falls back on global initialization for "simpler" derived types to speed up the initialization. Note: this relands #114002 with the fix for the LLVM timeout regressions that have been seen. The fix is to use the added fir.copy to avoid aggregate load/store. Co-authored-by: NimishMishra <42909663+NimishMishra@users.noreply.github.com> | 1 年前 | |
[flang] simplify pointer assignments (#168732) Pointer assignment lowering was done in different ways depending on contexts and types, sometimes still using runtime calls when this is not needed and the complexity of doing this inline is very limited (the pointer and target descriptors were already prepared inline, the runtime is just doing the descriptor assignment and ensuring the pointer descriptor keep its pointer flag). Slightly extent the inline version that was used for Forall and use it for all cases. When lowering without HLFIR is removed, this will allow removing more code. | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Attach proper storage to [hl]fir.declare in lowering. (#155742) As described in https://discourse.llvm.org/t/rfc-flang-representation-for-objects-inside-physical-storage/88026, [hl]fir.declare should carry information about the layout of COMMON/EQUIVALENCE variables within the physical storage. This patch modifes Flang lowering to attach this information. | 10 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][nfc] Use llvm memmove intrinsic over regular call (#134294) Follow up to #134170. We should be using the LLVM intrinsics instead of plain fir.calls when we can. Existing code creates a declaration for the llvm intrinsic and a regular fir.call, which makes it hard for consumers of the IR to find all the intrinsic calls. | 1 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang] replace fir.complex usages with mlir complex (#110850) Core patch of https://discourse.llvm.org/t/rfc-flang-replace-usages-of-fir-complex-by-mlir-complex-type/82292. After that, the last step is to remove fir.complex from FIR types. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[MLIR] Add new complex.powi op (#158722) This PR adds a new complex.powi operation to MLIR's complex dialect for computing complex numbers raised to integer powers. Key changes include: - Addition of the new PowiOp operation definition in the Complex dialect - Integration with algebraic simplification passes for optimization - Support for conversion to ROCDL library calls - Updates to Flang frontend to generate the new operation This depends on #158642. | 10 个月前 | |
[flang] Submodules A submodule is a program unit that may contain the implementions of procedures declared in an ancestor module or submodule. Processing for the equivalence groups and variables declared in a submodule scope is similar to existing processing for the equivalence groups and variables in module and procedure scopes. However, module and procedure scopes are tied directly to code in the Pre-FIR Tree (PFT), whereas processing for a submodule must have access to an ancestor module scope that is guaranteed to be present in a .mod file, but is not guaranteed to be in the PFT. This difference is accommodated by tying processing directly to a front end scope. Function scopes that can be processed on the fly are done that way; the resulting variable information is never stored. Module and submodule scopes whose symbol information may be needed during lowering of any number of module procedures are instead cached on first use, and reused as needed. These changes are a direct extension of current code. All module and submodule variables in scope are processed, whether referenced or not. A possible alternative would be to instead process symbols only when first used. While this could ultimately be beneficial, such an approach must account for the presence of equivalence groups. That information is not currently available for on-the-fly variable processing. Some additional changes are needed to include submodules in places where modules must be considered, and to include separate module procedures in places where other subprogram variants are considered. There is also a fix for a bug involving the use of variables in an equivalence group in a namelist group, which also involves scope processing code. | 3 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Main program symbol no longer conflicts with the other symbols (#149169) The following code is now accepted: module m end program m use m end The PROGRAM name doesn't really have an effect on the compilation result, so it shouldn't result in symbol name conflicts. This change makes the main program symbol name all uppercase in the cooked character stream. This makes it distinct from all other symbol names that are all lowercase in cooked character stream. Modified the tests that were checking for lower case main program name. | 1 年前 | |
[flang] Catch more semantic errors with coarrays (#125536) Detect and report a bunch of uncaught semantic errors with coarray declarations. Add more tests, and clean up bad usage in existing tests. | 1 年前 | |
[flang] Update PFTBuilder This patch update the PFTBuilder to be able to lower the construct present in semantics. This is a building block for other lowering patches that will be posted soon. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: PeteSteinfeld, schweitz Differential Revision: https://reviews.llvm.org/D120336 Co-authored-by: Jean Perier <jperier@nvidia.com> Co-authored-by: V Donaldson <vdonaldson@nvidia.com> | 4 年前 | |
[flang] Main program symbol no longer conflicts with the other symbols (#149169) The following code is now accepted: module m end program m use m end The PROGRAM name doesn't really have an effect on the compilation result, so it shouldn't result in symbol name conflicts. This change makes the main program symbol name all uppercase in the cooked character stream. This makes it distinct from all other symbol names that are all lowercase in cooked character stream. Modified the tests that were checking for lower case main program name. | 1 年前 | |
[flang] Submodules A submodule is a program unit that may contain the implementions of procedures declared in an ancestor module or submodule. Processing for the equivalence groups and variables declared in a submodule scope is similar to existing processing for the equivalence groups and variables in module and procedure scopes. However, module and procedure scopes are tied directly to code in the Pre-FIR Tree (PFT), whereas processing for a submodule must have access to an ancestor module scope that is guaranteed to be present in a .mod file, but is not guaranteed to be in the PFT. This difference is accommodated by tying processing directly to a front end scope. Function scopes that can be processed on the fly are done that way; the resulting variable information is never stored. Module and submodule scopes whose symbol information may be needed during lowering of any number of module procedures are instead cached on first use, and reused as needed. These changes are a direct extension of current code. All module and submodule variables in scope are processed, whether referenced or not. A possible alternative would be to instead process symbols only when first used. While this could ultimately be beneficial, such an approach must account for the presence of equivalence groups. That information is not currently available for on-the-fly variable processing. Some additional changes are needed to include submodules in places where modules must be considered, and to include separate module procedures in places where other subprogram variants are considered. There is also a fix for a bug involving the use of variables in an equivalence group in a namelist group, which also involves scope processing code. | 3 年前 | |
[flang] Fix optional assertion in PFTBuilder D142279 enabled assertion in libstdc++ and one was triggered in the PFTBuilder because an optional was access even if it was null. This patch fix this issue and add a regression test. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D143589 | 3 年前 | |
[flang] Add support for lowering directives at the CONTAINS level (#95123) There is currently support for lowering directives that appear outside of a module or procedure, or inside the body of a module or procedure. Extend this to support directives at the CONTAINS level of a module or procedure, such as directives 3, 5, 7 9, and 10 in: !dir$ some directive 1 module m !dir$ some directive 2 contains !dir$ some directive 3 subroutine p !dir$ some directive 4 contains !dir$ some directive 5 subroutine s1 !dir$ some directive 6 end subroutine s1 !dir$ some directive 7 subroutine s2 !dir$ some directive 8 end subroutine s2 !dir$ some directive 9 end subroutine p !dir$ some directive 10 end module m !dir$ some directive 11 This is done by looking for CONTAINS statements at the module or procedure level, while ignoring CONTAINS statements at the derived type level. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Main program symbol no longer conflicts with the other symbols (#149169) The following code is now accepted: module m end program m use m end The PROGRAM name doesn't really have an effect on the compilation result, so it shouldn't result in symbol name conflicts. This change makes the main program symbol name all uppercase in the cooked character stream. This makes it distinct from all other symbol names that are all lowercase in cooked character stream. Modified the tests that were checking for lower case main program name. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Update f128 tests Update test that require flang-supports-f128-math after #126929. | 1 年前 | |
[flang] Make REAL/COMPLEX(10) a hard error for non-x86 targets (#124655) Currently the use of REAL/COMPLEX(KIND=10) as a type or literal constant suffix elicits an optional warning message only. This leads to compiler internal errors during lowering when these types appear in code being compiled to non-x86_64 targets. For better error messaging, make the use of these types a hard error in semantics instead when they are not supported by the target architecture. | 1 年前 | |
[mlir][flang] add fast math attribute to fcmp (#74315) llvm.fcmp does support fast math attributes therefore so should arith.cmpf. The heavy churn in flang tests are because flang sets fastmath<contract> by default on all operations that support the fast math interface. Downstream users of MLIR should not be so effected. This was requested in https://github.com/llvm/llvm-project/issues/74263 | 2 年前 | |
[flang] Support -f[no-]realloc-lhs. (#120165) -frealloc-lhs is the default. If -fno-realloc-lhs is specified, then an allocatable on the left side of an intrinsic assignment is not implicitly (re)allocated to conform with the right hand side. Fortran runtime will issue an error if there is a mismatch in shape/type/allocation-status. | 1 年前 | |
| 1 年前 | ||
[flang] Fixed repacking for TARGET and INTENT(OUT) (#131972) TARGET dummy arrays can be accessed indirectly, so it is unsafe to repack them. INTENT(OUT) dummy arrays that require finalization on entry to their subroutine must be copied-in by fir.pack_arrays. In addition, based on my testing results, I think it will be useful to document that LOC and IS_CONTIGUOUS will have different values for the repacked arrays. I still need to decide where to document this, so just added a note in the design doc for the time being. | 1 年前 | |
[flang] Fixed repacking for TARGET and INTENT(OUT) (#131972) TARGET dummy arrays can be accessed indirectly, so it is unsafe to repack them. INTENT(OUT) dummy arrays that require finalization on entry to their subroutine must be copied-in by fir.pack_arrays. In addition, based on my testing results, I think it will be useful to document that LOC and IS_CONTIGUOUS will have different values for the repacked arrays. I still need to decide where to document this, so just added a note in the design doc for the time being. | 1 年前 | |
[flang] Defined SafeTempArrayCopyAttrInterface for array repacking. (#134346) This patch defines fir::SafeTempArrayCopyAttrInterface and the corresponding OpenACC/OpenMP related attributes in FIR dialect. The actual implementations are just placeholders right now, and array repacking becomes a no-op if -fopenacc/-fopenmp is used for the compilation. | 1 年前 | |
[flang] Fixed repacking for TARGET and INTENT(OUT) (#131972) TARGET dummy arrays can be accessed indirectly, so it is unsafe to repack them. INTENT(OUT) dummy arrays that require finalization on entry to their subroutine must be copied-in by fir.pack_arrays. In addition, based on my testing results, I think it will be useful to document that LOC and IS_CONTIGUOUS will have different values for the repacked arrays. I still need to decide where to document this, so just added a note in the design doc for the time being. | 1 年前 | |
[flang] Added driver options for arrays repacking. (#134002) Added options: * -f[no-]repack-arrays * -f[no-]stack-repack-arrays * -frepack-arrays-contiguity=whole/innermost | 1 年前 | |
[flang] Main program symbol no longer conflicts with the other symbols (#149169) The following code is now accepted: module m end program m use m end The PROGRAM name doesn't really have an effect on the compilation result, so it shouldn't result in symbol name conflicts. This change makes the main program symbol name all uppercase in the cooked character stream. This makes it distinct from all other symbol names that are all lowercase in cooked character stream. Modified the tests that were checking for lower case main program name. | 1 年前 | |
[flang] Use hlfir.cmpchar for SELECT CASE of charsSelect case hlfir cmpchar (#168476) For SELECT CASE with character selector, instead of allways calling runtime comparison function, emit hlfir.cmpchar. This has different behaviors at different optimization levels: at -O0, it still emits flang-rt call, but at higher optimization levels it does inline comparison. Modify test/Lower/select-case-statement.f90 to test both comparison cases. | 8 个月前 | |
[flang] add option to generate runtime type info as external (#146071) Reland #145901 with a fix for shared library builds. So far flang generates runtime derived type info global definitions (as opposed to declarations) for all the types used in the current compilation unit even when the derived types are defined in other compilation units. It is using linkonce_odr to achieve derived type descriptor address "uniqueness" aspect needed to match two derived type inside the runtime. This comes at a big compile time cost because of all the extra globals and their definitions in apps with many and complex derived types. This patch adds and experimental option to only generate the rtti definition for the types defined in the current compilation unit and to only generate external declaration for the derived type descriptor object of types defined elsewhere. Note that objects compiled with this option are not compatible with object files compiled without because files compiled without it may drop the rtti for type they defined if it is not used in the compilation unit because of the linkonce_odr aspect. I am adding the option so that we can better measure the extra cost of the current approach on apps and allow speeding up some compilation where devirtualization does not matter (and the build config links to all module file object anyway). | 1 年前 | |
[flang] Do not produce result for void runtime call (#123155) Runtime function call to a void function are producing a ssa value because the FunctionType result is set to NoneType with is later translated to a empty struct. This is not an issue when going to LLVM IR but it breaks when lowering a gpu module to PTX. This patch update the RTModel to correctly set the FunctionType result type to nothing. This is one runtime call before this patch at the LLVM IR dialect step. %45 = llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> !llvm.struct<()> After the patch the call would be correctly formed llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> () Without the patch it would lead to error like: ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 10; error : Output parameter cannot be an incomplete array. ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 125; error : Call has wrong number of parameters The change is pretty much mechanical. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Fixed shape computation for elementals with optional dummys. It looks like a regression after D151737: shape of the elemental call became rank-0. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D156386 | 2 年前 | |
[flang] replace fir.complex usages with mlir complex (#110850) Core patch of https://discourse.llvm.org/t/rfc-flang-replace-usages-of-fir-complex-by-mlir-complex-type/82292. After that, the last step is to remove fir.complex from FIR types. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Do not produce result for void runtime call (#123155) Runtime function call to a void function are producing a ssa value because the FunctionType result is set to NoneType with is later translated to a empty struct. This is not an issue when going to LLVM IR but it breaks when lowering a gpu module to PTX. This patch update the RTModel to correctly set the FunctionType result type to nothing. This is one runtime call before this patch at the LLVM IR dialect step. %45 = llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> !llvm.struct<()> After the patch the call would be correctly formed llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> () Without the patch it would lead to error like: ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 10; error : Output parameter cannot be an incomplete array. ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 125; error : Call has wrong number of parameters The change is pretty much mechanical. | 1 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang][nfc] Use llvm memmove intrinsic over regular call (#134294) Follow up to #134170. We should be using the LLVM intrinsics instead of plain fir.calls when we can. Existing code creates a declaration for the llvm intrinsic and a regular fir.call, which makes it hard for consumers of the IR to find all the intrinsic calls. | 1 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[Flang][Lower] NFC: Update target-features/target-cpu tests (#80984) Previously, some of these lowering tests inadvertently relied on a default triple not introducing any target features. This caused failures when compiling on a ppc64le-linux-unknown-gnu system. This patch updates these lowering tests to always explicitly set the target triple and check that the -target-cpu and -target-features compiler options are processed as expected. | 2 年前 | |
[Flang][Lower] NFC: Update target-features/target-cpu tests (#80984) Previously, some of these lowering tests inadvertently relied on a default triple not introducing any target features. This caused failures when compiling on a ppc64le-linux-unknown-gnu system. This patch updates these lowering tests to always explicitly set the target triple and check that the -target-cpu and -target-features compiler options are processed as expected. | 2 年前 | |
[flang]Zero Initialize simple types Instead of filling uninitialized global variables with "undef", initialize them with 0. Only for Integer, Float or Logical type variables. Complex, user defined data structures, arrays, etc are not supported at this point. This patch fixes the main problem of https://github.com/llvm/llvm-project/issues/62432 Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D149877 | 3 年前 | |
[flang] Represent TARGET for globals with 'target' attribute. TARGET dummy arguments have fir.target attribute attached to them, but globals do not have any sign of TARGET. This patch adds target attribute for globals, which can be queried via ::fir::GlobalOp::getTarget(). Differential Revision: https://reviews.llvm.org/D135313 | 3 年前 | |
[Flang][OpenMP][MLIR] Lowering of reduction,inreduction, nogroup and lastprivate clause to MLIR (#166751) This patch add MLIR lowering support for nogroup, reduction, inreduction and lastprivate clauses of taskloop directive. | 8 个月前 | |
[Flang][OpenMP][MLIR] Lowering of reduction,inreduction, nogroup and lastprivate clause to MLIR (#166751) This patch add MLIR lowering support for nogroup, reduction, inreduction and lastprivate clauses of taskloop directive. | 8 个月前 | |
[flang] Do not produce result for void runtime call (#123155) Runtime function call to a void function are producing a ssa value because the FunctionType result is set to NoneType with is later translated to a empty struct. This is not an issue when going to LLVM IR but it breaks when lowering a gpu module to PTX. This patch update the RTModel to correctly set the FunctionType result type to nothing. This is one runtime call before this patch at the LLVM IR dialect step. %45 = llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> !llvm.struct<()> After the patch the call would be correctly formed llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> () Without the patch it would lead to error like: ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 10; error : Output parameter cannot be an incomplete array. ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 125; error : Call has wrong number of parameters The change is pretty much mechanical. | 1 年前 | |
[Flang] Generate math.sinh op for single and double precision sinh (#162734) Fixes issue with double precision sinh when using OpenMP offloading with AMD GPUs. The machinery to convert the op to a ROCDL call is already in place. https://github.com/llvm/llvm-project/issues/162733 | 9 个月前 | |
[flang][test] Fix mtune test on AArch64 bots The native architecture is AArch64 here so the pentium name won't work even if you've got the x86 backend enabled. https://lab.llvm.org/buildbot/#/builders/17/builds/898 Pass an explicit target for each run line to fix this. Test added in f1d3fe7aae7867b5de96b84d6d26b5c9f02f209a / #98517 | 2 年前 | |
| 11 个月前 | ||
[flang] Implement !DIR$ UNROLL [N] (#123331) This patch implements support for the UNROLL directive to control how many times a loop should be unrolled. It must be placed immediately before a DO LOOP and applies only to the loop that follows. N is an integer that specifying the unrolling factor. This is done by adding an attribute to the branch into the loop in LLVM to indicate that the loop should unrolled. The code pushed to support the directive VECTOR ALWAYS has been modified to take account of the fact that several directives can be used before a DO LOOP. | 1 年前 | |
[flang] Implement !DIR$ NOVECTOR and !DIR$ NOUNROLL[_AND_JAM] (#133885) Hi, This patch implements support for the following directives : - !DIR$ NOUNROLL_AND_JAM to disable unrolling and jamming on a DO LOOP. - !DIR$ NOUNROLL to disable unrolling on a DO LOOP. - !DIR$ NOVECTOR to disable vectorization on a DO LOOP. | 1 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang][Lower] Emit exiting branches from within constructs (#92455) When lowering IfConstruct, CaseConstruct, and SelectTypeConstruct, emit branches that exit the construct in each block that is still unterminated after the FIR has been generated in it. The same thing may be needed for SelectRankConstruct, once it's supported. This eliminates the need for inserting branches in genFIR(Evaluation). Follow-up to PR https://github.com/llvm/llvm-project/pull/91614. | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang] Attach proper storage to [hl]fir.declare in lowering. (#155742) As described in https://discourse.llvm.org/t/rfc-flang-representation-for-objects-inside-physical-storage/88026, [hl]fir.declare should carry information about the layout of COMMON/EQUIVALENCE variables within the physical storage. This patch modifes Flang lowering to attach this information. | 10 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Implement !DIR$ NOVECTOR and !DIR$ NOUNROLL[_AND_JAM] (#133885) Hi, This patch implements support for the following directives : - !DIR$ NOUNROLL_AND_JAM to disable unrolling and jamming on a DO LOOP. - !DIR$ NOUNROLL to disable unrolling on a DO LOOP. - !DIR$ NOVECTOR to disable vectorization on a DO LOOP. | 1 年前 | |
[flang] Do not produce result for void runtime call (#123155) Runtime function call to a void function are producing a ssa value because the FunctionType result is set to NoneType with is later translated to a empty struct. This is not an issue when going to LLVM IR but it breaks when lowering a gpu module to PTX. This patch update the RTModel to correctly set the FunctionType result type to nothing. This is one runtime call before this patch at the LLVM IR dialect step. %45 = llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> !llvm.struct<()> After the patch the call would be correctly formed llvm.call @_FortranAAssign(%arg0, %1, %44, %4) : (!llvm.ptr, !llvm.ptr, !llvm.ptr, i32) -> () Without the patch it would lead to error like: ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 10; error : Output parameter cannot be an incomplete array. ptxas /tmp/mlir-cuda_device_mod-nvptx64-nvidia-cuda-sm_60-e804b6.ptx, line 125; error : Call has wrong number of parameters The change is pretty much mechanical. | 1 年前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang] Fix volatile attribute propagation on allocatables (#139183) Ensure volatility is reflected not just on the reference to an allocatable, but on the box, too. When we declare a volatile allocatable, we now get a volatile reference to a volatile box. Some related cleanups: * SELECT TYPE constructs check the selector's type for volatility when creating and designating the type used in the selecting block. * Refine the verifier for fir.convert. In general, I think it is ok to implicitly drop volatility in any ptr-to-int conversion because it means we are in codegen (and representing volatility on the LLVM ops and intrinsics) or we are calling an external function (are there any cases I'm not thinking of?) * An allocatable test that was XFAILed is now passing. Making allocatables' boxes volatile resulted in accesses of those boxes being volatile, which resolved some errors coming from the strict verifier. * I noticed a runtime function was missing the fir.runtime attribute. | 1 年前 | |
[flang] Lower volatile class types (#138607) So far, only boxes and references have had their volatile attribute set during lowering. This patch enables the volatility of classes to be properly represented in the ir, same as box and ref. For simple cases, not much needs to change in the codegen or conversion patterns because the prior work on volatile refs/boxes propagates volatility already. I am running further testing with the strict verification enabled to find remaining cases of incorrect/missing volatile propagation. | 1 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[Flang][OpenMP][MLIR] Initial declare target to for variables implementation (#119589) While the infrastructure for declare target to/enter and link for variables exists in the MLIR dialect and at the Flang level, the current lowering from MLIR -> LLVM IR isn't in place, it's only in place for variables that have the link clause applied. This PR aims to extend that lowering to an initial implementation that incorporates declare target to as well, which primarily requires changes in the OpenMPToLLVMIRTranslation phase. However, a minor addition to the OpenMP dialect was required to extend the declare target enumerator to include a default None field as well. This also requires a minor change to the Flang lowering's MapInfoFinlization.cpp pass to alter the map type for descriptors to deal with cases where a variable is marked declare to. Currently, when a descriptor variable is mapped declare target to the descriptor component can become attatched, and cannot be updated, this results in issues when an unusual allocation range is specified (effectively an off-by X error). The current solution is to map the descriptor always, as we always require an up-to-date version of this data. However, this also requires an interlinked PR that adds a more intricate type of mapping of structures/record types that clang currently implements, to circumvent the overwriting of the pointer in the descriptor. 3/3 required PRs to enable declare target to mapping, this PR should pass all tests and provide an all green CI. Co-authored-by: Raghu Maddhipatla raghu.maddhipatla@amd.com | 8 个月前 | |
[flang][NFC] Strip trailing whitespace from tests (8 of N) Only some fortran source files in flang/test/Lower have been modified. The other files in the directory will be cleaned up in subsequent commits | 8 个月前 | |
[flang][openmp] Propagate volatile on reduction variables (#142435) Reference types were being constructed from openmp private clauses without propagating volatility. Fix this by checking the volatility of the original variable and add a test. | 1 年前 | |
[flang][debug] Track dummy argument positions explicitly. (#167489) CHARACTER dummy arguments were treated as local variables in debug info. This happened because our method to get the argument number was not robust. It relied on DeclareOp having a direct reference to arguments which was not the case for character arguments. This is fixed by storing source-level argument positions in DeclareOp. Fixes #112886 | 8 个月前 | |
[flang] Hide strict volatility checks behind flag (#138183) Enabling volatility lowering by default revealed some issues in lowering and op verification. For example, given volatile variable of a nested type, accessing structure members of a structure member would result in a volatility mismatch when the inner structure member is designated (and thus a verification error at compile time). In other cases, I found correct codegen when the checks were disabled, also related to allocatable types and how we handle volatile references of boxes. This hides the strict verification of fir and hlfir ops behind a flag so I can iteratively improve lowering of volatile variables without causing compile-time failures, keeping the strict verification on when running tests. | 1 年前 | |
[flang] Hide strict volatility checks behind flag (#138183) Enabling volatility lowering by default revealed some issues in lowering and op verification. For example, given volatile variable of a nested type, accessing structure members of a structure member would result in a volatility mismatch when the inner structure member is designated (and thus a verification error at compile time). In other cases, I found correct codegen when the checks were disabled, also related to allocatable types and how we handle volatile references of boxes. This hides the strict verification of fir and hlfir ops behind a flag so I can iteratively improve lowering of volatile variables without causing compile-time failures, keeping the strict verification on when running tests. | 1 年前 | |
[flang] simplify pointer assignments (#168732) Pointer assignment lowering was done in different ways depending on contexts and types, sometimes still using runtime calls when this is not needed and the complexity of doing this inline is very limited (the pointer and target descriptors were already prepared inline, the runtime is just doing the descriptor assignment and ensuring the pointer descriptor keep its pointer flag). Slightly extent the inline version that was used for Forall and use it for all cases. When lowering without HLFIR is removed, this will allow removing more code. | 8 个月前 | |
[flang] simplify pointer assignments (#168732) Pointer assignment lowering was done in different ways depending on contexts and types, sometimes still using runtime calls when this is not needed and the complexity of doing this inline is very limited (the pointer and target descriptors were already prepared inline, the runtime is just doing the descriptor assignment and ensuring the pointer descriptor keep its pointer flag). Slightly extent the inline version that was used for Forall and use it for all cases. When lowering without HLFIR is removed, this will allow removing more code. | 8 个月前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[mlir][flang] add fast math attribute to fcmp (#74315) llvm.fcmp does support fast math attributes therefore so should arith.cmpf. The heavy churn in flang tests are because flang sets fastmath<contract> by default on all operations that support the fast math interface. Downstream users of MLIR should not be so effected. This was requested in https://github.com/llvm/llvm-project/issues/74263 | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
[flang][NFC] Use hlfir=false and flang-deprecated-no-hlfir in legacy tests (#71957) Patch 2/3 of the transition step 1 described in https://discourse.llvm.org/t/rfc-enabling-the-hlfir-lowering-by-default/72778/7. All the modified tests are still here since coverage for the direct lowering to FIR was still needed while it was default. Some already have an HLFIR version, some have not and will need to be ported in step 2 described in the RFC. Note that another 147 lit tests use -emit-fir/-emit-llvm outputs but do not need a flag since the HLFIR/no HLFIR output is the same for what is being tested. | 2 年前 | |
| 1 年前 | ||
| 1 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 9 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 4 年前 | ||
| 2 年前 | ||
| 10 个月前 | ||
| 4 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 2 年前 | ||
| 4 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 4 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 4 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 4 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 1 年前 | ||
| 11 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 10 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 11 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 4 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 11 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 4 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 4 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 4 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 10 个月前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 10 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 9 个月前 | ||
| 8 个月前 | ||
| 3 年前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 10 个月前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 10 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 10 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 10 个月前 | ||
| 3 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 4 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 2 年前 | ||
| 11 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 10 个月前 | ||
| 2 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 |