efriedma-quic wrote:

There are, currently, basically three different ways to supply libc which we 
support:

- Dynamic linking: the libc isn't part of your program at all, it's part of the 
environment.  You only have the abstract interface.
- Static linking, no LTO of libc: the libc becomes part of your program at 
link-time: the linker lowers the libc abstraction into concrete calls.
- -fno-builtins: The libc, excluding a small set of functions which are 
necessary for codegen, becomes part of your program at compile-time; once 
you're in LLVM IR, the abstraction is gone.

To do "LTO of libc", you want something else... but you need to define what 
"something else" is.  There needs to be a clearly delineated point at which 
libc implementation bits transition from an abstraction to concrete code.  If 
your libc cooperates, that point can be different for different interfaces, but 
there still needs to be a specific point.  You can't just blindly throw 
everything at the existing optimizer and hope for the best.

If you say memcmp stays an abstraction past codegen, you're getting basically 
zero benefit from LTO'ing it, as far as I can tell: the caller is opaque to the 
callee, and the callee is opaque to the caller.  At best.  At worst, your code 
explodes because your memcmp implementation depends on runtime CPU detection 
code that runs startup, and LTO can't understand the dependency between the 
detection code and memcmp.

So in essence, I feel like can't review this patch without a proposal that 
addresses where we're going overall.

https://github.com/llvm/llvm-project/pull/135706
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to