[cfe-dev] Which optimizations are done by Clang, not LLVM
cfe-dev at lists.llvm.org
Mon Oct 29 10:51:06 PDT 2018
IIRC, Clang CodeGen will do some branch-to-branch elimination, for blocks that are empty/missing at the source level. Then you have language-mandated things like RVO? But yeah, the front-end generally doesn't want to do optimizations.
From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of David Blaikie via cfe-dev
Sent: Monday, October 29, 2018 11:00 AM
To: Alexander Zaitsev
Cc: Clang Dev
Subject: Re: [cfe-dev] Which optimizations are done by Clang, not LLVM
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.
On Mon, Oct 29, 2018 at 4:21 AM Alexander Zaitsev via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> wrote:
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
cfe-dev mailing list
cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev