This is an archive of the discontinued LLVM Phabricator instance.

[flang] Compute type allocation size based on the actual target representation.
ClosedPublic

Authored by vzakhari on Sep 8 2022, 10:58 AM.

Details

Summary

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).

Diff Detail

Event Timeline

vzakhari created this revision.Sep 8 2022, 10:58 AM
vzakhari requested review of this revision.Sep 8 2022, 10:58 AM
vzakhari updated this revision to Diff 458799.Sep 8 2022, 10:59 AM

clang-format

This revision is now accepted and ready to land.Sep 9 2022, 12:15 AM