[all-commits] [llvm/llvm-project] d37250: [flang][runtime] Fixes for element size calculation.

Slava Zakharin via All-commits all-commits at lists.llvm.org
Thu Sep 22 10:13:09 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d37250c9db48d12b6ba66e10a2ccaf8e3e66b547
      https://github.com/llvm/llvm-project/commit/d37250c9db48d12b6ba66e10a2ccaf8e3e66b547
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2022-09-22 (Thu, 22 Sep 2022)

  Changed paths:
    M flang/include/flang/Runtime/descriptor.h
    M flang/runtime/ISO_Fortran_binding.cpp
    A flang/runtime/ISO_Fortran_util.h
    M flang/runtime/descriptor.cpp
    M flang/runtime/extrema.cpp
    M flang/runtime/reduction-templates.h
    M flang/runtime/reduction.cpp
    M flang/runtime/type-code.cpp
    M flang/unittests/Runtime/Transformational.cpp

  Log Message:
  -----------
  [flang][runtime] Fixes for element size calculation.

BytesFor() used to return KIND for the size, which is not always
correct, so I changed it to return the size of the actual CppType
corresponding to the given category and kind.

MinElemLen() used to calculate size incorrectly (e.g. CFI_type_extended_double
was sized 10, whereas it may occupy more bytes on a target), so I changed it
to call BytesFor().

Additional changes were needed to resolve new failures for transformational
intrinsics. These intrinsics used to work for not fully supported
data types (e.g. REAL(3)), but now stopped working because CppType
cannot be computed for those categories/kinds. The solution is to use
known element size from the source argument(s) for establishing
the destination descriptor - the element size is all that is needed
for transformational intrinsics to keep working.

Note that this does not help cases, where runtime still has to
compute the element size, e.g. when it creates descriptors for
components of derived types. If the component has unsupported
data type, BytesFor() will still fail. So these cases require
adding support for the missing types.

New regression unit test in Runtime/Transformational.cpp
demonstrates the case that will start working properly with
this commit.




More information about the All-commits mailing list