[PATCH] D86310: [X86] Align i128 to 16 bytes in x86 datalayouts

Trevor Gross via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 19:01:33 PDT 2023


tmgross added a comment.

In D86310#4597359 <https://reviews.llvm.org/D86310#4597359>, @hvdijk wrote:

>> I cannot reproduce that failure for some reason, but it would likely make a good run-pass test.
>
> It's reproducible online, https://godbolt.org/z/j918EeoMv, it would be interesting to know why it does not fail for you.

I tested both on my machine and in a container (debian docker image, then installing `clang` and `gcc-multilib` only) and can't get it to reproduce. Weird.

  $ clang --version
  Ubuntu clang version 14.0.0-1ubuntu1.1
  Target: x86_64-pc-linux-gnu
  Thread model: posix
  InstalledDir: /usr/bin
  $ cat stack-fail.c
  int main(void) {
    long double ld = 0;
    __float128 f128 = ld;
    int i = f128;
    return i;
  }
  $ clang -m32 stack-fail.c && ./a.out && echo ok
  ok

F28728037: stack-fail.s <https://reviews.llvm.org/F28728037>
F28728038: stack-fail.ll <https://reviews.llvm.org/F28728038>

The IR looks about the same as on godbolt but maybe the attributes are affecting something. It's probably still doing the wrong thing, just not segfaulting for whatever reason

>> These two patches do not seem to fix varargs segfaulting, as documented in https://bugs.llvm.org/show_bug.cgi?id=19909 (testing with this code https://godbolt.org/z/WeE7TvrGe) so it seems like that will need a separate fix.
>
> Thanks, and clang appears to avoid the use of the LLVM `va_arg` instruction here; we'll have to make sure to adapt that example to the LLVM IR equivalent that does use `va_arg` to make sure that's tested as well, and fixed if needed.

Are you comfortable landing these two patches without fixing varargs, since it seems like those need separate work? Not sure if llvm follows kernel conventions but assuming yes and assuming you are OK with however D158169 <https://reviews.llvm.org/D158169> seems to fix clang, you can add `Tested-by: Trevor Gross <tmgross at umich.edu>`: to the best of my knowledge the alignment, ABI, and general interop problems on x86_64 have been resolved for both LLVM and Clang.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86310



More information about the cfe-commits mailing list