[PATCH] D96536: Make sure some types are indeed trivially_copyable per llvm::is_trivially_copyable
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 24 11:35:44 PST 2021
serge-sans-paille added a comment.
> Also not sure why the attempt to replace llvm:: with std:: has failed (probably some weird mix of obsolete STL with a newer patched GCC), although if it's the ABI we want, it doesn't matter.
The root of this problem lies in `llvm::OptionalStorage` which is specialized based on the value of `llvm::is_trivially_copyable`. In order to guarantee that code compiled with, say, clang, can link with LLVM compiled with, say gcc, we need to guarantee that the same specialization happen for the same type. That's the problem described in the bug https://bugs.llvm.org/show_bug.cgi?id=39427 I quoted in the commit comment.
As you point out, we cannot rely on `std::is_trivially_copyable` to enforce that guarantee, because it's not reproducible across compiler (this is something I didn't know back in the day, and probably hold true at some point for a subset of compiler large enough not to trigger the assert I added).
This is why we're looking for decent way to ensure `llvm::is_trivially_copyable` behaves thr same across compilers. And this patch is a decent minimal approach at doing so.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96536/new/
https://reviews.llvm.org/D96536
More information about the llvm-commits
mailing list