This is related to this FIXME comment in the Swift stdlib. Some of the double precision math functions in libc are not defined in terms of the LLVM bulitins on Linux, and I ran into some performance implications because of this (compiler explorer link showcasing this problem -- _log
is transparently defined in terms of the corresponding builtin and is treated as pure and moved out of the loop, but log
is not on Linux). Ideally it would be nice if we could just do
@_transparent
public func log(_ x: Double) -> Double {
return _log(x)
}
on Linux too, which I see is done for macOS etc in this gyb file
- Is it possible to not export some symbols from libc into swift from Core foundation so that this can be done for Linux too?
- If not, what is a possible fix for this? Is there an open issue for the same? I see that there's a FIXME comment but I couldn't find a corresponding issue.