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

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 12 16:06:15 PDT 2016


dblaikie added a comment.

Like the backend patch, should/could this be broken up into separate patches for the different places/features that have alignment?

(probably just passing zero for alignment in general could be a simple cleanup patch to start, if it's otherwise unused)


================
Comment at: lib/CodeGen/CGDebugInfo.cpp:609
@@ -609,3 +608,3 @@
   uint64_t Size = CGM.getContext().getTypeSize(Ty);
-  uint64_t Align = CGM.getContext().getTypeAlign(Ty);
+  uint64_t Align = 0;
   return DBuilder.createBasicType("complex", Size, Align, Encoding);
----------------
Maybe add a comment here about why we're specifying zero alignment (or possibly change the API to not take an alignment at all so we don't have to explain it?)

(similarly for other cases where the alignment is just hardcoded to zero)

================
Comment at: lib/CodeGen/CGDebugInfo.cpp:3691
@@ -3635,1 +3690,3 @@
+  if (D->hasAttr<AlignedAttr>())
+    AlignInBits = D->getMaxAlignment();
   StringRef DeclName, LinkageName;
----------------
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?)


https://reviews.llvm.org/D24426





More information about the cfe-commits mailing list