Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flang] Add runtime interface for NUM_IMAGES #1076

Open
wants to merge 1,158 commits into
base: fir-dev
Choose a base branch
from
This pull request is big! We’re only showing the most recent 250 commits.

Commits on Jul 22, 2021

  1. Merge branch 'fir-dev' of https://github.com/flang-compiler/f18-llvm-…

    …project into fir-dev
    
    Getting ready to merge changes for the CSHIFT intrinsic.
    psteinfeld committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    c121e87 View commit details
    Browse the repository at this point in the history
  2. [flang] Implement the lowering portion of the CSHIFT intrinsic

    This change implements the lowering runtime portion of the CSHIFT
    intrinsic.  The implementation of the runtime was done in revision
    D106292.
    psteinfeld committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    ca8245a View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#937 from flang-compiler/ps-cshift

    [flang] Implement the lowering portion of the CSHIFT intrinsic
    psteinfeld authored Jul 22, 2021
    Configuration menu
    Copy the full SHA
    23d2f3e View commit details
    Browse the repository at this point in the history
  4. Merge pull request flang-compiler#914 from banach-space/andrzej/dot_p…

    …roduct
    
    Add lowering for the DOT_PRODUCT intrinsic
    
    I confirmed that it builds and runs without issue (regression tests pass and an end-to-end dot product test runs correctly too). Thanks @banach-space !
    mleair authored Jul 22, 2021
    Configuration menu
    Copy the full SHA
    be011ea View commit details
    Browse the repository at this point in the history
  5. Lowering for the Matmul Intrinsic

    Initial implementation with assumption that rank will be always 2
    kiranchandramohan committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    019b009 View commit details
    Browse the repository at this point in the history
  6. [flang] Remove an unneeded call to createBox

    In processing the UNPACK intrinsic, my implementation had an unneeded
    extra call to createBox().  This change removes it.
    psteinfeld committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    0c69f27 View commit details
    Browse the repository at this point in the history
  7. Fixes to address TODOs and review comments

    -> Handle case where rank of one the matrices is 1.
    -> Add test for the above case with logical type.
    -> Remove return value from the matmul call.
    kiranchandramohan committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    dbe480d View commit details
    Browse the repository at this point in the history
  8. [flang] Implement the runtime portion of the CSHIFT intrinsic

    This change fixes a bug in  the runtime portion of the CSHIFT intrinsic
    that happens when the value of the SHIFT argument is negative.
    
    Differential Revision: https://reviews.llvm.org/D106292
    psteinfeld committed Jul 22, 2021
    Configuration menu
    Copy the full SHA
    e80fbf3 View commit details
    Browse the repository at this point in the history
  9. Merge pull request flang-compiler#940 from flang-compiler/ps-fix-unpack

    [flang] Remove an unneeded call to createBox
    psteinfeld authored Jul 22, 2021
    Configuration menu
    Copy the full SHA
    651a3be View commit details
    Browse the repository at this point in the history

Commits on Jul 23, 2021

  1. Merge pull request flang-compiler#938 from flang-compiler/jpr-host-as…

    …soc-review-comments
    
    [NFC] address comments from flang-compiler#907
    jeanPerier authored Jul 23, 2021
    Configuration menu
    Copy the full SHA
    90cb2d6 View commit details
    Browse the repository at this point in the history
  2. Lower default initialization of local and dummy entities

    When instantiating variables, identify the ones that must be default
    initialized at runtime (locals and intent(out) dummies). Call the
    default initialization runtime routine to perform the initialization.
    
    Global variables that have no explicit initialization and have a default
    initialization are left TODO. The runtime cannot be used for them, the
    fir.global generation will need to be updated for these variables (it was
    generating an undefined undefined until now). For now, simply catch and
    add a hard TODO for these cases. For information, it is firing 13 times
    in NAG F95 tests.
    
    Runtime interface for finalization is added, but nothing is done with it
    yet (Final procedures are not F95).
    jeanPerier committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    896c6b3 View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#939 from flang-compiler/jpr-derived…

    …-type-init-2
    
    Lower default initialization of local and dummy entities
    jeanPerier authored Jul 23, 2021
    Configuration menu
    Copy the full SHA
    776a3da View commit details
    Browse the repository at this point in the history
  4. Merge pull request flang-compiler#791 from Leporacanthicus/modifiers

    [OpenMP][Flang]Add support for modifiers monotonic and non-monotonic
    schweitzpgi authored Jul 23, 2021
    Configuration menu
    Copy the full SHA
    18b0621 View commit details
    Browse the repository at this point in the history
  5. Fix fir.alloca codegen for array with dynamic type parameters

    Also insert casts in fir.array_coor op (error revealed by the first fix).
    jeanPerier committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    c424f04 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2021

  1. Merge pull request flang-compiler#943 from flang-compiler/jpr-alloca-…

    …issue
    
    Fix fir.alloca codegen for array with dynamic type parameters
    jeanPerier authored Jul 26, 2021
    Configuration menu
    Copy the full SHA
    8abd290 View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2021

  1. Fix issue flang-compiler#917.

    It does not make sense to embox a box. Instead we can convert the box's
    signature with a fir.convert, which is idempotent on the boxed value.
    schweitzpgi committed Jul 27, 2021
    Configuration menu
    Copy the full SHA
    b5bb1ef View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2021

  1. [flang] Disallow BOZ literal constants as arguments of implicit inter…

    …faces
    
    Since BOZ literal arguments are typeless, we cannot know how to pass them as
    actual arguments to procedures with implicit interfaces.  This change avoids
    the problem by emitting an error message in such situations.
    
    This change stemmed from the following issue --
      flang-compiler#794
    
    Differential Revision: https://reviews.llvm.org/D106831
    psteinfeld committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    59e67a2 View commit details
    Browse the repository at this point in the history
  2. [flang] Disallow BOZ literal constants as output list items

    According to C7109, "A boz-literal-constant shall appear only as a
    data-stmt-constant in a DATA statement, or where explicitly allowed in
    16.9 as an actual argument of an intrinsic procedure."  This change
    enforces that constraint for output list items.
    
    I also added a general interface to determine if an expression is a BOZ
    literal constant and changed all of the places I could find where it
    could be used.
    
    I also added a test.
    
    This change stemmed from the following issue --
      https://gitlab-master.nvidia.com/fortran/f18-stage/issues/108
    
    Differential Revision: https://reviews.llvm.org/D106893
    psteinfeld committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    f3a7726 View commit details
    Browse the repository at this point in the history
  3. [flang] runtime: fix problems with I/O around EOF & delimited characters

    When a WRITE overwrites an endfile record, we need to forget
    that there was an endfile record.  When doing a BACKSPACE
    after an explicit ENDFILE statement, the position afterwards
    must be upon the endfile record.
    
    Attempts to join list-directed delimited character input across
    record boundaries was due to a bad reading of the standard
    and has been deleted, now that the requirements are better understood.
    This problem would cause a read attempt past EOF if a delimited
    character input value was at the end of a record.
    
    It turns out that delimited list-directed (and NAMELIST) character
    output is required to emit contiguous doubled instances of the
    delimiter character when it appears in the output value.  When
    fixed-size records are being emitted, as is the case with internal
    output, this is not possible when the problematic character falls
    on the last position of a record.  No two other Fortran compilers
    do the same thing in this situation so there is no good precedent
    to follow.
    
    Because it seems least wrong, with this patch we now emit one copy
    of the delimiter as the last character of the current record and
    another as the first character of the next record.  (The
    second-least-wrong alternative might be to flag a runtime error,
    but that seems harsh since it's not an explicit error in the standard,
    and the output may not have to be usable later as input anyway.)
    Consequently, the output is not suitable for use as list-directed or
    NAMELIST input.
    
    If a later standard were to clarify this case, this behavior will of
    course change as needed to conform.
    
    Differential Revision: https://reviews.llvm.org/D106695
    klausler authored and vdonaldson committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    4a3d98a View commit details
    Browse the repository at this point in the history
  4. [flang] Runtime: Reset list-directed input state for each NAMELIST item

    NAMELIST I/O formatting uses the runtime infrastructure for
    list-directed I/O.  List-directed input processing has same state
    that requires reinitialization for each successive NAMELIST input
    item.  This patch fixes bugs with "null" items and repetition counts
    on NAMELIST input items after the first in the group.
    
    Differential Revision: https://reviews.llvm.org/D106694
    klausler authored and vdonaldson committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    2f1c330 View commit details
    Browse the repository at this point in the history
  5. Merge pull request flang-compiler#947 from vdonaldson/vkd2

    cherry pick runtime I/O fixes for namelist array input, backspace, rewind
    vdonaldson authored Jul 28, 2021
    Configuration menu
    Copy the full SHA
    9065951 View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2021

  1. Configuration menu
    Copy the full SHA
    b209722 View commit details
    Browse the repository at this point in the history
  2. Merge pull request flang-compiler#931 from kiranchandramohan/matmul

    Lowering for the Matmul Intrinsic
    schweitzpgi authored Jul 29, 2021
    Configuration menu
    Copy the full SHA
    cea71dc View commit details
    Browse the repository at this point in the history
  3. [flang][nfc] Move tests from intrinsic-procedures.f90 to dedicated files

    All tests from flang/test/Lower/intrinsic-procedures.f90 are moved to
    dedicated files (with the exception of `lge`, `lgt`, `lle` and `llt`).
    With this change, every filename clearly defines which intrinsic
    procedure is being tested.
    
    After the initial split, we discovered that some tests were invalid
    (e.g.  `! CHECK` was used instead of `! CHECK:`). These tests are now
    fixed. Some tests are additionally hardened (e.g. some `CHECK-DAG`
    directives was replaced with `CHECK`). Some tests are updated with
    checks generated with mlir/utils/generate-test-checks.py. In other
    words, this patch _moves_ and _reformats_ the tests.
    
    The documentation is updated accordingly (with some extra
    clarifications, as suggested by the reviewers).
    
    Please see the following PRs for a complete discussion:
    * flang-compiler#927
    * flang-compiler#914
    banach-space committed Jul 29, 2021
    Configuration menu
    Copy the full SHA
    e4e9534 View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2021

  1. Merge pull request flang-compiler#927 from banach-space/andrzej/separ…

    …ate_tests
    
    [flang][nfc] Move tests from intrinsic-procedures.f90 to dedicated files
    schweitzpgi authored Jul 30, 2021
    Configuration menu
    Copy the full SHA
    3cedc9c View commit details
    Browse the repository at this point in the history
  2. Fix the verify test.

    schweitzpgi committed Jul 30, 2021
    Configuration menu
    Copy the full SHA
    9ba7afe View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#955 from schweitzpgi/ch-verify

    Fix the verify test.
    schweitzpgi authored Jul 30, 2021
    Configuration menu
    Copy the full SHA
    4b9d243 View commit details
    Browse the repository at this point in the history
  4. Delete code that was redundantly removing the elided extents before t…

    …he builder elided those extents.
    
    Fixes flang-compiler#942.
    schweitzpgi committed Jul 30, 2021
    Configuration menu
    Copy the full SHA
    d3c32a4 View commit details
    Browse the repository at this point in the history
  5. Merge pull request flang-compiler#956 from flang-compiler/ch-ch5egs

    Delete code that was redundantly removing the elided extents before t…
    schweitzpgi authored Jul 30, 2021
    Configuration menu
    Copy the full SHA
    b4e472a View commit details
    Browse the repository at this point in the history
  6. Cherry pick from llvm-main, the runtime fixes for MAXLOC runtime erro…

    …r with
    
    a scalar result.
    
    See the following Phabricator review for more information:
    
    https://reviews.llvm.org/D106820
    mleair committed Jul 30, 2021
    Configuration menu
    Copy the full SHA
    55e391e View commit details
    Browse the repository at this point in the history
  7. Merge pull request flang-compiler#957 from flang-compiler/ml-fix-loc

    Cherry pick from llvm-main, the runtime error fixes for MAXLOC
    mleair authored Jul 30, 2021
    Configuration menu
    Copy the full SHA
    68cb255 View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2021

  1. Configuration menu
    Copy the full SHA
    3e75a5f View commit details
    Browse the repository at this point in the history
  2. Lowering FORALL statement and FORALL construct with scalar, array, an…

    …d WHERE
    
    construct assignments.
    
    This patch includes changes to the bridge, array expression lowering, the array
    value copy transformation, some FIR ops, and tests. Code generation was tested
    end to end with the NAG F95 tests.
    
    The implementation raises (nested) FORALL constructs (statements) into array
    expression form. This means that array expressions and FORALL constructs will
    be presented to the optimizer with the same structure. There are some notable
    differences between FORALLs and array expressions that required extending the
    array framework.
    
      - An array expression is isomorphic between the iteration space and the
        access expressions. FORALL need not be.
      - An array expression is limited by the standard to operate upon exactly
        one ranked component in a designator. A FORALL assignment is, generally,
        not limited in this way.
      - WHERE constructs contain array expressions both as masks and in the
        construct blocks. FORALL constructs may contain scalar assignments,
        array assignments, other FORALL constructs, and WHERE constructs.
      - WHERE constructs have a cascading disjunctional conditional execution
        structure over entire array assignments on an elemental basis. The if-else
        cascade is evaluated in program order. FORALL masks have a conjunctional
        conditional structure and do not, generally, have an elemental
        application but are a function of the user-defined iteration space. These
        two execution structures can be mixed with the FORALL case having
        priority.
    
    Despite these differences, these Fortran constructs share the "copy-in
    copy-out" execution model. See the standard for more information.
    
    After the array copy value transformation runs, FIR code will have the same
    fundamental structure for array assignments, WHERE constructs, FORALL
    constructs, FORALL/WHERE constructs, and DO CONCURRENT loops. (That is,
    the nominal "parallel" execution forms.)
    
    This patch does not address FORALL and assignment to POINTERs/ALLOCATABLEs. It
    also does not fix bugs in arrays of CHARACTER or derived types.
    
    + Respond to review comments.
    schweitzpgi committed Aug 3, 2021
    Configuration menu
    Copy the full SHA
    79dd7cc View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#954 from schweitzpgi/ch-forall

    Lowering FORALL statement and FORALL construct with scalar, array, an…
    schweitzpgi authored Aug 3, 2021
    Configuration menu
    Copy the full SHA
    4a718fa View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2021

  1. [flang][msvc] Fix external-io unittest.

    Fix the external-io unittest under Windows.
    
    In particular, fixes the following issues:
    
     1.  When creating a temporary file, open it with read+write permissions
         using the _O_RDWR flag. _S_IREAD and _S_IWRITE are for the file
         permissions of the created file.
    
     2. _chsize returns 0 on success (just like ftruncate).
    
     3. To set a std::optional, use its assign-operator overload instead of
        getting a reference to its value and overwrite that. The latter is
        invalid if the std::optional has no value, and is caught by
        msvc's debug STL.
    
    The non-GTest unittest is currently not executed under Windows because
    of the added .exe extension to the output file: external-io.text.exe.
    llvm-lit skips the file because .exe is not in the lists of test
    suffixes (.test is). D105315 is going to change that by converting it
    to a GTest-test.
    
    Reviewed By: awarzynski
    
    Differential Revision: https://reviews.llvm.org/D106726
    Meinersbur authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    f73a32e View commit details
    Browse the repository at this point in the history
  2. [flang] Disallow BOZ literal constants as arguments of implicit inter…

    …faces
    
    Since BOZ literal arguments are typeless, we cannot know how to pass them as
    actual arguments to procedures with implicit interfaces.  This change avoids
    the problem by emitting an error message in such situations.
    
    This change stemmed from the following issue --
      flang-compiler#794
    
    Differential Revision: https://reviews.llvm.org/D106831
    psteinfeld authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    6f129d1 View commit details
    Browse the repository at this point in the history
  3. [flang] Fix thinko in CPU_TIME test

    We used to test that end > start, but it can well be >= (otherwise the
    loop doesn't make sense).
    rovka authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    5c741a0 View commit details
    Browse the repository at this point in the history
  4. [flang] Fix minor style issues. NFC

    rovka authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    1d519a1 View commit details
    Browse the repository at this point in the history
  5. [flang] Disallow BOZ literal constants as output list items

    According to C7109, "A boz-literal-constant shall appear only as a
    data-stmt-constant in a DATA statement, or where explicitly allowed in
    16.9 as an actual argument of an intrinsic procedure."  This change
    enforces that constraint for output list items.
    
    I also added a general interface to determine if an expression is a BOZ
    literal constant and changed all of the places I could find where it
    could be used.
    
    I also added a test.
    
    This change stemmed from the following issue --
      https://gitlab-master.nvidia.com/fortran/f18-stage/issues/108
    
    Differential Revision: https://reviews.llvm.org/D106893
    psteinfeld authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    06c5237 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    7c54696 View commit details
    Browse the repository at this point in the history
  7. Fix runtime internal error with certain intrinsics that can take a sc…

    …alar
    
    result descriptor (e.g., maxloc, minloc, maxval, minval, all, any, count,
    parity, findloc, etc.)
    
    Also add a scalar case for these intrinsic unit tests.
    
    Differential Revision: https://reviews.llvm.org/D106820
    mleair authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    f60bea0 View commit details
    Browse the repository at this point in the history
  8. Fix unit test checks for the scalar cases of all/any intrinsics. I

    accidentally used int64 when they should have been int32. This lead to
    a Windows build unit test error (Linux did not catch the problem).
    
    Differential Revision: https://reviews.llvm.org/D107107
    mleair authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    a43745a View commit details
    Browse the repository at this point in the history
  9. Fix scalar unit tests for all, any, maxloc, etc. that caused the ARM …

    …build
    
    to fail due to warnings as errors. Note that I could not reproduce the
    problem locally, but based on the messages, I think this change will fix
    the errors.
    
    Differential Revision: https://reviews.llvm.org/D107120
    mleair authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    79188b8 View commit details
    Browse the repository at this point in the history
  10. [flang] Fix IsSimplyContiguous() for the case of a pointer component

    The result expression for the analysis of a Component is not (longer)
    valid in the expression traversal framework used by IsSimplyContiguousHelper
    now that it has a tri-state result.  Fix so that any result of
    analyzing the component symbol is required to be true, not just
    present.
    
    Differential Revision: https://reviews.llvm.org/D106693
    klausler authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    7f63ddc View commit details
    Browse the repository at this point in the history
  11. [flang] Symbol representation for dummy SubprogramDetails

    Dummy procedures can be defined as subprograms with explicit
    interfaces, e.g.
    
      subroutine subr(dummy)
        interface
          subroutine dummy(x)
            real :: x
          end subroutine
        end interface
        ! ...
      end subroutine
    
    but the symbol table had no means of marking such symbols as dummy
    arguments, so predicates like IsDummy(dummy) would fail.  Add an
    isDummy_ flag to SubprogramNameDetails, analogous to the corresponding
    flag in EntityDetails, and set/test it as needed.
    
    Differential Revision: https://reviews.llvm.org/D106697
    klausler authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    12201e2 View commit details
    Browse the repository at this point in the history
  12. [flang] Add missing FileSystem.h

    This file was previously included transitively via `mlir/Transforms/Passes.h`, but the include has been removed from that file.
    
    Differential Revision: https://reviews.llvm.org/D107455
    matthias-springer authored and jeanPerier committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    9b45d7a View commit details
    Browse the repository at this point in the history
  13. Squash 2 commits into 1.

    Add fir lowering for PACK intrinsic
    
    Replace unneeded CHECK-DAG with CHECK in pack regression test.
    mleair committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    c1d52b0 View commit details
    Browse the repository at this point in the history
  14. Merge pull request flang-compiler#962 from flang-compiler/ml-pack

    Add fir lowering for PACK intrinsic
    mleair authored Aug 4, 2021
    Configuration menu
    Copy the full SHA
    be5a626 View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2021

  1. Merge pull request flang-compiler#964 from flang-compiler/jpr-cherry-…

    …pick-all-fe-changes
    
    Cherry pick all changes in flang folder since last cherry-picking
    jeanPerier authored Aug 5, 2021
    Configuration menu
    Copy the full SHA
    d31b6da View commit details
    Browse the repository at this point in the history
  2. zero size common blocks (flang-compiler#965)

    Common blocks without explicit initialization are initialized with an
    mlir::VectorType initializer, which must have a strictly positive size:
    
      real nada(1:0)
      common /empty/ nada
    
      fir.global common @_QBempty(dense<0> : vector<0xi8>) : !fir.array<0xi8>
    
      error: vector types must have positive constant sizes
    
    An alternative is to instead initialize with a fir::SequenceType, but
    that leads to a tco error:
    
      fir.global common @_QBempty : !fir.array<0xi8> {
        %0 = fir.undefined !fir.array<0xi8>
        fir.has_value %0 : !fir.array<0xi8>
      }
    
      'common' global must have a zero initializer!
      [0 x i8]* @_QBempty
      error: could not emit LLVM-IR
    
    Work around these issues by forcing zero size common blocks to have one
    byte:
    
      fir.global common @_QBempty(dense<0> : vector<1xi8>) : !fir.array<1xi8>
    
    Note:  There is an additional front end bug where most zero size arrays
    are incorrectly given non-zero size.  This additional bug needs to be
    addressed to allow correct compilation of common blocks containing
    those arrays.
    vdonaldson authored Aug 5, 2021
    Configuration menu
    Copy the full SHA
    380e00d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4ac8682 View commit details
    Browse the repository at this point in the history
  4. Lower default initialization of global variables

    Add a genDefaultInitializerValue method in variable lowering that
    generates the body of the global op that must be default initialized.
    
    Default initialized defers from explicit initialization because all the
    component may not have an initialization, therefore the front-end is not
    providing a top level ev::Expr that can be lowered for the derived type.
    
    Hence, lowering visits each components and lower any default
    initialization if present or leave the component undefined otherwise.
    
    genDefaultInitializerValue is recursive because component without a
    default initialization value can be of a derived type whose component
    have default initialization.
    
    Default initialization also applies to variable in equivalences. The
    standard is not 100% clear about the possibility of mixing overlapping
    default and explicit initialization. This PR support full overlaps (the
    default initialization is completely overridden by explicit
    initialization of other equivalence members), no overlap (the default
    initialization is fully apply to the equivalence storage). It however
    does not support mixing pieces of explicit initialization from other
    equivalence members over part of the default initialization (the
    situation is detected and a TODO emitted). Not all compilers support
    this last case (nagfor, ifort and nvfortran support this, gfortran refuses it,
    and xlf silently ignores the explicit initialization).
    jeanPerier committed Aug 5, 2021
    Configuration menu
    Copy the full SHA
    73dc364 View commit details
    Browse the repository at this point in the history
  5. Merge pull request flang-compiler#963 from flang-compiler/jpr-derived…

    …-type-init-global-4
    
    Lower default initialization of module and saved variables
    jeanPerier authored Aug 5, 2021
    Configuration menu
    Copy the full SHA
    7184dd0 View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2021

  1. [flang] Implement lowering for the SIZE intrinsic

    Assumed-rank entities are not yet handled.
    
    No runtime call was needed.  Also, all situations where the DIM argument
    is not present are handled by the front end converting calls to SIZE
    with values of the DIM argument that correspond to the rank of the ARRAY
    argument.  Thus, if ARRAY has rank 1, a call to "SIZE(ARRAY)" is changed
    to "SIZE(ARRAY, 1)".  If ARRAY has rank 2, the call is changed to the
    expression "SIZE(ARRAY, 1) * SIZE(ARRAY, 2)".  Thus, the only thing I
    needed to do was convert the value of the DIM argument to be 1-based and
    make the appropriate call to BoxDimsOp.
    
    I also added a test.
    psteinfeld committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    1b76fae View commit details
    Browse the repository at this point in the history
  2. Merge pull request flang-compiler#966 from flang-compiler/ps-size

    [flang] Implement lowering for the SIZE intrinsic
    psteinfeld authored Aug 6, 2021
    Configuration menu
    Copy the full SHA
    183bc96 View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2021

  1. Ensure scalar args are lowered to ref if needed in elemental calls

    Scalars were args were lowered to value in elemental calls where they needed
    to be passed by reference. Lower scalar to a reference when the elemental function
    takes a reference. In case the elemental arg is passed by value, lower the arg by
    value and store the value in a temp that is passed to the call.
    
    This fixes the error "'llvm.call' op operand type mismatch for operand 1" in
    nag_f08_95 l7.f90 (similar error remains coming from non elemental context in
    some other tests)
    
    It is not 100% clear to me that the by address case is OK from an aliasing point
    of view (e.g. in `i = foo(j, i(10))` the current passing the raw address of i(10)
    at every iteration).
    jeanPerier committed Aug 9, 2021
    Configuration menu
    Copy the full SHA
    b546ab9 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2021

  1. [flang] Add default implementation for SYSTEM_CLOCK

    Add an implementation for the runtime functions related to SYSTEM_CLOCK.
    As with CPU_TIME, this is based on std::clock(), which should be
    available everywhere, but it is highly recommended to add
    platform-specific implementations for systems where std::clock() behaves
    poorly (e.g. POSIX).
    
    The documentation for std::clock() doesn't specify a maximum value and
    in fact wrap around behaviour is non-conforming.  Therefore, this
    implementation of SYSTEM_CLOCK is not guaranteed to wrap around either,
    and after std::clock reaches its maximum value we will likely just
    return failure rather than wrap around. If this happens often on your
    system, please add a new platform-specific implementation.
    
    We define COUNT_MAX as either the maximum value that can be stored in
    a std::clock_t or in a 64-bit integer (whichever is smaller), and
    COUNT_RATE as CLOCKS_PER_SEC. For POSIX systems, the value of
    CLOCKS_PER_SEC is hardcoded to 10^6 and irrelevant for the values
    returned by std::clock.
    
    Reviewed By: jeanPerier
    
    Differential Revision: https://reviews.llvm.org/D105969
    rovka authored and jeanPerier committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    c4454f0 View commit details
    Browse the repository at this point in the history
  2. [flang] Add POSIX implementation for SYSTEM_CLOCK

    This is very similar to CPU_TIME, except that we return nanoseconds
    rather than seconds. This means we're potentially dealing with rather
    large numbers, so we'll have to wrap around to avoid overflows.
    
    Reviewed By: jeanPerier
    
    Differential Revision: https://reviews.llvm.org/D105970
    rovka authored and jeanPerier committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    2534d53 View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#971 from flang-compiler/jpr-fix-ele…

    …mental-call-mismatch
    
    Ensure scalar args are lowered to ref if needed in elemental calls
    jeanPerier authored Aug 10, 2021
    Configuration menu
    Copy the full SHA
    bbe47c2 View commit details
    Browse the repository at this point in the history
  4. Implement FORALL with allocatables.

    This also includes some renaming to keep implicit and explicit iteration
    spaces more clearly distinct.
    schweitzpgi committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    a8082ef View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2021

  1. Merge pull request flang-compiler#977 from schweitzpgi/ch-allocforall

    Implement FORALL with allocatables.
    schweitzpgi authored Aug 11, 2021
    Configuration menu
    Copy the full SHA
    9673be2 View commit details
    Browse the repository at this point in the history
  2. Support fir.box in genRecordAssignment

    Fixes nag_f95_syntax 210a211 issue.
    The ExtendedValue in genRecordAssignment can very well be fir::BoxValue.
    Handle this case correctly.
    jeanPerier committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    a644a19 View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#973 from flang-compiler/jp-cherry-p…

    …ick-system-clock
    
    Cherry pick system clock implementation patch from phabricator
    jeanPerier authored Aug 11, 2021
    Configuration menu
    Copy the full SHA
    e793107 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    45090cc View commit details
    Browse the repository at this point in the history
  5. [flang] Fix the extent calculation when upper bounds are less than lo…

    …wer bounds
    
    When the upper bound is less than the lower bound, the extent is zero.  This is
    specified in section 8.5.8.2, paragraph 3.
    
    Note that similar problems exist in the lowering code.  This change only fixes
    the problem for the front end.
    
    I also added a test.
    
    Differential Revision: https://reviews.llvm.org/D107832
    psteinfeld committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    f51ffbe View commit details
    Browse the repository at this point in the history
  6. Fixes assertion 'idx < size()' in tests.

    The front-end shape analysis can't be used in all cases.
    schweitzpgi committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    88a4b61 View commit details
    Browse the repository at this point in the history
  7. Merge pull request flang-compiler#981 from schweitzpgi/ch-bug3

    Fixes assertion 'idx < size()' in tests.
    schweitzpgi authored Aug 11, 2021
    Configuration menu
    Copy the full SHA
    e6dad13 View commit details
    Browse the repository at this point in the history
  8. Lowering for SCALE instrinsic

    - added basic implementation for lowering of the SCALE intrinsic
    - added tests for lowering of SCALE intrinsic
    
    Address review comments:
    
    - change TODO to fir::emitFatalError
    - simplify creation of arguments list using Fortran::lower::createArguments
    - clang-format files
    AlexisPerry committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    91e1b94 View commit details
    Browse the repository at this point in the history
  9. [flang] Fix the lowering test for constant-folded extent calculations

    With the latest change to the front end, extent calculations are
    constant folded which affects the expressions that get lowered.  This
    means that the tests that contain the constant folded expressions need
    to be updated.
    psteinfeld committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    8b0431e View commit details
    Browse the repository at this point in the history
  10. Merge pull request flang-compiler#982 from flang-compiler/ps-cherry-p…

    …ick-extents
    
    Ps cherry pick extents
    psteinfeld authored Aug 11, 2021
    Configuration menu
    Copy the full SHA
    8339dbd View commit details
    Browse the repository at this point in the history
  11. Merge pull request flang-compiler#980 from flang-compiler/aperry-scale

    SCALE instrinsic lowering
    schweitzpgi authored Aug 11, 2021
    Configuration menu
    Copy the full SHA
    717a4b7 View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2021

  1. Configuration menu
    Copy the full SHA
    fb01a71 View commit details
    Browse the repository at this point in the history
  2. Merge pull request flang-compiler#979 from flang-compiler/jpr-fix-210…

    …a211
    
    Support fir.box in genRecordAssignment
    jeanPerier authored Aug 12, 2021
    Configuration menu
    Copy the full SHA
    9f201b9 View commit details
    Browse the repository at this point in the history
  3. [flang] Always create HostAssocDetails for host object symbols with U…

    …seDetails
    
    https://reviews.llvm.org/D105464 did not correctly cover the case
    where the symbol from the host procedure is use associated. Outside
    of the mis-parsed ArrayRef case, flang was also creating a symbol with
    HostAssociated details inside the internal procedure (pointing to the
    use associated symbol in the host). That is what lowering expects.
    This patch ensures the same logic is applied in the mis-parsed array-ref name
    resolution (and the pointer target name resolution).
    
    Differential Revision: https://reviews.llvm.org/D107759
    jeanPerier committed Aug 12, 2021
    Configuration menu
    Copy the full SHA
    9972f6c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    52050ce View commit details
    Browse the repository at this point in the history
  5. Instantiate module variables in internal procedure of module procedures

    When an internal procedure is defined inside a module procedure, it may
    access the module variables. These access are not materialized by
    associated symbols in the internal procedure scope, so lowering must
    instantiate all the module variables before lowering the internal
    procedure so that any reference to the module symbols can be resolved.
    
    Also update the case where the internal procedure is not in a module
    procedure but simply in a procedure that uses module variables. This
    case compiled and worked, but the module variable was passed via the
    host tuple when it can simply be instantiated directly from the module
    address inside the internal procedure.
    jeanPerier committed Aug 12, 2021
    Configuration menu
    Copy the full SHA
    d207a63 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    57bfb63 View commit details
    Browse the repository at this point in the history
  7. Delete intrinsic-procedures.f90

    I found this file does not exist anymore in upstream fir-dev branch, so I will remove this file.
    bolgrebolgre authored Aug 12, 2021
    Configuration menu
    Copy the full SHA
    af192d1 View commit details
    Browse the repository at this point in the history
  8. Merge pull request flang-compiler#974 from flang-compiler/jpr-fix-941-2

    Ensure used module variables are mapped when lowering internal procedures.
    jeanPerier authored Aug 12, 2021
    Configuration menu
    Copy the full SHA
    40edb60 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    cf34e12 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    9fcbb14 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    a77ff6e View commit details
    Browse the repository at this point in the history
  12. [Flang] Fix build failure on MacOS

    std::clock_t can be an unsigned value on some platforms like MacOS and
    therefore needs a cast when initializing an std::clock_t value with -1.
    
    Reviewed By: klausler
    
    Differential Revision: https://reviews.llvm.org/D107972
    kiranchandramohan committed Aug 12, 2021
    Configuration menu
    Copy the full SHA
    abbcbc6 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    bec04a7 View commit details
    Browse the repository at this point in the history
  14. Merge pull request flang-compiler#983 from bolgrebolgre/fir-dev

    Lowering of EXPONENT, FRACTION, SET_EXPONENT intrinsic
    schweitzpgi authored Aug 12, 2021
    Configuration menu
    Copy the full SHA
    7af3b2a View commit details
    Browse the repository at this point in the history
  15. Merge pull request flang-compiler#986 from kiranchandramohan/mac-clock

    [Flang] Fix build failure on MacOS
    schweitzpgi authored Aug 12, 2021
    Configuration menu
    Copy the full SHA
    b5e69bb View commit details
    Browse the repository at this point in the history
  16. Merge pull request flang-compiler#987 from kiranchandramohan/unused-fix

    [NFC] Remove unused warning
    schweitzpgi authored Aug 12, 2021
    Configuration menu
    Copy the full SHA
    f187a50 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2021

  1. Configuration menu
    Copy the full SHA
    2daaaaa View commit details
    Browse the repository at this point in the history
  2. Merge pull request flang-compiler#985 from flang-compiler/jpr-move-li…

    …teral-name-helper
    
    [NFC] move LiteralNameHelper to remove front-end dependency in FIRBuilder
    jeanPerier authored Aug 13, 2021
    Configuration menu
    Copy the full SHA
    09e8763 View commit details
    Browse the repository at this point in the history
  3. [flang] Support DFLOAT legacy extension intrinsic function

    Like the similar legacy extension FLOAT(), DFLOAT() represents a
    conversion from default integer to DOUBLE PRECISION.  Rewrite
    into a conversion operation.
    
    Differential Revision: https://reviews.llvm.org/D107489
    klausler authored and jeanPerier committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    e611929 View commit details
    Browse the repository at this point in the history
  4. [flang] runtime: For Fw.d formatting, don't oscillate forever

    The algorithm for Fw.d output will drive binary to decimal conversion for
    an initial fixed number of digits, then adjust that number based on the
    result's exposent.  For value close to a power of ten, this adjustment
    process wouldn't terminate; e.g., formatting 9.999 as F10.2 would start
    with 1e2, boost the digits to 2, get 9.99e1, decrease the digits, and loop.
    Solve by refusing to boost the digits a second time.
    
    Differential Revision: https://reviews.llvm.org/D107490
    klausler authored and jeanPerier committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    1ffe791 View commit details
    Browse the repository at this point in the history
  5. [flang] Implement runtime Assign()

    Define an API for, and implement, runtime support for arbitrary
    assignment of one descriptor's data to another, with full support for
    (re)allocation of allocatables with finalization when necessary,
    user-defined derived type assignment TBP calls, and intrinsic (default)
    componentwise assignment of derived type instances with allocation of
    automatic components.  Also clean up API and implementation of
    finalization/destruction using knowledge gained while studying
    edge cases for assignment in the 2018 standard.
    
    The look-up procedure for special procedure bindings in derived
    types has been optimized from O(N) to O(1) since it will probably
    matter more.  This required some analysis in runtime derived type
    description table construction in semantics and some changes to the
    table schemata.
    
    Executable Fortran tests have been developed; they'll be added
    to the test base once they can be lowered and run by f18.
    
    Differential Revision: https://reviews.llvm.org/D107678
    klausler authored and jeanPerier committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    05024a8 View commit details
    Browse the repository at this point in the history
  6. [flang] Silence new build warning

    Some build environments complain about unused data members in some
    C++ translations of Fortran derived types; those members don't really
    need to be present, so remove them.
    
    Fix pushed w/o review to get build bots running again.
    klausler authored and jeanPerier committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    7749198 View commit details
    Browse the repository at this point in the history
  7. [flang] Fix list-directed plural repeated null values at end of record

    A repeated null value at the end of an input record with a count > 1
    would incorrectly advance to the next record when resumed.  Fix.
    
    Improve some poor naming and code flow noticed while debugging, so
    next time will be easier.
    
    Extend a unit test to check this case.
    
    Differential Revision: https://reviews.llvm.org/D107917
    klausler authored and jeanPerier committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    5932214 View commit details
    Browse the repository at this point in the history
  8. [flang] Fix crash in runtime-type-info.cpp

    Recent work in runtime assignments failed an assertion in fir-dev
    while running tests (flang/test/Semantics/defined-ops.f90).  This
    test didn't fail in llvm-project/main because only the "new" Arm
    driver is used now, and that only builds runtime derived type information
    tables when some debug dumping options are enabled.
    
    So add a reproducing test case to another test that is run with
    -fdebug-dump-symbols, and fix the crash by emitting special procedure
    binding information only for type-bound generic ASSIGNMENT(=) bindings
    that are relevant to the runtime support library for use in intrinsic
    assignment of derived types.
    
    Differential Revision: https://reviews.llvm.org/D107918
    klausler authored and jeanPerier committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    6e34406 View commit details
    Browse the repository at this point in the history
  9. [Flang] Fix error messages on Windows.

    Flang uses positional arguments for `messages::say()`, such as "%1$s" which is only supported in MS Compilers with the `_*printf_p` form of the function. This uses a conditional macro to convert the existing `vsnprintf` used to the one needed in MS-World.
    
    7 tests in D107575 rely on this change.
    
    Reviewed By: Meinersbur
    
    Differential Revision: https://reviews.llvm.org/D107654
    Ivan Zhechev authored and jeanPerier committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    1e930ad View commit details
    Browse the repository at this point in the history
  10. [flang] Correct off-by-one error in SET_EXPONENT

    SET_EXPONENT is returning values that are too large by a factor
    of two.
    
    Differential Revision: https://reviews.llvm.org/D107986
    klausler authored and jeanPerier committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    5941a96 View commit details
    Browse the repository at this point in the history
  11. Add line information to some fatal error to help debugging

    This also had the benefit to slightly simplify the genStmtFunctionRef
    lowering code by using gen(Sym) that already produces nice error
    messages.
    jeanPerier committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    ec8d2a8 View commit details
    Browse the repository at this point in the history
  12. [flang] Fix the SHIFT argument of the CSHIFT intrinsic

    While working on EOSHIFT, I realized that the lowering code for the CSHIFT
    intrinsic was incorrect.  The SHIFT argument was being passed as an address
    but was being treated as an integer value.  My tests were accidentally working
    since the runtime code was taking the modulus of the address and coincidentally
    getting the correct value.
    psteinfeld committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    73c4d38 View commit details
    Browse the repository at this point in the history
  13. Squash 4 commits into 1

    Fix TODO with "not yet implemented intra-entity slice in fir.embox codegen".
    This comes up with slices of derived type components such as x(1:10:2)%j.
    
    Reformat some lines with clang-format.
    
    Incorporate comments, add test to Fir/embox.fir.
    
    Add check lines to the derived type slice embox test. Also re-do the
    previous embox test since it was not really doing anything.
    mleair committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    51fcaf0 View commit details
    Browse the repository at this point in the history
  14. Merge pull request flang-compiler#978 from flang-compiler/ml-slice

    Fix TODO with "not yet implemented intra-entity slice in fir.embox codegen"
    mleair authored Aug 13, 2021
    Configuration menu
    Copy the full SHA
    8b1bf21 View commit details
    Browse the repository at this point in the history
  15. Merge pull request flang-compiler#992 from flang-compiler/ps-fix-cshift

    [flang] Fix the SHIFT argument of the CSHIFT intrinsic
    psteinfeld authored Aug 13, 2021
    Configuration menu
    Copy the full SHA
    ca16318 View commit details
    Browse the repository at this point in the history
  16. Merge pull request flang-compiler#989 from flang-compiler/jpr-cherry-…

    …pick-llvm
    
    Cherry pick all flang commits from LLVM since last cherry-picking
    schweitzpgi authored Aug 13, 2021
    Configuration menu
    Copy the full SHA
    df94154 View commit details
    Browse the repository at this point in the history
  17. Don't put compiler generated objects in equivalence groups (flang-com…

    …piler#993)
    
    Equivalence analysis has some problems that may be addressed by shifting
    the core analysis to the front end.  Pending such changes, don't attempt
    to place compiler generated objects in any equivalence group.
    vdonaldson authored Aug 13, 2021
    Configuration menu
    Copy the full SHA
    7001237 View commit details
    Browse the repository at this point in the history
  18. Lowering for NEAREST intrinsic

    - added basic implementation for lowering of the NEAREST intrinsic
    - added tests for lowering of the NEAREST intrinsic
    AlexisPerry committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    51295e5 View commit details
    Browse the repository at this point in the history

Commits on Aug 14, 2021

  1. Fix assertion "key not already in map".

    Fix verification of fir.if bug.
    Some progress on the symbol not mapped cases.
    Add some TODOs.
    Add forall-2.f90 test file.
    schweitzpgi committed Aug 14, 2021
    Configuration menu
    Copy the full SHA
    704d5e2 View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2021

  1. Merge pull request flang-compiler#991 from flang-compiler/jpr-add-lin…

    …es-in-error
    
    Add line information to some fatal errors to help debugging
    jeanPerier authored Aug 16, 2021
    Configuration menu
    Copy the full SHA
    04376a9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e648538 View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#984 from flang-compiler/jpr-element…

    …al-char
    
    Lower calls to elemental procedure with character arguments
    jeanPerier authored Aug 16, 2021
    Configuration menu
    Copy the full SHA
    f92b8a0 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6b03818 View commit details
    Browse the repository at this point in the history
  5. Merge pull request flang-compiler#995 from flang-compiler/aperry-nearest

    Lowering for NEAREST intrinsic
    AlexisPerry authored Aug 16, 2021
    Configuration menu
    Copy the full SHA
    ba7b1b1 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2021

  1. Lower elemental character function and elemental internal procedure

    Split the scalar function lowering genRawProcedureRef in order to share
    the part that deals with explicit result allocation and host link
    passing with elemental procedure lowering. This code is split without
    any functional change.
    
    Use the new function in elemental procedure lowering. Instead of placing
    the result manually in a vector or mlir::Value, use the CallerInterface
    placeInput function, and let the scalar lowering deal with the result
    instantiation and the callOp.
    In order to be able to capture the CallerInterface object, its
    std::unique_ptr  member is made a std::optional, this enable the
    creation of the implicit copy constructor.
    jeanPerier committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    9f25471 View commit details
    Browse the repository at this point in the history
  2. Merge pull request flang-compiler#996 from schweitzpgi/ch-forall4

    Fix assertion "key not already in map".
    schweitzpgi authored Aug 17, 2021
    Configuration menu
    Copy the full SHA
    6114f8f View commit details
    Browse the repository at this point in the history
  3. fix test for g++ build

    fix warning
    schweitzpgi committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    23d1a17 View commit details
    Browse the repository at this point in the history
  4. Fix n2f.f90.

    Rewrite filter.
    Add another raiseBaseType method.
    schweitzpgi committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    db84c08 View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2021

  1. Merge pull request flang-compiler#1000 from flang-compiler/jpr-elemen…

    …tal-explicit-result
    
    Lower elemental character function and elemental internal procedure
    jeanPerier authored Aug 18, 2021
    Configuration menu
    Copy the full SHA
    34bba44 View commit details
    Browse the repository at this point in the history
  2. [NFC] Move FirOpBuilder, ExtendedValue and tools into lib/Optimizer/B…

    …uilder
    
    Many FIR related tools and helpers are not accessible in
    lib/Optimizer/Transform because they are part of lib/Lower library
    even though they only operate on FIR and MLIR data structures.
    
    Most of these tools are using the FirOpBuilder. Move this class into
    Optimizer/Builder/FirOpBuilder.h. Change FirOpBuilder namespace to
    fir.
    Similarly, the fir::ExtendedValue is a key data structure in all
    helpers. Move it under Optimizer/Builder/BoxValue.h. Its namespace was
    already fir. Split its implementation from Lower/SymbolMap.cpp into
    a new Optimzer/Builder/BoxValue.cpp file.
    
    The FirOpBuilder implementation depends on ComplexExpr.h,
    CharacterExpr.h, DoLoopHelper.h, and Allocatable.h.
    
    - Split Allocatable.h into Lower/Allocatable.h (that contains the API to
      lower allocation/association on front end data structure) and
      Optimizer/Builder/MutableBox.h (that contains the tools to work with
      MutableBoxValue)
    
    - Move CharacterExpr.h to Optimizer/Builder/Character.h. Implement a
      small genMin locally in Character.cpp to break the dependency with
      lib/Lower/intrinsicCall.cpp.
    - Move ComplexExpr.h to Optimizer/Builder/Complex.h. ComplexExpr.cpp
      depended on lib/Lower/ConvertType.cpp to convert a kind to a real
      type. Add a getRealType(kind) helper to FirOpBuilder using the kindMap
      instead.
    - Move DoLoopHelper.h to Optimizer/Builder/DoLoopHelper.h.
    
    Apart from the ExtendedValue and FirOpBuilder classes that are directly under
    fir namespace, all moved functions are placed under the fir::factory
    namespace since they generate big chunks of FIR to implement Fortran
    pattern.
    
    The lib/Optimizer/Builder files are added to a new libFIROpBuilder
    library.
    
    With all this, FirOpBuilder and related tools is available in
    lib/Optimizer and no new dependency is brought into lib/Optimizer.
    jeanPerier committed Aug 18, 2021
    Configuration menu
    Copy the full SHA
    96658e3 View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#999 from flang-compiler/jpr-move-bu…

    …ilder-in-optimizer-5
    
    [NFC] Move FirOpBuilder, ExtendedValue and tools into Optimizer/Builder
    jeanPerier authored Aug 18, 2021
    Configuration menu
    Copy the full SHA
    9ec3a0e View commit details
    Browse the repository at this point in the history
  4. Put the check for dropping implied array arguments in the subexpressi…

    …ons per review comment.
    schweitzpgi committed Aug 18, 2021
    Configuration menu
    Copy the full SHA
    73b357f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d13ef2b View commit details
    Browse the repository at this point in the history
  6. remove debug code

    schweitzpgi committed Aug 18, 2021
    Configuration menu
    Copy the full SHA
    611074a View commit details
    Browse the repository at this point in the history
  7. resolve conflict

    schweitzpgi committed Aug 18, 2021
    Configuration menu
    Copy the full SHA
    a8a280e View commit details
    Browse the repository at this point in the history

Commits on Aug 19, 2021

  1. [NFC] Move runtime API call generator into Optimizer/Runtime - part 1/2

    Move the files without any change in this commit so that git can keep
    track of the rename. The commit does not compile without part 2.
    jeanPerier committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    528737c View commit details
    Browse the repository at this point in the history
  2. [NFC] Move runtime API call generator into Optimizer/Runtime - part 2/2

    In order to be able to emit runtime calls in FIR transformation passes,
    move the runtime call generators into Optimizer/Runtime.
    RTBuilder.h is moved there, as well as DerivedRuntime.h, NumericRuntime.h,
    ReductionRuntime.h, CharacterRuntime.h, and TransformationalRuntime.h
    
    All the methods are moved from the Fortran::lower namespace into a new
    fir::runtime namespace.
    
    Runtime.[h, cpp] is not moved yet because it uses parse tree nodes.
    There is no urgent need to move it now, so I did not attempted to split
    it in this PR.
    
    Allocatable.cpp and IO.cpp make direct usages of RTBuilder.h, it may be
    cleaner to handle the runtime call generation details in new
    Optimizer/xxx files, but this is not done here since this calls are not
    currently needed in lib/Optimizer.
    jeanPerier committed Aug 19, 2021
    Configuration menu
    Copy the full SHA
    187b675 View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#1004 from flang-compiler/jpr-move-r…

    …untime-in-optimizer-3
    
    [NFC] Move runtime API call generator into Optimizer/Runtime
    jeanPerier authored Aug 19, 2021
    Configuration menu
    Copy the full SHA
    ec334d0 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fd8dc16 View commit details
    Browse the repository at this point in the history
  5. cherry pick several runtime and intrinsic fixes (flang-compiler#1006)

    * [flang] Fix regression from recent runtime input fix
    
    A recent runtime I/O change[1] was meant to improve the handling of
    input from external files missing a terminal newline on their last
    records; the change was "triggered" by the wrong circumstances and
    causing reads that should have pulled more data into the buffer to be
    treated as EOFs.  So fix that, and also don't retain input data
    in the buffer once an input record has been finished unless it's
    known that list-directed or NAMELIST input of a repeated input item
    may need to backspace a non-positionable external unit to return
    to the beginning of the repeated item.
    
    [1] 6578893
    
    Differential Revision: https://reviews.llvm.org/D108164
    
    * [flang] Add missing call to BeginReadingRecord()
    
    NAMELIST input needs to start with a call to BeginReadingRecord().
    Internal unit input doesn't care (so unit tests were passing), but
    external unit input does need the call and will assert without it.
    
    Differential Revision: https://reviews.llvm.org/D108051
    
    * [flang] Fix the vector version of EOSHIFT with a BOUNDARY argument
    
    When the vector version of EOSHIFT was called, the BOUNDARY argument was being
    ignored.  I fixed that and added a test that would not pass without this fix.
    
    Differential Revision: https://reviews.llvm.org/D108249
    
    Co-authored-by: peter klausler <[email protected]>
    Co-authored-by: Peter Steinfeld <[email protected]>
    3 people authored Aug 19, 2021
    Configuration menu
    Copy the full SHA
    ba3942f View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2021

  1. Implement pointer assignment in FORALL context.

    This does not fix tests using substring operations.
    schweitzpgi committed Aug 23, 2021
    Configuration menu
    Copy the full SHA
    c8d759e View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2021

  1. Fix a character constant mangling bug (flang-compiler#1010)

    The hash portion of a character constant name is currently derived by
    hashing over a multiple of the actual character constant length, rather
    than the actual length.  Incorporating arbitrary "garbage" characters
    in the hash value generation will not usually be a correctness issue
    because the resulting "invalid" hash name will be used for both the
    value definition and any references to it.  However, beyond wasting
    compile time, it can create duplicate constants rather than reusing
    a single constant.
    vdonaldson authored Aug 24, 2021
    Configuration menu
    Copy the full SHA
    1411c56 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    87e5c48 View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#1009 from schweitzpgi/ch-forall6

    Implement pointer assignment in FORALL context.
    schweitzpgi authored Aug 24, 2021
    Configuration menu
    Copy the full SHA
    31c0214 View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2021

  1. Lower derived array assignment and improve derived scalar assignment

    Move the genRecordAssignment scalar assignment helper in fir::factory so
    that it can be used for the array case in ArrayCopyValue.cpp.
    
    Simplify genRecordAssignment to only lower as inline code the cases where
    a mem copy can be done to implement the derive type assignment (that is
    when their are no allocatable component, automatic component, or
    component requiring a user defined assignment calls). For the rest, use
    the runtime genAssign() that handles deep copies and user defined
    assignments.
    
    For the inline version, instead of working component by component, and
    using the array expression framework for array components, simply emit a
    derived type load + store. This is OK since the derived types assigned
    inlined have constant size. LLVM transform this into element by element
    assignment of llvm.memmove itself (opt --memcpyopt inserts memmove calls).
    
    This allows implementing the simple cases inlined without depending on
    the array expression framework (which is not possible during the
    ArrayCopyValue pass), or manually creating llvm.memmove, which would
    require inserting a fir.sizeof of to compute the byte size for the
    memmove.
    jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    de7bbdd View commit details
    Browse the repository at this point in the history
  2. Merge pull request flang-compiler#1007 from flang-compiler/jpr-derive…

    …d-array-assign
    
    Lower derived array assignments and improve derived scalar assignments
    jeanPerier authored Aug 25, 2021
    Configuration menu
    Copy the full SHA
    1a3ab4a View commit details
    Browse the repository at this point in the history
  3. Revert "[flang] Add POSIX implementation for SYSTEM_CLOCK"

    This reverts commit 2534d53.
    jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    66af69c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    75ba7f3 View commit details
    Browse the repository at this point in the history
  5. [flang] Add default implementation for SYSTEM_CLOCK

    Add an implementation for the runtime functions related to SYSTEM_CLOCK.
    As with CPU_TIME, this is based on std::clock(), which should be
    available everywhere, but it is highly recommended to add
    platform-specific implementations for systems where std::clock() behaves
    poorly (e.g. POSIX).
    
    The documentation for std::clock() doesn't specify a maximum value and
    in fact wrap around behaviour is non-conforming.  Therefore, this
    implementation of SYSTEM_CLOCK is not guaranteed to wrap around either,
    and after std::clock reaches its maximum value we will likely just
    return failure rather than wrap around. If this happens often on your
    system, please add a new platform-specific implementation.
    
    We define COUNT_MAX as either the maximum value that can be stored in
    a std::clock_t or in a 64-bit integer (whichever is smaller), and
    COUNT_RATE as CLOCKS_PER_SEC. For POSIX systems, the value of
    CLOCKS_PER_SEC is hardcoded to 10^6 and irrelevant for the values
    returned by std::clock.
    
    Differential Revision: https://reviews.llvm.org/D105969
    rovka authored and jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    d3daa0b View commit details
    Browse the repository at this point in the history
  6. [flang] Add POSIX implementation for SYSTEM_CLOCK

    This is very similar to CPU_TIME, except that we return nanoseconds
    rather than seconds. This means we're potentially dealing with rather
    large numbers, so we'll have to wrap around to avoid overflows.
    
    Differential Revision: https://reviews.llvm.org/D105970
    rovka authored and jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    d1f65ff View commit details
    Browse the repository at this point in the history
  7. [flang] Implement Posix version of DATE_AND_TIME runtime

    Use gettimeofday and localtime_r to implement DATE_AND_TIME intrinsic.
    The Windows version fallbacks to the "no date and time information
    available" defined by the standard (strings set to blanks and values to
    -HUGE).
    
    The implementation uses an ifdef between windows and the rest because
    from my tests, the SFINAE approach leads to undeclared name bogus errors
    with clang 8 that seems to ignore failure to instantiate is not an error
    for the function names (i.e., it understands it should not instantiate
    the version using gettimeofday if it is not there, but still yields an
    error that it is not declared on the spot where it is called in the
    uninstantiated version).
    
    Differential Revision: https://reviews.llvm.org/D108622
    jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    980dde3 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    b12f68e View commit details
    Browse the repository at this point in the history
  9. [flang][OpenMP] Add semantic checks for cancellation nesting

    This patch implements the following semantic checks for cancellation constructs:
    ```
    OpenMP Version 5.0 Section 2.18.1: CANCEL construct restriction:
    If construct-type-clause is taskgroup, the cancel construct must be
    closely nested inside a task or a taskloop construct and the cancel
    region must be closely nested inside a taskgroup region. If
    construct-type-clause is sections, the cancel construct must be closely
    nested inside a sections or section construct. Otherwise, the cancel
    construct must be closely nested inside an OpenMP construct that matches
    the type specified in construct-type-clause of the cancel construct.
    
    OpenMP Version 5.0 Section 2.18.2: CANCELLATION POINT restriction:
    A cancellation point construct for which construct-type-clause is
    taskgroup must be closely nested inside a task or taskloop construct,
    and the cancellation point region must be closely nested inside a
    taskgroup region. A cancellation point construct for which
    construct-type-clause is sections must be closely nested inside a
    sections or section construct. A cancellation point construct for which
    construct-type-clause is neither sections nor taskgroup must be closely
    nested inside an OpenMP construct that matches the type specified in
    construct-type-clause.
    ```
    
    Also add test cases for the check.
    
    Reviewed By: kiranchandramohan
    
    Differential Revision: https://reviews.llvm.org/D106538
    PeixinQiao authored and jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    14cfb57 View commit details
    Browse the repository at this point in the history
  10. [flang][OpenMP] Add semantic check for teams nesting

    This patch implements the following check for TEAMS construct:
    ```
    OpenMP Version 5.0 Teams construct restriction: A teams region can
    only be strictly nested within the implicit parallel region or a target
    region. If a teams construct is nested within a target construct, that
    target construct must contain no statements, declarations or directives
    outside of the teams construct.
    ```
    
    Also add one test case for the check.
    
    Reviewed By: kiranchandramohan, clementval
    
    Differential Revision: https://reviews.llvm.org/D106335
    PeixinQiao authored and jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    88bc622 View commit details
    Browse the repository at this point in the history
  11. [Flang] Fix for CI failure, Remove default case

    Remove default case when all the enum values are covered in switch
    statements.
    kiranchandramohan authored and jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    f1bfbe7 View commit details
    Browse the repository at this point in the history
  12. [flang][OpenMP] Add semantic check for target nesting

    This patch implements the following check for TARGET construct:
    ```
    OpenMP Version 5.0 Target construct restriction: If a target update,
    target data, target enter data, or target exit data construct is
    encountered during execution of a target region, the behavior is
    unspecified.
    ```
    
    Also add one test case for the check.
    
    Reviewed By: kiranchandramohan, clementval
    
    Differential Revision: https://reviews.llvm.org/D106165
    PeixinQiao authored and jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    7f93fd3 View commit details
    Browse the repository at this point in the history
  13. [flang] Extension: reduced scope for some implied DO loop indices

    The index of an implied DO loop in a DATA statement or array
    constructor is defined by Fortran 2018 to have scope over its
    implied DO loop.  This definition is unfortunate, because it
    requires the implied DO loop's bounds expressions to be in the
    scope of the index variable.  Consequently, in code like
    
      integer, parameter :: j = 5
      real, save :: a(5) = [(j, j=1, j)]
    
    the upper bound of the loop is a reference to the index variable,
    not the parameter in the enclosing scope.
    
    This patch limits the scope of the index variable to the "body"
    of the implied DO loop as one would naturally expect, with a warning.
    I would have preferred to make this a hard error, but most Fortran
    compilers treat this case as f18 now does.  If the standard
    were to be fixed, the warning could be made optional.
    
    Differential Revision: https://reviews.llvm.org/D108595
    klausler authored and jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    d3a2c6f View commit details
    Browse the repository at this point in the history
  14. [flang] runtime: fix WRITE after BACKSPACE on variable-length file

    BACKSPACE leaves "recordLength" set, which is fine for a later READ,
    but it causes a later WRITE to fail due to a misinterpretation of the
    knowledge of the record length as indication of a fixed-length record
    file (RECL=).  Fix.
    
    Differential Revision: https://reviews.llvm.org/D108594
    klausler authored and jeanPerier committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    a4814f7 View commit details
    Browse the repository at this point in the history
  15. typo

    schweitzpgi committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    d195a85 View commit details
    Browse the repository at this point in the history
  16. Zero size array initializers (flang-compiler#1011)

    Zero size array initializers
    
    Special case zero size arrays in genArrayLit.
    Reduce code duplication and dead FIR generation.
    vdonaldson authored Aug 25, 2021
    Configuration menu
    Copy the full SHA
    bf166d3 View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2021

  1. Merge pull request flang-compiler#1013 from flang-compiler/jpr-cherry…

    …-pick
    
    Cherry pick all flang commits from LLVM since last cherry-picking
    jeanPerier authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    6c1b99c View commit details
    Browse the repository at this point in the history
  2. Make extern weak symbols for type descriptor not defined in translati…

    …on unit
    
    If a derived type is defined in a module in another translation unit,
    its "<scope mangling>.dt.<typename>" global is not declared in the
    current translation unit in lowering, and therefore not accessible in
    codegen. The symbol is not lowered because it is not use associated in
    any of the program units lowered in the current translation unit. If we wanted
    to deal with this in lowering, we would need to start lowering
    declaration for all variables from the module used by the lowered
    program units, which is not the current approach in lowering).
    
    Declare a tentative (extern weak) type descriptor symbol in codegen
    if no global exists for the type descriptor symbol. It may be resolved
    at link time, and will otherwise be a nullptr (so far, do not make it a
    link error if the symbol is defined nowhere to support codegen of FIR
    files produced without runtime info symbols for debug purposes).
    jeanPerier committed Aug 26, 2021
    Configuration menu
    Copy the full SHA
    a8bea8e View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#1014 from flang-compiler/jpr-c1b-fix

    Make extern weak symbols for type descriptor not defined in translation unit
    jeanPerier authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    e94d0b5 View commit details
    Browse the repository at this point in the history
  4. Merge pull request flang-compiler#1012 from flang-compiler/jpr-date-a…

    …nd-time-lowering-update
    
    DATE_AND_TIME update after runtime upstreaming
    jeanPerier authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    880871c View commit details
    Browse the repository at this point in the history
  5. [flang] Take result length into account in ApplyElementwise folding

    ApplyElementwise on character operation was always creating a result
    ArrayConstructor with the length of the left operand. This is not
    correct for concatenation and SetLength operations.
    
    Compute and thread the length to the spot creating the ArrayConstructor
    so that the length is correct for those character operations.
    
    Differential Revision: https://reviews.llvm.org/D108711
    jeanPerier committed Aug 26, 2021
    Configuration menu
    Copy the full SHA
    e31ba91 View commit details
    Browse the repository at this point in the history
  6. Merge pull request flang-compiler#1016 from flang-compiler/jpr-cherry…

    …-pick-fma1-fix
    
    Cherry-pick [flang] Take result length into account in ApplyElementwise folding
    jeanPerier authored Aug 26, 2021
    Configuration menu
    Copy the full SHA
    38afb0f View commit details
    Browse the repository at this point in the history
  7. [NFC fix] merge FIRRuntime in FIRBuilder to break circular deps - part 1

    Simply move the files without any change so that git can keep track of the
    rename. CMakeLists.txt are updated. Other changes required to get in a buildable
    state will be in a part 2 commit.
    jeanPerier committed Aug 26, 2021
    Configuration menu
    Copy the full SHA
    82ed8cd View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f9261b1 View commit details
    Browse the repository at this point in the history

Commits on Aug 27, 2021

  1. Merge pull request flang-compiler#1017 from flang-compiler/jpr-fix-ci…

    …rcular-deps
    
    [NFC fix] merge FIRRuntime in FIRBuilder to break circular deps
    jeanPerier authored Aug 27, 2021
    Configuration menu
    Copy the full SHA
    0c61733 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    87ecafe View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2021

  1. Merge pull request flang-compiler#1018 from flang-compiler/jpr-derive…

    …d-type-lbs
    
    Add hard todo for non default component lower bounds
    jeanPerier authored Aug 30, 2021
    Configuration menu
    Copy the full SHA
    305d05a View commit details
    Browse the repository at this point in the history
  2. [flang] Apply double precision KindCode in specific proc interface

    The double precision KindCode was ignored when building the interface
    of specific intrinsic procedures leading to bad semantics checks.
    
    Differential Revision: https://reviews.llvm.org/D108828
    jeanPerier committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    c976e64 View commit details
    Browse the repository at this point in the history
  3. Fix test failure with non default component lower bounds

    forall.f90 tested used non-default array component lower bounds.
    Lowering does not implement this correctly yet and a TODO was added
    for this which now fires in the test.
    jeanPerier committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    110fefa View commit details
    Browse the repository at this point in the history
  4. Lowering for EOSHIFT intrinsic

    - added implementation for lowering of the EOSHIFT intrinsic
    - added tests for this implementation
    AlexisPerry committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    20b933b View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2021

  1. Merge pull request flang-compiler#1022 from flang-compiler/jpr-specna…

    …m-iface-issue-2
    
    Cherry-pick actual/dummy mismatch error fix
    jeanPerier authored Aug 31, 2021
    Configuration menu
    Copy the full SHA
    feec79c View commit details
    Browse the repository at this point in the history
  2. Handle vector subscripts that are not whole contiguous symbols

    The array framework was building an inexact shape for the
    array subscript expression `x(<vector subscript expr>)` when it is not
    able to compute the actual shape of `<vector subscript expr>`. The
    inexact shape was the shape of `x`. The code was defaulting in to the inexact
    shape when `<vector subscript expr>` is a designator that is a
    descriptor while this was not needed. This lead to runtime crash like
    the one reported in flang-compiler#1019.
    
    Fix:
    
    Simply compute the vector subscript shape from the vector subscript
    fir.array_load with the existing getShape(arrayLoad) helper.
    
    This covers the cases where the vector subscripts is not a whole
    symbols (function results, array sections, operation results...), with
    even less code.
    jeanPerier committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    344abfa View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#1023 from flang-compiler/jpr-fix-is…

    …sue-1019
    
    Handle vector subscripts that are descriptors - Fix flang-compiler#1019
    jeanPerier authored Aug 31, 2021
    Configuration menu
    Copy the full SHA
    fa3e602 View commit details
    Browse the repository at this point in the history
  4. EOSHIFT Lowering - address review comments

    - boundary should be passed as address
    - no need to codegen everything in the absence of a boundary argument, use a fir::AbsentOp with a generic NoneType Box instead
    - update unittest
    AlexisPerry committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    bffea5c View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2021

  1. Configuration menu
    Copy the full SHA
    3a164ae View commit details
    Browse the repository at this point in the history
  2. [mlir] support collapsed loops in OpenMP-to-LLVM translation

    Reviewed By: Meinersbur
    
    Differential Revision: https://reviews.llvm.org/D105706
    ftynse authored and Leporacanthicus committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    f8144e6 View commit details
    Browse the repository at this point in the history
  3. [flang][OpenMP] Support for Collapse

    Convert Fortran parse-tree into MLIR for collapse-clause.
    
    Includes simple Fortran to LLVM-IR test, with auto-generated
    check-lines (some of which have been edited by hand).
    Leporacanthicus committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    e459d4d View commit details
    Browse the repository at this point in the history
  4. Merge pull request flang-compiler#1024 from flang-compiler/aperry-eos…

    …hift
    
    Lowering for EOSHIFT intrinsic
    AlexisPerry authored Sep 1, 2021
    Configuration menu
    Copy the full SHA
    2a40e62 View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2021

  1. Configuration menu
    Copy the full SHA
    bb06cb0 View commit details
    Browse the repository at this point in the history
  2. [flang] Add runtime interface for GET_COMMAND_ARGUMENT

    GET_COMMAND_ARGUMENT takes a lot of optional arguments: VALUE, LENGTH,
    STATUS and ERRMSG. This patch breaks up the interface into 2 different
    functions:
    
    * One for getting the LENGTH of an argument.
    
    * One for getting the VALUE and the ERRMSG of an argument. This returns
    the STATUS, which can be easily ignored by lowering if it is missing in
    the invocation.
    
    Differential Revision: https://reviews.llvm.org/D108688
    rovka authored and jeanPerier committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    c77ef6e View commit details
    Browse the repository at this point in the history
  3. [flang] Fold CSHIFT

    Implement folding of the transformational intrinsic function
    CSHIFT for all types.
    
    Differential Revision: https://reviews.llvm.org/D108931
    klausler authored and jeanPerier committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    56c6432 View commit details
    Browse the repository at this point in the history
  4. [flang] Fold EOSHIFT

    Implement constant folding for the transformational intrinsic
    function EOSHIFT.
    
    Differential Revision: https://reviews.llvm.org/D108941
    klausler authored and jeanPerier committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    67262fd View commit details
    Browse the repository at this point in the history
  5. [flang] Fold PACK()

    Implement compile-time constant folding for the transformational
    intrinsic function PACK.
    
    Differential Revision: https://reviews.llvm.org/D108956
    klausler authored and jeanPerier committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    cfa4946 View commit details
    Browse the repository at this point in the history
  6. [flang] Downgrade inappropriate error message to a warning

    It may not be great practice to pass a procedure (or procedure pointer)
    with an implicit interface as an actual argument to correspond with
    a dummy procedure (pointer), but it's not an error.  Change to a
    warning, and modify tests accordingly.
    
    Differential Revision: https://reviews.llvm.org/D108932
    klausler authored and jeanPerier committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    a44240c View commit details
    Browse the repository at this point in the history
  7. [flang] Fold UNPACK and TRANSPOSE

    Implement constant folding for the transformational intrinsic
    functions UNPACK and TRANSPOSE.
    
    Differential Revision: https://reviews.llvm.org/D109010
    klausler authored and jeanPerier committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    4576068 View commit details
    Browse the repository at this point in the history
  8. [flang] Set default form if unspecified at end of OPEN statement

    The standard specifies that the form must be set to a default at the
    end of an open statement (C.7.4 point 2) where it was not specified.
    Only in the case of a pre-connected unit can the form be deferred
    until the first data transfer statement.
    
    Set back the default form setting in OpenStatementState::EndIoStatement
    that had been removed when deferring the pre-connected unit from setting
    in 199a623.
    
    Also return "UNDEFINED" instead of "UNKNOWN" to the FORM inquiry when the
    form was not yet specified as defined in 12.10.2.12.
    
    Related test: syntax 215a216.
    
    Differential Revision: https://reviews.llvm.org/D108990
    jeanPerier committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    2eb81ad View commit details
    Browse the repository at this point in the history
  9. Merge pull request flang-compiler#1028 from flang-compiler/jpr-cherry…

    …-picking
    
    Cherry pick all flang commits from LLVM since last cherry-picking
    jeanPerier authored Sep 2, 2021
    Configuration menu
    Copy the full SHA
    53d598b View commit details
    Browse the repository at this point in the history
  10. FORALL lowering

    This is a major restructuring of how FORALL loops are lowered in the bridge from
    parse trees to FIR. Previously, FORALL loops had been lowered like any other
    structured control-flow loops and then as a more dynamic form of array
    expression.
    
    This refactoring is a middle road approach where the FORALL context is analyzed
    and then lowered in the bridge. This allows lowering to create loop nests that
    correctly deal with impure expressions and pure masking expressions, which were
    not aligned with array expressions.  Lowering of assignment statements in the
    FORALL context is then done within the pre-built context by expression lowering.
    Secondly, expression lowering is refactored into a new "scalar array" traversal
    and code gen that works with array values as instantiated by the bridge in the
    earlier loop generation phase.
    
    Switching to this structure allows the array expression framework to be
    simplified since it no longer is required to deal with "special" scalar
    expressions and try to raise them into an array form.
    
    Allocatable arrays and pointer assignments are supported.
    
    User-defined ASSIGNMENT in (scalar) FORALL contexts is supported.
    
    This also introduces several correctness fixes.
    
    This does not correct known problems with arrays of CHARACTER, incomplete
    information with respect to derived types, elemental user-defined ASSIGNMENT in
    array expressions, PDTs, etc.
    schweitzpgi committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    128ce22 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2021

  1. [flang] Include default component initialization in static initializers

    The combined initializers constructed from DATA statements and explicit
    static initialization in declarations needs to include derived type
    component default initializations, overriding those default values
    without complaint with values from explicit DATA statement or declaration
    initializations when they overlap.  This also has to work for objects
    with storage association due to EQUIVALENCE.  When storage association causes
    default component initializations to overlap, emit errors if and only
    if the values differ (See Fortran 2018 subclause 19.5.3, esp. paragraph
    10).
    
    The f18 front-end has a module that analyzes and converts DATA statements
    into equivalent static initializers for objects.  For storage-associated
    objects, compiler-generated objects are created that overlay the entire
    association and fill it with a combined initializer.  This "data-to-inits"
    module already exists, and this patch is essentially extension and
    clean-up of its machinery to complete the job.
    
    Also: emit EQUIVALENCE to module files; mark compiler-created symbols
    and *don't* emit those to module files; check non-static EQUIVALENCE
    sets for conflicting default component initializations, so lowering
    doesn't have to check them or emit diagnostics.
    
    Differential Revision: https://reviews.llvm.org/D109022
    klausler authored and jeanPerier committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    2852010 View commit details
    Browse the repository at this point in the history
  2. Update lowering of equivalences after semantics change.

    Semantics analysis is now doing an analysis of equivalence default
    and explicit initializations to detect conflicting initializations.
    
    This allows lowering to re-use semantics tools/results and:
    
    1. Remove the interval analysis and use GetStorageAssociations to
       get a group of symbol that belongs to the same aggregate.
    
    2. Simplify the static equivalence initialization lowering (simply use
       the generated integer array expression with the equivalence initial
       value, that already combines all the equivalence members default and
       explicit initialization).
    
    Side consequences of this change:
    
    1. The aggregate storage names are changed, they now use the first
       member name in alphabetical order. The rational is to cover the
       cases where we need to ensure that the same name is built in
       two different translation unit for a same equivalence. The previous
       naming was relying on a mix of offset and scope order. There is no
       guarantee the scope order is the same in module files.
    
    2. The aggregate storage types are now fir.array<sizexiw> where
       size*w/8 is the equivalence storage size and w is the biggest
       possible storage units given the equivalence member types and
       Fortran storage unit rules.
    jeanPerier committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    de404fd View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#1029 from flang-compiler/jpr-update…

    …-equivalence-handling
    
    Jpr update equivalence handling
    jeanPerier authored Sep 3, 2021
    Configuration menu
    Copy the full SHA
    7a5a1a1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    bdf369b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    66328d5 View commit details
    Browse the repository at this point in the history

Commits on Sep 4, 2021

  1. Configuration menu
    Copy the full SHA
    9c2688f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ada9831 View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2021

  1. Merge pull request flang-compiler#1034 from schweitzpgi/ch-p8a

    Fix for overly assertive assertion.
    schweitzpgi authored Sep 6, 2021
    Configuration menu
    Copy the full SHA
    4005808 View commit details
    Browse the repository at this point in the history
  2. Merge pull request flang-compiler#1035 from schweitzpgi/ch-n4e.n1

    Fix bug with adjusted array element value types.
    schweitzpgi authored Sep 6, 2021
    Configuration menu
    Copy the full SHA
    d471d6f View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2021

  1. Handle zero sized equivalence in lowering

    The interval of zero sized equivalence storage looks like `[i, i[`, so
    when looking for an interval where `i` belongs, the PFT analysis was
    crashing.
    
    Accept `[i, i[` to be the right interval of null sized symbol starting
    at i.
    jeanPerier committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    4f77995 View commit details
    Browse the repository at this point in the history
  2. Fix array value threading to allow degenerate assignments. The front end

    will emit a warning about a scalar variable assignment only, so lowering
    cannot assume the assignment can be raised to array form.
    schweitzpgi committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    0648a81 View commit details
    Browse the repository at this point in the history
  3. Fix fir.coordinate_of op use with char<kind,?> types.

    The coordinate_of op requires a constant sized type, so it will not work
    correctly if used with fir.char with unknown length. The code was
    already computing the correct offsets from runtime values, but the type
    was not being converted resulting in internal errors in code gen.
    schweitzpgi committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    4b4021a View commit details
    Browse the repository at this point in the history
  4. remove ifdefs

    schweitzpgi committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    bf2d407 View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2021

  1. [flang] Fix non-deterministic line output function

    The evaluation order for the `|` operator is undefined
    (in contrast to the short-circuiting `||` operator). The arguments are
    stored in variables to force a specific evaluation order.
    
    A test in D107575 relies on this change.
    
    Reviewed By: kiranchandramohan, klausler
    
    Differential Revision: https://reviews.llvm.org/D108623
    Ivan Zhechev authored and vdonaldson committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    be5d30f View commit details
    Browse the repository at this point in the history
  2. [flang] NFC: change non-nullable pointer arguments to references

    Ticking off a Parser TODO: Preprocessor::Directive()'s Prescanner
    argument should be a reference, not a pointer.
    
    Differential Revision: https://reviews.llvm.org/D109094
    klausler authored and vdonaldson committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    b9735b2 View commit details
    Browse the repository at this point in the history
  3. [flang] Fix scope in which undeclared symbols are created

    Don't create new symbols in FORALL, implied DO, or other
    construct scopes when an undeclared name appears; use the
    innermost enclosing program unit's scope.  This clears up
    a pending TODO in name resolution, and also exposes (& fixes)
    an unnoticed name resolution problem in a module file test.
    
    Differential Revision: https://reviews.llvm.org/D109095
    klausler authored and vdonaldson committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    011a901 View commit details
    Browse the repository at this point in the history
  4. [flang] Extend common block size to cover equivalence storage

    The size of common block should be extended to cover any storage
    sequence that are storage associated with the common block via
    equivalences (8.10.2.2 point 1 (2)).
    
    In symbol size and offset computation, the size of the common block
    was not always extended to cover storage association. It was only done
    if the "base symbol of an equivalence group"(*) appeared in a common block
    statement. Correct this to cover all cases where a symbol appearing in a
    common block statement is storage associated.
    
    (*) the base symbol of an equivalence group is the symbol whose storage
    starts first in a storage association (if several symbols starts first,
    the base symbol is the last one visited by the algorithm going through
    the equivalence sets).
    
    Differential Revision: https://reviews.llvm.org/D109156
    jeanPerier authored and vdonaldson committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    82c7d3d View commit details
    Browse the repository at this point in the history
  5. [mlir][flang] Do not prevent integer types from being parsed as MLIR …

    …keywords
    
    DialectAsmParser::parseKeyword is rejecting `'i' digit+` while it is
    a valid identifier according to mlir/docs/LangRef.md.
    
    Integer types actually used to be TOK_KEYWORD a while back before the
    change: llvm@6af866c.
    
    This patch Modifies `isCurrentTokenAKeyword` to return true for tokens that
    match integer types too.
    
    The motivation for this change is the parsing of `!fir.type<{` `component-name: component-type,`+ `}>`
    type in FIR that represent Fortran derived types. The component-names are
    parsed as keywords, and can very well be i32 or any ixxx (which are
    valid Fortran derived type component names).
    
    The Quant dialect type parser had to be modified since it relied on `iw` not
    being parsed as keywords.
    
    Differential Revision: https://reviews.llvm.org/D108913
    jeanPerier authored and vdonaldson committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    e8c242a View commit details
    Browse the repository at this point in the history
  6. Remove blank from NaN string representation

    Flang front end function DumpHexadecimal generates a string
    representation of a REAL value.  When the value is a NaN, the string
    contains a blank, as in "NaN 0x7fc00000".  This function is used by
    lowering to generate a string that is then passed to llvm Support
    function convertFromStringSpecials, which does not expect a blank
    in the string.  Remove the blank to allow correct recognition of a
    NaN by this llvm function.
    
    Note that function DumpHexadecimal is not exercised by the front end
    itself.  This functionality is only exercised by code that is not yet
    present in llvm.
    vdonaldson committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    aaf83b5 View commit details
    Browse the repository at this point in the history
  7. Merge pull request flang-compiler#1037 from flang-compiler/jpr-fix-ch…

    …14egs
    
    Handle zero sized equivalence in lowering
    jeanPerier authored Sep 8, 2021
    Configuration menu
    Copy the full SHA
    8fe40e0 View commit details
    Browse the repository at this point in the history
  8. Merge pull request flang-compiler#1039 from schweitzpgi/ch-p9

    Fix array value threading to allow degenerate assignments. The front end
    schweitzpgi authored Sep 8, 2021
    Configuration menu
    Copy the full SHA
    d3c498a View commit details
    Browse the repository at this point in the history
  9. review comments

    schweitzpgi committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    735c474 View commit details
    Browse the repository at this point in the history
  10. Merge pull request flang-compiler#1045 from schweitzpgi/ch-m1a

    Fix fir.coordinate_of op use with char<kind,?> types.
    schweitzpgi authored Sep 8, 2021
    Configuration menu
    Copy the full SHA
    eac8473 View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2021

  1. [flang] Move runtime API headers to flang/include/flang/Runtime

    This commit cherry-picks the change that Peter made in llvm-project and
    makes additional changes to account for the differences between fir-dev
    and llvm-project.
    
    Here's the original message from Peter's change in Phabricator in
    llvm-project:
    
    Move the closure of the subset of flang/runtime/*.h header files that
    are referenced by source files outside flang/runtime (apart from unit tests)
    into a new directory (flang/include/flang/Runtime) so that relative
    include paths into ../runtime need not be used.
    
    flang/runtime/pgmath.h.inc is moved to flang/include/flang/Evaluate;
    it's not used by the runtime.
    
    Differential Revision: https://reviews.llvm.org/D109107
    klausler authored and psteinfeld committed Sep 9, 2021
    Configuration menu
    Copy the full SHA
    443c77a View commit details
    Browse the repository at this point in the history
  2. Merge pull request flang-compiler#1047 from flang-compiler/ps-cherry-…

    …pick
    
    [flang] Move runtime API headers to flang/include/flang/Runtime
    psteinfeld authored Sep 9, 2021
    Configuration menu
    Copy the full SHA
    df66885 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2021

  1. Move the scope of the mask buffers to just outside the outermost FORA…

    …LL context.
    
    Add the ability to allocate array buffers in a lazy manner. This can be helpful
    if the size of a temporary buffer isn't easily computed before the loop nest
    begins execution.
    schweitzpgi committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    8130cad View commit details
    Browse the repository at this point in the history
  2. [flang] Signal EOR in non advancing IO and move to next record

    When an end of record is met in non advancing IO:
    - Set IOSTAT if present according to 12.11.4 (5).
    - Position the file to the next record (12.11.4 (4)).
    
    The previous code was only signaling EOR for fixed record length IO.
    Reading at 12.11.4, I do not find the rational for this condition, so I
    removed it.
    It also does not seem the presence of padding should prevent
    the EOR signaling.
    
    The positionning to the next record was block when EOR is signaling
    in FinishReadingRecord because ErrorHandler.isError() is true in this
    case.
    EOR in input is not an error, but I am not confident to modify
    ErrorHandler.isError() to cover that. However, In FinishReadingRecord,
    the code should not bail if the error is simply an end of record.
    
    I did not check the SIZE requirements here because GetSize runtime is
    not yet implemented.
    
    Differential Revision: https://reviews.llvm.org/D109505
    jeanPerier committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    424c2e0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8399bd1 View commit details
    Browse the repository at this point in the history
  4. review comments

    schweitzpgi committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    f1cecf5 View commit details
    Browse the repository at this point in the history
  5. Merge pull request flang-compiler#1049 from schweitzpgi/ch-fw-lazy

    Move the scope of the mask buffers to just outside the outermost FORA…
    schweitzpgi authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    3ef51bf View commit details
    Browse the repository at this point in the history
  6. Merge pull request flang-compiler#1052 from flang-compiler/jpr-e78-lo…

    …wering
    
    Cherry pick non advancing IO runtime fix and add TODO for Size= specifier
    jeanPerier authored Sep 10, 2021
    Configuration menu
    Copy the full SHA
    0895ac2 View commit details
    Browse the repository at this point in the history

Commits on Sep 12, 2021

  1. [OpenMP][MLIR] Add a conversion pattern for the master op

    The conversion pattern is particularly useful for conversion of
    block arguments in the master op.
    
    Reviewed By: ftynse
    
    Differential Revision: https://reviews.llvm.org/D109610
    kiranchandramohan committed Sep 12, 2021
    Configuration menu
    Copy the full SHA
    393bce2 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2021

  1. Merge pull request flang-compiler#1053 from kiranchandramohan/fix_master

    [OpenMP][MLIR] Add a conversion pattern for the master op
    jeanPerier authored Sep 13, 2021
    Configuration menu
    Copy the full SHA
    410a9c2 View commit details
    Browse the repository at this point in the history
  2. [flang] Fix passing parts of array as writeable argument

    Always create a boxargument if we have an array, so that
    we can pass the address, rather than create a temporary array (that
    wasn't being copied back).
    
    This allows subroutines and functions to modify parts of arrays
    passed into them.
    
    Fixes flang-compiler#1001
    Leporacanthicus committed Sep 13, 2021
    Configuration menu
    Copy the full SHA
    cd0be43 View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2021

  1. Merge pull request flang-compiler#969 from Leporacanthicus/collapse

    [flang][OpenMP] Add support for collapse clause
    schweitzpgi authored Sep 14, 2021
    Configuration menu
    Copy the full SHA
    18ec1ad View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fbb3d2e View commit details
    Browse the repository at this point in the history
  3. [mlir] ODS: do not emit trailing const for static methods

    The generated C++ would be invalid.
    
    Reviewed By: rriddle
    
    Differential Revision: https://reviews.llvm.org/D104233
    ftynse authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    77cad11 View commit details
    Browse the repository at this point in the history
  4. [mlir] separable registration of attribute and type interfaces

    It may be desirable to provide an interface implementation for an attribute or
    a type without modifying the definition of said attribute or type. Notably,
    this allows to implement interfaces for attributes and types outside of the
    dialect that defines them and, in particular, provide interfaces for built-in
    types. Provide the mechanism to do so.
    
    Currently, separable registration requires the attribute or type to have been
    registered with the context, i.e. for the dialect containing the attribute or
    type to be loaded. This can be relaxed in the future using a mechanism similar
    to delayed dialect interface registration.
    
    See https://llvm.discourse.group/t/rfc-separable-attribute-type-interfaces/3637
    
    Depends On D104233
    
    Reviewed By: rriddle
    
    Differential Revision: https://reviews.llvm.org/D104234
    ftynse authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    14cde52 View commit details
    Browse the repository at this point in the history
  5. [mlir] Avoid GCC naming conflict.

    Rename AbstractType to AbstractTy to avoid a GCC naming conflict after https://reviews.llvm.org/D104234.
    
    Differential Revision: https://reviews.llvm.org/D104297
    Tobias Gysi authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    2e4d158 View commit details
    Browse the repository at this point in the history
  6. [mlir] separable registration of operation interfaces

    This is similar to attribute and type interfaces and mostly the same mechanism
    (FallbackModel / ExternalModel, ODS generation). There are minor differences in
    how the concept-based polymorphism is implemented for operations that are
    accounted for by ODS backends, and this essentially adds a test and exposes the
    API.
    
    Reviewed By: rriddle
    
    Differential Revision: https://reviews.llvm.org/D104294
    ftynse authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    ecd06db View commit details
    Browse the repository at this point in the history
  7. [mlir] Enable delayed registration of attribute/operation/type interf…

    …aces
    
    This functionality is similar to delayed registration of dialect interfaces. It
    allows external interface models to be registered before the dialect containing
    the attribute/operation/type interface is loaded, or even before the context is
    created.
    
    Reviewed By: rriddle
    
    Differential Revision: https://reviews.llvm.org/D104397
    ftynse authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    9621722 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ef203f5 View commit details
    Browse the repository at this point in the history
  9. [mlir] Split things dependent on LLVM_DEBUG into a .cpp file

    LLVM_DEBUG in headers is awkward, better avoid it. DEBUG_TYPE in a
    header results in a lot of macro redefinition warnings.
    d0k authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    e0c2e79 View commit details
    Browse the repository at this point in the history
  10. [mlir] add support for reductions in OpenMP WsLoopOp

    Use a modeling similar to SCF ParallelOp to support arbitrary parallel
    reductions. The two main differences are: (1) reductions are named and declared
    beforehand similarly to functions using a special op that provides the neutral
    element, the reduction code and optionally the atomic reduction code; (2)
    reductions go through memory instead because this is closer to the OpenMP
    semantics.
    
    See https://llvm.discourse.group/t/rfc-openmp-reduction-support/3367.
    
    Reviewed By: kiranchandramohan
    
    Differential Revision: https://reviews.llvm.org/D105358
    ftynse authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    713ca6b View commit details
    Browse the repository at this point in the history
  11. [OMPIRBuilder] add minimalist reduction support

    This introduces a builder function for emitting IR performing reductions in
    OpenMP. Reduction variable privatization and initialization to the
    reduction-neutral value is expected to be handled separately. The caller
    provides the reduction functions. Further commits can provide implementation of
    reduction functions for the reduction operators defined in the OpenMP
    specification.
    
    This implementation was tested on an MLIR fork targeting OpenMP from C and
    produced correct executable code.
    
    Reviewed By: Meinersbur
    
    Differential Revision: https://reviews.llvm.org/D104928
    ftynse authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    7208d06 View commit details
    Browse the repository at this point in the history
  12. [OpenMPIRBuilder] Add a constructor to ReductionInfo to appease gcc5

    Otherwise, it produces wrong code for brace initializers.
    ftynse authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    c046931 View commit details
    Browse the repository at this point in the history
  13. [MLIR][OpenMP] Add support for critical construct

    This patch adds the critical construct to the OpenMP dialect. The
    implementation models the definition in 2.17.1 of the OpenMP 5 standard.
    A name and hint can be specified. The name is a global entity or has
    external linkage, it is modelled as a FlatSymbolRefAttr. Hint is
    modelled as an integer enum attribute.
    Also lowering to LLVM IR using the OpenMP IRBuilder.
    
    Reviewed By: ftynse
    
    Differential Revision: https://reviews.llvm.org/D107135
    kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    7549dcf View commit details
    Browse the repository at this point in the history
  14. [mlir] support collapsed loops in OpenMP-to-LLVM translation

    Reviewed By: Meinersbur
    
    Differential Revision: https://reviews.llvm.org/D105706
    ftynse authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    3fac959 View commit details
    Browse the repository at this point in the history
  15. [OMPIRBuilder] Clarify CanonicalLoopInfo. NFC.

    Add in-source documentation on how CanonicalLoopInfo is intended to be used. In particular, clarify what parts of a CanonicalLoopInfo is considered part of the loop, that those parts must be side-effect free, and that InsertPoints to instructions outside those parts can be expected to be preserved after method calls implementing loop-associated directives.
    
    CanonicalLoopInfo are now invalidated after it does not describe canonical loop anymore and asserts when trying to use it afterwards.
    
    In addition, rename `createXYZWorkshareLoop` to `applyXYZWorkshareLoop` and remove the update location to avoid that the impression that they insert something from scratch at that location where in reality its InsertPoint is ignored. createStaticWorkshareLoop does not return a CanonicalLoopInfo anymore. First, it was not a canonical loop in the clarified sense (containing side-effects in form of calls to the OpenMP runtime). Second, it is ambiguous which of the two possible canonical loops it should actually return. It will not be needed before a feature expected to be introduced in OpenMP 6.0
    
    Also see discussion in D105706.
    
    Reviewed By: ftynse
    
    Differential Revision: https://reviews.llvm.org/D107540
    Meinersbur authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    8379767 View commit details
    Browse the repository at this point in the history
  16. [mlir] support translating OpenMP loops with reductions

    Use the recently introduced OpenMPIRBuilder facility to transate OpenMP
    workshare loops with reductions to LLVM IR calling OpenMP runtime. Most of the
    heavy lifting is done at the OpenMPIRBuilder. When other OpenMP dialect
    constructs grow support for reductions, the translation can be updated to
    operate on, e.g., an operation interface for all reduction containers instead
    of workshare loops specifically. Designing such a generic translation for the
    single operation that currently supports reductions is premature since we don't
    know how the reduction modeling itself will be generalized.
    
    Reviewed By: kiranchandramohan
    
    Differential Revision: https://reviews.llvm.org/D107343
    ftynse authored and kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    406415a View commit details
    Browse the repository at this point in the history
  17. [MLIR][OpenMP] Add support for declaring critical construct names

    Add an operation omp.critical.declare to declare names/symbols of
    critical sections. Named omp.critical operations should use symbols
    declared by omp.critical.declare. Having a declare operation ensures
    that the names of critical sections are global and unique. In the
    lowering flow to LLVM IR, the OpenMP IRBuilder creates unique names
    for critical sections.
    
    Reviewed By: ftynse, jeanPerier
    
    Differential Revision: https://reviews.llvm.org/D108713
    kiranchandramohan committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    4ff1d0f View commit details
    Browse the repository at this point in the history
  18. Zero size arrays of derived type (flang-compiler#1050)

    Fix two problems with zero size arrays with derived type elements.
    
    The first problem occurs when the derived type element of a zero size
    array has default initialization.  -- fix in ConvertVariable.cpp
    
      type dt
        integer :: j = 17
      end type
      type(dt) :: z(0)
    
    The second problem occurs when the derived type element of a zero size
    array has an explicit, conformable, scalar initialization.  That appears
    to be standard conforming, if not too useful, although it has the side
    affect of forcing the SAVE attribute on z.  -- fix in ConvertExpr.cpp
    
      type dt
        integer :: j
      end type
      type(dt) :: z(0) = dt(99)
    
    Also add a verifier for fir.insert_on_range ops, which triggers for
    the first test case without the corresponding fix.
    vdonaldson authored Sep 14, 2021
    Configuration menu
    Copy the full SHA
    bf8ebcd View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2021

  1. Use name of an equivalence member in local aggregate alloca

    The member symbol that gives its name to the equivalence storage is
    the first in lexicographical order (just like for global aggregate).
    jeanPerier committed Sep 15, 2021
    Configuration menu
    Copy the full SHA
    7e78754 View commit details
    Browse the repository at this point in the history
  2. Merge pull request flang-compiler#1036 from Leporacanthicus/fix-array…

    …-args
    
    [flang] Fix passing parts of array as writeable argument
    jeanPerier authored Sep 15, 2021
    Configuration menu
    Copy the full SHA
    4dd70e1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    eb22fb4 View commit details
    Browse the repository at this point in the history
  4. Merge pull request flang-compiler#1060 from flang-compiler/jpr-name-l…

    …ocal-equiv
    
    Use name of an equivalence member in local aggregate alloca
    Renaud-K authored Sep 15, 2021
    Configuration menu
    Copy the full SHA
    90abadc View commit details
    Browse the repository at this point in the history
  5. Process block data programs early (flang-compiler#1059)

    Block data programs may initialize common block data, so process them
    in a preliminary pass (along with function declarations and module
    variables) to give them precedence over other common block declarations.
    vdonaldson authored Sep 15, 2021
    Configuration menu
    Copy the full SHA
    51261bd View commit details
    Browse the repository at this point in the history

Commits on Sep 16, 2021

  1. Merge pull request flang-compiler#1055 from kiranchandramohan/critica…

    …l_cherry_picks
    
    Cherry pick some patches required for supporting OpenMP critical construct
    jeanPerier authored Sep 16, 2021
    Configuration menu
    Copy the full SHA
    0efc2ba View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bb1ab87 View commit details
    Browse the repository at this point in the history
  3. Fix evaluation semantics of FORALL constructs per 10.2.4.2.4.

    When lowering of FORALL was refactored to split the work between the
    bridge and array expression lowering, the individual statements in a
    forall construct body were no longer being lowered one at a time. These
    changes add back the proper lowering.
    
    Changes include:
    
      - Factoring the rhs array base analysis to be by statement.
      - Fix bug with finalization of context stack.
      - Fix bug with rerunning the analysis.
      - Merge aspects of cleanup code gen.
      - Restructure loop nest lowering such that each assignment resides in
        its own copy of a loop nest.
      - Add a lazy shape buffer. Thread lazy mask buffers through the loop
        nest so that cached results are available.
      - Regenerate checks for tests.
      - Fixes for p9.
    
    Make forall-2.f90 source file name independent.
    
    Fix for k6 test, among others. Using incorrect statement context.
    
    Fix bug exposed by m7.
    
    Fix m7 bug.
    
    review comments
    schweitzpgi committed Sep 16, 2021
    Configuration menu
    Copy the full SHA
    126aa69 View commit details
    Browse the repository at this point in the history
  4. Merge pull request flang-compiler#1063 from schweitzpgi/ch-forall

    Fix evaluation semantics of FORALL constructs per 10.2.4.2.4.
    schweitzpgi authored Sep 16, 2021
    Configuration menu
    Copy the full SHA
    2af3c27 View commit details
    Browse the repository at this point in the history

Commits on Sep 17, 2021

  1. Fix shared library builds after flang-compiler#1061

    The added pass works when mlir::LLVM::LLVMDialect, mlir::acc::OpenACCDialect,
    and mlir::omp::OpenMPDialect are present, which adds a dependency on those
    dialect libraries.
    
    https://github.com/flang-compiler/f18-llvm-project/blob/bb1ab876a5fec1eb3f2ab0603756f9124515a68a/flang/include/flang/Optimizer/Transforms/Passes.td#L189
    jeanPerier committed Sep 17, 2021
    Configuration menu
    Copy the full SHA
    ff9e169 View commit details
    Browse the repository at this point in the history
  2. Lower IO input with vector subscripts

    Define a VectorSubscriptBox class that allow representing and working
    with a lowered Designator containing vector subscripts while ensuring
    all the subscripts expression are only lowered once.
    
    It's a bit of a super ExtendedValue (but is is not added as such because
    it is heavy and its use case is only restricted to IO input so far).
    
    The key point of this class is that it has members functions
    `loopOverElements` and `loopOverElementsWhile` that allow creating loops
    over each element of the designator, and call a provided callback with
    the address of the element.
    
    This class is used in input IO to create an IO runtime call for each
    element of the designator, since it is not possible to build a
    descriptor for it. The `loopOverElementsWhile` version is required when
    error recovery is enabled in IO.
    
    A hidden VectorSubscriptBoxBuilder is in charge of making a custom
    Designator<T> visit and create the VectorSubscriptBox. Once this is
    done, the VectorSubscriptBox does not equire any front-end data
    structures to work with.
    
    The motivation for creating such tool is that the current lowering
    array lowering infrastructure is centered around assignment (to a
    variable or temporary), and could not be used here to created the loops
    over the IO runtime calls without some non trivial modification to it.
    Adding complexity to the array expression lowering framework to cover
    a corner case did not appear a good idea.
    
    The option of creating a temp, passing it to the runtime, and copying it
    back was explored, but it was not possible to guarantee that the
    subscript would be evaluated only once given there was no way to "keep
    the lowered representation" of the designator between the temp creation
    and the copy back (the temp creation requires evaluating the susbcripts
    to compute the shape in general). However, note that with the added
    VectorSubscriptBox, it would actually now also be possible to deploy a
    temp + copy back mechanism. This can be done later if it appeared
    beneficial in real world program.
    
    The only cases left TODOs are the cases when one of the Components
    is a parent type reference (not yet handled properly in the general case),
    the coarray case, and the PDT case (not sure exactly how type params
    will be threaded in fir.field_index). All other cases are covered, and
    I tried to add exhaustive tests since I do not expect real world program
    to be very harsh on this utility (most will just do READ(*, *) x(y)).
    jeanPerier committed Sep 17, 2021
    Configuration menu
    Copy the full SHA
    753aef9 View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#1057 from flang-compiler/jpr-vector…

    …-io-2
    
    Lower IO input with vector subscripts
    jeanPerier authored Sep 17, 2021
    Configuration menu
    Copy the full SHA
    40d96d4 View commit details
    Browse the repository at this point in the history
  4. Changes so that temporaries do not use uniq_name.

    Also fix some tests that were walls of CHECK-DAG checks.
    schweitzpgi committed Sep 17, 2021
    Configuration menu
    Copy the full SHA
    6286954 View commit details
    Browse the repository at this point in the history
  5. Merge pull request flang-compiler#1070 from schweitzpgi/ch-uniqname

    Changes so that temporaries do not use uniq_name.
    schweitzpgi authored Sep 17, 2021
    Configuration menu
    Copy the full SHA
    76c6aa0 View commit details
    Browse the repository at this point in the history

Commits on Sep 20, 2021

  1. Fix lit tests after 1070 change.

    - Some file name size made it into transfer.f90 test in flang-compiler#1070 test update
    through the fir.char<?,90> type. This makes the test dependent on where
    LLVM directory is. Replace fir.char<?,90> by fir.char<?,{{.*}}>
    
    - vector-subscript-io.f90 was not updated with the uniq_name ->
    bindc_name change in flang-compiler#1070.
    jeanPerier committed Sep 20, 2021
    Configuration menu
    Copy the full SHA
    63130d8 View commit details
    Browse the repository at this point in the history
  2. Lower elemental subroutine calls (outside of user assignment case)

    Use the array lowering framework to lower elemental subroutine.
    This required:
    
    - Splitting the part of genIterSpace that creates the
      implicit loops into a new genImplicitLoops function. genIterspace
      deals with the destination and other explicit contexts set-ups that
      do not matter in the subroutine case (there is no destination).
      Other than having no destination, a big difference is that there is
      no threaded innerArg. genImplicitLoops handles this variation.
    
    - Fixing a bug in the iteration shape determination. The code was
      assuming there would always be at least one array_load, which is
      not true if there are only RefTransparent operands. This is always
      true in the subroutine case, but was actually also an issue for things
      like `print *, elem_func(array)` with the previous code (compile crash).
      Add a new ArrayOperands structure to keep track of what matters to
      later deduce the shape of the array expression instead of keeping
      track of array_loads for that purpose.
    
    - Elemental subroutine with intent(out)/intent(inout) arguments must be
      applied "in array element order" (15.8.3). It turns out this is also
      the case for impure elemental functions (10.1.4 p5). Instead of always
      creating loops as "unordered=true" add an unordered field to the ArrayExprLowering
      class. It is set to true by default, but will be set to false if any
      impure elemental function is lowered, or in case of
      intent(out)/intent(inout) arguments in elemental subroutines.
    
    - Last, instead of using createFirExpr to lowering subroutine calls, use
      a new createSubroutineCall that deals with the array/scalar
      dispatching.
    
    A TODO is added for the user defined elemental assignment, because
    overlap analysis between RHS/LHS must be done, and this require somehow
    plugging this special and very restricted case of elemental calls into
    the array_load/array_update/array_merge framework or some ad-hoc
    lowering.
    jeanPerier committed Sep 20, 2021
    Configuration menu
    Copy the full SHA
    6227665 View commit details
    Browse the repository at this point in the history
  3. Merge pull request flang-compiler#1069 from flang-compiler/jpr-elem-s…

    …ub-2
    
    Lower elemental subroutine calls (outside of user assignment case)
    jeanPerier authored Sep 20, 2021
    Configuration menu
    Copy the full SHA
    0b3fa79 View commit details
    Browse the repository at this point in the history

Commits on Sep 23, 2021

  1. [flang] Add runtime interface for NUM_IMAGES

    NUM_IMAGES takes optional arguments TEAM and TEAM_NUMBER.  This
    patch provides an interface for only the optional TEAM_NUMBER
    dummy argument.  It is likely that a different function will
    be required to support TEAM arguments.
    
    Reviewed By: PeteSteinfeld, klausler
    
    Differential Revision: https://reviews.llvm.org/D109547
    rasmussn committed Sep 23, 2021
    Configuration menu
    Copy the full SHA
    72f2ed3 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2021

  1. [flang] NUM_IMAGES(TEAM_NUMBER) runtime implementation

    This commit provides a single-image implementation of NUM_IMAGES.
    It returns 1.
    rasmussn committed Sep 24, 2021
    Configuration menu
    Copy the full SHA
    3d2f9d0 View commit details
    Browse the repository at this point in the history