[all-commits] [llvm/llvm-project] 5bc9ee: [flang][lowering] Handle zero extent case in LBOUND

jeanPerier via All-commits all-commits at lists.llvm.org
Fri Mar 25 10:07:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5bc9ee1b780656c6d7f27c4ca657c5a7815311c1
      https://github.com/llvm/llvm-project/commit/5bc9ee1b780656c6d7f27c4ca657c5a7815311c1
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2022-03-25 (Fri, 25 Mar 2022)

  Changed paths:
    M flang/include/flang/Optimizer/Builder/BoxValue.h
    M flang/include/flang/Optimizer/Builder/FIRBuilder.h
    M flang/lib/Lower/ConvertVariable.cpp
    M flang/lib/Lower/IntrinsicCall.cpp
    M flang/lib/Optimizer/Builder/BoxValue.cpp
    M flang/lib/Optimizer/Builder/Character.cpp
    M flang/lib/Optimizer/Builder/FIRBuilder.cpp
    M flang/test/Lower/array-expression.f90
    M flang/test/Lower/call-parenthesized-arg.f90
    M flang/test/Lower/character-local-variables.f90
    M flang/test/Lower/forall/test9.f90

  Log Message:
  -----------
  [flang][lowering] Handle zero extent case in LBOUND

Follow up of https://reviews.llvm.org/D121488. Ensure lower bounds
are `1` when the related dimension extent is zero. Note that lower
bounds from descriptors are now guaranteed to fulfill this property
after the runtime/codegen patches.

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

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

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

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




More information about the All-commits mailing list