[llvm-dev] Definitive list of optimisations at each optimisation level

Martin J. O'Riordan via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 4 03:49:56 PDT 2017


Thanks Sean,

 

My apologies for previously writing “Thanks Sean and Silva”, I intended “Thanks Sean and Ryan” - duh! - sleep deprived having just flown to the USA.

 

The dump is very enlightening for me, and very large - I hadn’t realised that there were quite so many passes.  At ‘-O0’ there are ~70 passes, but at ‘-O1’ it jumps to ~310 passes, and then ~340 passes at ‘-O2’ and ‘-O3’.  I will have to carefully study these passes to see what optimisations they perform (if any), though there are the obvious ones too.

 

One thing I observed, is that there are some passes that report:

 

Unnamed pass: implement Pass::getPassName()

 

This always appears after the final Target ‘AsmPrinter’ pass (“SHAVE Assembly Printer” in our case) and appears to be from the ‘FPPassManager’, while the other happens after ‘Global Variable Optimizer’ for optimisation levels of ‘-O1’ and higher and this seems to be the from the ‘MPPassManager’.  I am using the release LLVM v4.0 sources, not the head revision.  I guess these are noise and can be ignored.

 

All the best,

 

            MartinO

 

From: Sean Silva [mailto:chisophugis at gmail.com] 
Sent: 29 June 2017 04:15
To: ORiordan, Martin <martin.oriordan at intel.com>
Cc: Ryan Taylor <ryta1203 at gmail.com>; Martin J. O'Riordan <martin.oriordan at movidius.com>; llvm-dev <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] Definitive list of optimisations at each optimisation level

 

 

 

On Mon, Jun 26, 2017 at 5:04 AM, ORiordan, Martin <martin.oriordan at intel.com <mailto:martin.oriordan at intel.com> > wrote:

Thanks Sean and Silva.

 

I guess what I was seeking was a URL that I could point (non-compiler) people at, but I guess no such reference exists.  What I can do if reference bot the source manager and use ‘-mllvm -debug-pass=Structure’ for each optimisation level, and document that.  The downside is that this will continuously go out of data with each release.

 

 

Yeah, the nasty thing is that as each user of LLVM is running potentially different pass pipelines, we don't really have a good way to write a user-facing (or at least non-compiler-dev-facing) page describing the optimizations that they should expect the compiler to do, as the compiler developers using LLVM may have changed it. In theory, we could provide such a page for the open-source clang. Such a page of course couldn't go into massive detail about each pass and as such will likely be mostly describing the basics.

 

Most of the information that users would care about is likely to not get out of date very easily (e.g. we might switch GVN implementations, but the way in which they differ isn't going to be relevant to such a document; we might switch EarlyCSE to MemorySSA, but that isn't relevant to such a document).

 

-- Sean Silva

 

 

All the best,

 

            MartinO

 

PS: Movidius is now part of Intel, so I will be gradually switching to my Intel email address.

 

From: Ryan Taylor [mailto:ryta1203 at gmail.com <mailto:ryta1203 at gmail.com> ] 
Sent: Sunday, June 25, 2017 2:59 AM
To: Sean Silva <chisophugis at gmail.com <mailto:chisophugis at gmail.com> >
Cc: Martin J. O'Riordan <martin.oriordan at movidius.com <mailto:martin.oriordan at movidius.com> >; llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >
Subject: Re: [llvm-dev] Definitive list of optimisations at each optimisation level

 

I agree, it's much clearer, it just takes runs at multiple opt levels and therefore I don't find it to be a "one stop shop". 

 

On Jun 24, 2017 8:44 PM, "Sean Silva" <chisophugis at gmail.com <mailto:chisophugis at gmail.com> > wrote:

Looking at PassManagerBuilder can be useful because there are sometimes comments giving some idea of the intent of the particular choice of passes, but it can be difficult to see the big picture of all the passes that are run because it is very parameterized and split across multiple subroutines.

 

Running clang at O0 through O3 with -mllvm -debug-pass=Structure is generally more enlightening because then you see everything in one place for each optimization level.

 

-- Sean Silva

 

On Jun 24, 2017 12:54 PM, "Ryan Taylor" <ryta1203 at gmail.com <mailto:ryta1203 at gmail.com> > wrote:

Right but then you'll have to call each opt level. Have u looked in the pass manager? 

 

On Jun 24, 2017 3:52 PM, "Sean Silva via llvm-dev" <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > wrote:

The most definitive list you can probably hope to get will be obtained by passing -mllvm -debug-pass=Structure to a clang invocation.

 

-- Sean Silva

 

On Jun 24, 2017 7:10 AM, "Martin J. O'Riordan via llvm-dev" <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > wrote:

I am often asked what optimisations “our” compiler performs at each level.  But “our” compiler is actually CLang/LLVM which we have retargeted to our proprietary target.

 

Most of the work we do is in maintaining our target specific backend.  Certainly there are optimisations that we do to take best advantage of our instruction set during lowering and instruction selection, and we have also added a couple of additional passes which manipulate the IR in advance of lowering to better shape it for our target.

 

But in practice the vast majority of optimisations are contributed by the continuously evolving and excellent LLVM target independent passes, and have little or nothing to do with the work we do in our backend - though it is obviously directed/tuned by the various target call-backs and the target cost models.

 

Is there a “one stop shop” list of the optimisation passes that LLVM performs, and identification of which are enabled by default for each of the 4 standard optimisation levels ‘-O0’ thru ‘-O3’?

 

The reason that I ask, is that I really don’t have an honest or informed answer that I can provide to people when they ask, and I haven’t found a definitive statement of this in the LLVM documentation that I could refer them to.

 

Thanks,

 

            MartinO

 


_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> 
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

 


_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> 
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

 

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170704/66c0ddbc/attachment-0001.html>


More information about the llvm-dev mailing list