[PATCH] D47553: Add TargetLowering::shouldExpandAtomicToLibCall and query it from AtomicExpandPass

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 13:04:02 PDT 2018


asb added a comment.

In https://reviews.llvm.org/D47553#1118067, @efriedma wrote:

> But even if they are lock-free, it still requires linking to the shared library libatomic; we don't want to impose that requirement on users if it isn't necessary.


Excellent point. That's definitely enough motivation to avoid calling the `__atomic_*` libcalls when not strictly necessary. I'll rework my patches to lower to ll/sc for small atomics on RV32IA from the start. Of course we then run into the problem encountered by Mips - the potential for a stack spill to be inserted between the ll/sc and to break things.


https://reviews.llvm.org/D47553





More information about the llvm-commits mailing list