The nest attribute is currently supported on the x86 (32-bit) and x86-64 backends, but not on ARM (32-bit) or AArch64. This patch adds support for nest to the AArch64 backend.
Register x18 is used by GCC for this purpose (see https://github.com/gcc-mirror/gcc/blob/7c62dfbbcd3699efcbbadc9fb3aa14f23a123add/gcc/testsuite/gcc.dg/cwsc1.c ) and hence is used here. As discussed on the GCC mailing list (see http://www.mail-archive.com/gcc@gcc.gnu.org/msg76966.html ) the register choice is an ABI issue and so choosing the same register as GCC means __builtin_call_with_static_chain is compatible.
A slight complexity to this issue is that x18 is reserved as the 'platform register' on iOS and Mac (see https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html ) and no register has been selected by GCC yet, so nest remains unsupported for those platforms.
Relevant LLVM mailing list discussion: http://comments.gmane.org/gmane.comp.compilers.llvm.devel/86370
Have you checked this on a non-asserts build? I'm never really sure what gets skipped in the name of efficiency.