Russell Wallace via llvm-dev
2015-Nov-06 11:58 UTC
[llvm-dev] Repeated application of optimization passes
Within the LLVM pass manager infrastructure, suppose we have two transformation passes, pass A makes some improvements, then pass B does likewise, but this creates opportunities for pass A to create further improvements (e.g. suppose B was function inlining) so it's desirable to run A again. How does the LLVM pass manager currently deal with this? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151106/b8f077a0/attachment.html>
serge guelton via llvm-dev
2015-Nov-06 13:17 UTC
[llvm-dev] Repeated application of optimization passes
On Fri, Nov 06, 2015 at 11:58:22AM +0000, Russell Wallace via llvm-dev wrote:> Within the LLVM pass manager infrastructure, suppose we have two > transformation passes, pass A makes some improvements, then pass B does > likewise, but this creates opportunities for pass A to create further > improvements (e.g. suppose B was function inlining) so it's desirable to > run A again. > > How does the LLVM pass manager currently deal with this?Some passes are already applied repeatedly by the passmanager, just add them twice when relevant. for instance in lib/Transforms/IPO/PassManagerBuilder.cpp, PassManagerBuilder::populateModulePassManager MPM.add(createGVNPass(...)) is called twice (conditionnaly) Hope it helps,
Russell Wallace via llvm-dev
2015-Nov-06 13:32 UTC
[llvm-dev] Repeated application of optimization passes
I don't suppose there's any way to find out whether the second iteration did anything? That is, suppose you have a module and you run some passes over it - if something changed, further iterations might be fruitful, but if nothing changed then further iterations definitely won't do anything so you can stop. In principle one could make a copy of the module beforehand and then compare, but being a large complex data structure, it probably doesn't provide equality comparison by value? On Fri, Nov 6, 2015 at 1:17 PM, serge guelton <sguelton at quarkslab.com> wrote:> On Fri, Nov 06, 2015 at 11:58:22AM +0000, Russell Wallace via llvm-dev > wrote: > > Within the LLVM pass manager infrastructure, suppose we have two > > transformation passes, pass A makes some improvements, then pass B does > > likewise, but this creates opportunities for pass A to create further > > improvements (e.g. suppose B was function inlining) so it's desirable to > > run A again. > > > > How does the LLVM pass manager currently deal with this? > > Some passes are already applied repeatedly by the passmanager, just add > them twice when relevant. > > for instance in lib/Transforms/IPO/PassManagerBuilder.cpp, > PassManagerBuilder::populateModulePassManager > > MPM.add(createGVNPass(...)) is called twice (conditionnaly) > > Hope it helps, > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151106/56bba286/attachment.html>