[all-commits] [llvm/llvm-project] 7ae391: [flang]Fix incorrect array type transformation

Mats Petersson via All-commits all-commits at lists.llvm.org
Thu Jul 28 13:00:29 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7ae391148d6fba31fa4cb84678fe28ce6638e98c
  Author: Mats Petersson <mats.petersson at arm.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M flang/include/flang/Lower/SymbolMap.h
    M flang/include/flang/Optimizer/Dialect/FIRType.h
    M flang/include/flang/Optimizer/Dialect/FIRTypes.td
    M flang/lib/Lower/ConvertExpr.cpp
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    M flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
    M flang/lib/Optimizer/CodeGen/TypeConverter.h
    M flang/lib/Optimizer/Dialect/FIRType.cpp
    M flang/test/Fir/alloc.fir
    M flang/test/Fir/convert-to-llvm.fir
    M flang/test/Fir/types-to-llvm.fir

  Log Message:
  [flang]Fix incorrect array type transformation

When an array is defined with "unknown" size, such as fir.array<2x?x5xi32>,
it should be converted to llvm.array<10 x i32>. The code so far has
been converting it to llvm.ptr<i32>.

Using a different function to check the if there starting are constant
dimensions, rather than if ALL dimensions are constant, it now produces
the correct array form.

Some tests has been updated, so they are now checking the new behaviour
rather than the old behaviour - so there's no need to add further tests
for this particular scenario.

This was originally found when compiling Spec 17 code, where an assert
in a GepOP was hit. That is bug #56141, which this change fixes.

Reviewed By: jeanPerier

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

More information about the All-commits mailing list