[PATCH] D42807: [GlobalOpt] Include padding in debug fragments

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 10:39:28 PST 2018


dstenb created this revision.
dstenb added reviewers: aprantl, JDevlieghere.
dstenb added a project: debug-info.
Herald added a subscriber: llvm-commits.

When creating the debug fragments for a SRA'd variable, use the types'
allocation sizes. This fixes issues where the pass would emit too small
fragments, placed at the wrong offset, for padded types.

An example of this is long double on x86. The type is represented using
x86_fp80, which is 10 bytes, but the value is aligned to 12/16 bytes.
The padding is included in the type's DW_AT_byte_size attribute;
therefore, the fragments should also include that. Newer GCC releases
(I tested 7.2.0) emit 12/16-byte pieces for long double. Earlier
releases, e.g. GCC 5.5.0, behaved as LLVM did, i.e. by emitting a
10-byte piece, followed by an empty 2/6-byte piece for the padding.

Failing to cover all `DW_AT_byte_size' bytes of a value with non-empty
pieces results in the value being printed as <optimized out> by GDB.


Repository:
  rL LLVM

https://reviews.llvm.org/D42807

Files:
  lib/Transforms/IPO/GlobalOpt.cpp
  test/DebugInfo/X86/global-sra-fp80-array.ll
  test/DebugInfo/X86/global-sra-fp80-struct.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42807.132423.patch
Type: text/x-patch
Size: 15073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180201/4061ba55/attachment.bin>


More information about the llvm-commits mailing list