This allows treating these functions like libcalls.
This patch is a prerequisite to instrumenting them in MSAN:
https://reviews.llvm.org/D83337
Differential D83361
[LLVM] Add libatomic load/store functions to TargetLibraryInfo guiand on Jul 7 2020, 5:08 PM. Authored by
Details This allows treating these functions like libcalls. This patch is a prerequisite to instrumenting them in MSAN: https://reviews.llvm.org/D83337
Diff Detail
Event TimelineComment Actions Don't you also have to set as Available/Unavailable when initializing the TLI?
Comment Actions Yes, thanks for the catch! It looks like it's set available by default, there may be platforms that don't have these libatomic functions available. From a look at RuntimeLibCalls, where these functions are also used (for emitting), it looks like the functions are only explicitly made unavailable on webassembly. (Which is pretty surprising! Could I be missing something here?) Comment Actions I had gotten the impression that these calls aren't supported on WebAssembly by lines in WebAssemblyRuntimeLibcallSignatures.cpp like: Table[RTLIB::ATOMIC_LOAD] = unsupported; But it turns out clang has no problem generating calls to __atomic_load anyway: https://gcc.godbolt.org/z/kMDLJb And it looks like LLVM looks to provide general support for these functions: https://llvm.org/docs/Atomics.html#libcalls-atomic Comment Actions Hi again, I'm sorry, but I don't know much about WebAssembly. I would suggest taking the opposite approach: mark as unavailable in general, and as available only on platforms where you know for sure they exist - based on the docs you linked, that's probably anything that has C++11 support. Maybe someone else with more experience in this area can chime in. Comment Actions I've added a short list of architectures known to use atomic operations and observed to generate calls to __atomic_load/store Comment Actions Thanks for the update. This looks fine to me as is, but I'll defer the final LGTM to someone that knows this area a bit better.
Comment Actions @efriedma that makes sense. I've reverted to the previous patch where these functions are always available. |
Nit: this doesn't need to move.