[llvm-dev] Today is the last day of mediocre library call optimizations
David Chisnall via llvm-dev
llvm-dev at lists.llvm.org
Mon Apr 1 01:04:37 PDT 2019
It would help if the patch had some explanation (ideally in the comments) of what it is trying to accomplish. If I’m reading the integer promotion correctly, it is indicating that the pointer value for a getenv return is in the low 4GB of the address space. I suspect that this is unsound on platforms with non-integer pointer representations and I don’t believe it’s correct on any platform with ASLR.
I may be completely misunderstanding what the patch does, but without comments it’s difficult to tell.
> On 1 Apr 2019, at 08:06, Johannes Doerfert via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> To this day, we still do too little when it comes to optimizing well
> known library calls.
> Given that various libraries, especially the C/C++ standard library, are
> relatively clear defined, and LLVM has all the infrastructure already in
> place, e.g., SimplifyLibCalls.cpp, it seems odd that we still miss so
> many optimization opportunities.
> To show how easy it is, and how much impact it can have, I crafted a
> very simple, yet very effective patch which will hopefully only be the
> first of its kind.
> The attached twelve line addition to SimplifyLibCalls.cpp provides
> subsequent passes with a better understanding of the "getenv" function.
> This function was chosen to showcase the enormous impact well placed
> information can have on real world software, including LLVM itself.
> While you could take my word for it, I would encourage you to try it out
> yourself. Apply the patch and create *a new build* of LLVM to compare
> against your existing one. I firmly believe the result will be rather
> surprising for most.
> With a bit of luck we may even see more patches like this one today.
> Even if you are all too busy today, there is always next year I guess.
> Thanks in advance,
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
More information about the llvm-dev