[PATCH] D24426: DebugInfo: Pass non-zero alignment to DIBuilder only if aligment was forced

Victor Leschuk via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 13 12:50:54 PDT 2016


vleschuk added inline comments.

================
Comment at: lib/CodeGen/CGDebugInfo.cpp:3691
@@ -3635,1 +3690,3 @@
+  if (D->hasAttr<AlignedAttr>())
+    AlignInBits = D->getMaxAlignment();
   StringRef DeclName, LinkageName;
----------------
probinson wrote:
> dblaikie wrote:
> > is max alignment the right thing here? Should it be min alignment?
> > (is alignment in bits the desired thing across all of this too? It looked like in the backend patch there was some division by CHAR_BITS, etc?)
> I should think bits is the right choice here; seems more the province of the backend to convert it into the appropriate addressable units (commonly but not universally chars).
> is max alignment the right thing here? Should it be min alignment?

The DWARF document says: 

> This constant describes the actual alignment used by the compiler (if there are multiple specified by the user, or if the user specified an alignment the compiler couldn't satisfy, then only the strictest alignment will be added through a DW_AT_alignment).

So I think max alignment is right choice here.


https://reviews.llvm.org/D24426





More information about the cfe-commits mailing list