Otherwise, with recent versions of libstdc++, clang can't tell that the atomic operations are properly aligned, and generates calls to libatomic.
Fixes https://github.com/llvm/llvm-project/issues/54790 , at least for that specific case.
Differential D123872
Force GHashCell to be 8-byte-aligned. efriedma on Apr 15 2022, 1:09 PM. Authored by
Details
Otherwise, with recent versions of libstdc++, clang can't tell that the atomic operations are properly aligned, and generates calls to libatomic. Fixes https://github.com/llvm/llvm-project/issues/54790 , at least for that specific case.
Diff Detail
Event TimelineComment Actions Sidenote: Oh, yikes! I didn't even notice before that this code is doing reinterpret_cast from a GHashCell* to a std::atomic<GHashCell>*. That's...kinda not great... Comment Actions Seems worth mentioning auto *cellPtr = reinterpret_cast<std::atomic<GHashCell> *>(&table[idx]); Comment Actions I know nearly nothing about COFF debugging. I assume there is better way avoiding the reinterpret_cast but this patch as-is is safe for 14.x backport. Comment Actions lgtm Yeah, I think I was excited with the performance results, and shipped some prototype code. The idea is that we only need to do atomic operations during hash table insertion. Afterwards, the table is used as readonly data. I wouldn't be surprised if there are issues lurking here for ISAs with weak memory models. |