snmalloc
snmalloc copied to clipboard
__builtin_readcyclecounter broken on mac arm64
disabling this particular builtin rather than disabling all seems enough to fix the tests.
https://reviews.llvm.org/D136999 probably fixes this (and avoids getting nonsense deltas when bouncing between cores)
Thanks @jrtc27. It looks as if that hasn't yet been merged into Apple's version of LLVM (Apple Clang 14.0.3 is based on upstream clang 15.0.0 and still emits mrs x0, PMCCNTR_EL0 for this builtin). It's a bit annoying that clang doesn't provide pre-defined macros for bug fixes, because the conditional for version matching between Apple and upstream clang versions here would be quite complex.
@mjp41, it looks as if the builtin is inlined but the method with the inline assembly isn't, so we probably want to slap an ALWAYSINLINE on it (inlining a single-instruction method is always the right choice, but I think LLVM's cost function doesn't count the size of assembly blocks).