[PATCH] D96536: Make sure some types are indeed trivially_copyable per llvm::is_trivially_copyable
Danila Malyutin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 25 04:31:04 PST 2021
danilaml added a comment.
In D96536#2585609 <https://reviews.llvm.org/D96536#2585609>, @serge-sans-paille wrote:
>> 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.
That would cause a linking issue. I was talking about error in https://reviews.llvm.org/D92591#2431801
These tests are enough to ensure that we get expected result for llvm::is_trivially_*_constructible for types we care about but they don't test `is_trivially_copyable`.
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