[PATCH] D24425: DebugInfo: support for DWARFv5 DW_AT_alignment attribute

Victor Leschuk via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 10 12:25:56 PDT 2016


vleschuk added a comment.

> In https://reviews.llvm.org/D24425#539028, @dblaikie wrote:




>   Alignment value (whether it is default or user-defined) must be present in IR in order to be able to generate correct code,




> I'm not sure I follow this ^ - the metadata here is only for debug info. It's not used for correctness of the resulting program. (the alignment of pointers in the IR for actual code generation is stored separately).


Correct. Debug Info dump doesn't influence code generation. Bad example from my side.

> I'll try to rephrase:




> Is the alignment currently emitted in the debug info IR metadata used for anything? Seems it's used for bitfield related things, but perhaps that's not the right solution/we could do that another way? So that the alignment just corresponds directly to the DW_AT_alignment (eg: when present, emit an alignment attribute, otherwise don't) to keep the metadata simple.


Ah, I got it now. You suggest the following way:

- Do not add DINode::FlagAlignment
- Do not add alignment to DI* objects when creating them unless alignment was forced by user
- When generating DWARF output emit DW_AT_alignment if DI* object has non-zero alignment field

I have looked through the code and you seem to be correct, actually the align value from DI* objects is used only when working with bitfields. I think I should consult with llvm-dev@ before breaking anything.


https://reviews.llvm.org/D24425





More information about the llvm-commits mailing list