This is an archive of the discontinued LLVM Phabricator instance.

[GlobalOpt] Include padding in debug fragments
ClosedPublic

Authored by dstenb on Feb 1 2018, 10:38 AM.

Details

Summary

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.

Diff Detail

Event Timeline

dstenb created this revision.Feb 1 2018, 10:38 AM
aprantl accepted this revision.Feb 1 2018, 10:42 AM
aprantl added inline comments.
test/DebugInfo/X86/global-sra-fp80-array.ll
89

Could you please strip out all nonessential attributes? (everything in quotes)

test/DebugInfo/X86/global-sra-fp80-struct.ll
92

same here

This revision is now accepted and ready to land.Feb 1 2018, 10:42 AM
dstenb updated this revision to Diff 132426.Feb 1 2018, 10:55 AM

Removed nonessential attributes.

dstenb marked 2 inline comments as done.Feb 1 2018, 10:56 AM
This revision was automatically updated to reflect the committed changes.
uabelho added a subscriber: uabelho.Feb 2 2018, 2:36 AM

I pushed this for David.