[llvm-dev] [RFC][clang/llvm] Allow efficient implementation of libc's memory functions in C/C++
David Chisnall via llvm-dev
llvm-dev at lists.llvm.org
Mon Apr 29 01:48:16 PDT 2019
On 26/04/2019 12:47, Guillaume Chatelet via llvm-dev wrote:
> 1.2 A specific attribute to disable synthesis of all libc calls
> With this one we are losing precision and we may inline too much. There
> is also the question of what is considered a libc function, LLVM mainly
> defines target library calls.
Target library is probably more relevant than libc. We have a number of
issues with libm on tier 2 platforms for FreeBSD without assembly fast
paths. This requires work-arounds for the fact that clang likes to say
'oh, this function seems to be calling X on the result of Y, and I know
that this can be more efficient if you replace that sequence with Z',
ignoring the fact that this case is an implementation of Z.
The same thing is true in Objective-C runtime implementations, where we
need to be careful to avoid LLVM performing optimisations on the ARC
functions that result in infinite recursion.
There are numerous cases of compiler-rt suffering from the same issue.
TL;DR: This is a really important problem for clang and your proposed
solution 1 looks like it is far more broadly applicable.
More information about the llvm-dev