[cfe-dev] Which optimizations are done by Clang, not LLVM

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 29 08:00:09 PDT 2018


Very few, if any, optimizations are done by Clang - where possible Clang
augments the LLVM IR with extra information to enable LLVM to perform the
optimizations.

Clang's IR generation does vary depending on optimization level - but
usually on in this sort of attribute-application context. (eg: applying the
'inlinehint' attribute above -O0, applying the 'optnone' attribute at -O0,
etc).

Maybe some of the memcpy optimization (turning struct copying into
memcpies) is done in the frontend - because it knows it can copy around the
padding bytes if that's more convenient.

Even very C++-y things like devirtualization are still, ideally,
implemented in LLVM - trying to provide as general a tool as possible for
frontends to express these kinds of constraints to the LLVM optimization
pipeline.

- Dave

On Mon, Oct 29, 2018 at 4:21 AM Alexander Zaitsev via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hello.
>
> I am trying to find in Clang sources which kind of optimizations do
> directly Clang, not LLVM. What I want to do - I have some ideas for
> optimization which can be done only for C++ code. And as I understand
> Clang is the right place for doing this but I cannot find any example.
>
> Can you help me a little bit and provide any existent example in Clang
> sources?
>
> Thank you.
>
> --
> Best regards,
> Alexander Zaitsev
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181029/8de4f393/attachment.html>


More information about the cfe-dev mailing list