[PATCH] D86310: [X86] Align i128 to 16 bytes in x86-64 datalayout

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 15:13:26 PDT 2020


efriedma added a comment.

As far as I know, there are basically three categories of things that depend on the alignment of a type.

1. The default alignment of load/store/alloca.  On trunk, load/store/alloca always have explicitly specified alignment in memory.  That said, old bitcode doesn't have explicit alignment in some cases, and we currently run UpgradeDataLayoutString() before we actually parse the IR instructions.
2. The default alignment of global variables.  Globals are allowed to have unspecified alignment, and the resulting alignment is implicitly computed by a sort of tricky algorithm.  We could look into forcing it to be computed explicitly, but it's a lot of work because there are a lot of places in the code that create globals without specifying the alignment.
3. The layout of other types: for a struct that isn't packed, LLVM implicitly inserts padding to ensure it's aligned.  To make this work correctly, you'd have to rewrite the types of every global/load/store/GEP/etc so they don't depend on the alignment of i128.

To autoupgrade correctly, we have to handle all three of those.

We can't just weaken the compatible datalayout check because the modules are actually incompatible, for the above reasons.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86310/new/

https://reviews.llvm.org/D86310



More information about the llvm-commits mailing list