[all-commits] [llvm/llvm-project] f59ba0: [StructLayout] Use TrailingObjects to allocate spa...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Mar 30 17:37:55 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f59ba0849f7a148265dcc89d36a11717d365f368
      https://github.com/llvm/llvm-project/commit/f59ba0849f7a148265dcc89d36a11717d365f368
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2021-03-30 (Tue, 30 Mar 2021)

  Changed paths:
    M llvm/include/llvm/IR/DataLayout.h
    M llvm/lib/IR/DataLayout.cpp

  Log Message:
  -----------
  [StructLayout] Use TrailingObjects to allocate space for MemberOffsets.

MemberOffsets are stored at the end of StructLayout. The class
contains a single entry array to mark the start of the member
offsets. getStructLayout calculates the additional space needed
for additional elements before allocating memory.

This patch converts this to use TrailingObjects. This simplifies
the size computation in getStructLayout and gets rid of the
single entry array.

This is prep work, but to use TypeSize instead of uint64_t for
D98169. The single entry array doesn't work with TypeSize because
TypeSize doesn't have a default constructor. We thought this
change was an improvement by itself so we've separated it out.

Reviewed By: mehdi_amini

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




More information about the All-commits mailing list