[all-commits] [llvm/llvm-project] bd5371: [flang] Fix LBOUND() folding for constant arrays

FruitClover via All-commits all-commits at lists.llvm.org
Wed Apr 20 10:04:46 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bd5371e4fc607aae1a77f29273fd130b59e72409
      https://github.com/llvm/llvm-project/commit/bd5371e4fc607aae1a77f29273fd130b59e72409
  Author: Mike Kashkarov <fruitclover at gmail.com>
  Date:   2022-04-20 (Wed, 20 Apr 2022)

  Changed paths:
    M flang/lib/Evaluate/fold-integer.cpp
    M flang/test/Evaluate/folding08.f90

  Log Message:
  -----------
  [flang] Fix LBOUND() folding for constant arrays

Previously constant folding uses 'dim' without checks which leads to ICE if we
do not have DIM= parameter. And for inputs without DIM= we need to form an
array of rank size with computed bounds instead of single value.

Add additional PackageConstant function to simplify 'if (dim)' handling since we
need to distinguish between scalar initialization in case of DIM= argument and
rank=1 array.

Also add a few more tests with 'parameter' type to verify folding for constant
arrays.

Reviewed By: jeanPerier

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




More information about the All-commits mailing list