[all-commits] [llvm/llvm-project] 02f3fe: [flang] Compute type allocation size based on the ...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Fri Sep 9 08:48:16 PDT 2022


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

  Changed paths:
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    M flang/test/Fir/alloc.fir
    M flang/test/Fir/arrexp.fir
    M flang/test/Fir/box.fir
    M flang/test/Fir/convert-to-llvm.fir
    M flang/test/Fir/embox.fir
    M flang/test/Fir/rebox.fir
    M flang/test/Lower/forall/character-1.f90

  Log Message:
  -----------
  [flang] Compute type allocation size based on the actual target representation.

This change makes sure that we compute the element size and the byte stride
based on the target representation of the element type.

For example, when REAL*10 is mapped to x86_fp80 each element occupies
16 bytes rather than 10 because of the padding.

Note that the size computation method used here actually returns
the distance between two adjacent element of the *same* type in memory
(which is equivalent to llvm::DataLayout::getTypeAllocSize()).
It does not return the number of bytes that may be overwritten
by storing a value of the specified type (e.g. what can be computed
via llvm::DataLayout::getTypeStoreSize(), but not available in
mlir::DataLayout).

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




More information about the All-commits mailing list