[llvm-dev] A libc in LLVM

Stan Shebs via llvm-dev
Thu, 27 Jun 2019 15:16:00 -0000

On Wed, Jun 26, 2019 at 11:52 PM Chris Lattner via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> On Jun 26, 2019, at 11:20 AM, Siva Chandra via llvm-dev <llvm-dev at
lists.llvm.org> wrote:
>
>
> a) We want to leverage the compiler for performance wherever possible,
> and as part of the LLVM project, fix compiler bugs rather than use
> assembly.
>
>
> I love this approach as a way of driving low level performance forward!
How do you anticipate this working in practice?
>
> For example, if someone says “I can shave 1 cycle out of this important
thing if I write it in asm” and you know that a suitably capable compiler
engineer can achieve the same thing given enough time, how do you plan to push
back?

I think it's becoming uncommon to find cases like that today; the
person who thinks they have a magic assembly hack finds that it works
well for one microbenchmark on one architecture variant, but
disappoints when used in real code.  In fact, glibc has been throwing
out a bunch of assembly code in recent years, as testing shows much of
it to not to have any noticeable advantage.

If the customized calling convention scheme works out, it's going to
be a huge incentive to fix the compiler in case of performance
lossage; it will be quite difficult to write assembly that is equally
performant for all possible calling conventions, and if you try to
assume a convention, then the assumption propagates up through the
program, possibly defeating more important optimizations.