[PATCH] D49209: CodeGen: specify alignment for automatic variable initialization

JF Bastien via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 13 10:26:01 PDT 2018


jfb marked an inline comment as done.
jfb added inline comments.


================
Comment at: lib/CodeGen/CGBuilder.h:260
+                            CharUnits::fromQuantity(Offset.getSExtValue())));
+  }
+
----------------
efriedma wrote:
> Not sure about the new helper.  We already have CreateStructGEP and CreateConstArrayGEP which do approximately what you want.
It's close to doing what we want, but not quite? It seems like the original code would have used them otherwise.

To use them we'd have to:

  - branch on struct / array
    - for struct calculate the offset there (which the new helper does)
    - for array get the element size

Seems simpler to use GEP2_32 and more fool-proof to (internal to the helper) use GEP's own idea of what the offset is, no?


Repository:
  rC Clang

https://reviews.llvm.org/D49209





More information about the cfe-commits mailing list