Karl Rehm via llvm-dev
2020-Jan-28 22:19 UTC
[llvm-dev] Confused about optimization pass order
Hello, I'm wondering how exactly LLVM deals with passes that open up opportunities for other passes. For example, InstCombine says that it opens many opportunities for dead code/store elimination. However, the reverse may also be true. How does LLVM currently handle this? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200128/dd7faba7/attachment.html>
Doerfert, Johannes via llvm-dev
2020-Jan-28 22:35 UTC
[llvm-dev] Confused about optimization pass order
Hi Karl, here is my, slightly oversimplified, take on this, I hope it helps. We have a fixed, manually curated pipeline which seems to perform reasonably well (see for example llvm/lib/Transforms/IPO/PassManagerBuilder.cpp). There are (call graph SCC) passes that run as part of this pipeline potentially multiple times, but still in the fixed order (as far as I know). EJ (cc'ed) and I are going to propose a GSoC project to "learn" the interplay between sets of passes, e.g., what has to go together and in which order, and, potentially, alternative pipelines we could offer to people. There are various details that are not totally clear yet but based on existing research it seems there are nice improvements to be expected if we find a way to manage the infrastructure challenges that come with such an effort. Cheers, Johannes ________________________________________ From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Karl Rehm via llvm-dev <llvm-dev at lists.llvm.org> Sent: Tuesday, January 28, 2020 16:19 To: llvm-dev at lists.llvm.org Subject: [llvm-dev] Confused about optimization pass order Hello, I'm wondering how exactly LLVM deals with passes that open up opportunities for other passes. For example, InstCombine says that it opens many opportunities for dead code/store elimination. However, the reverse may also be true. How does LLVM currently handle this?
Karl Rehm via llvm-dev
2020-Jan-28 22:49 UTC
[llvm-dev] Confused about optimization pass order
Interesting. I was wondering whether it would be a good idea to separate passes into further separate groups, depending on what they do. For example: - Code reduction/elimination (ex. DCE, quite a few of the loop passes) - Instruction substitution (ex. vectorization passes/instcombine) The problem I see with the current approach is that I think the code reduction passes get the short end of the stick; they can only run as many times as they're added to the PassManager, meaning for larger projects something could be missed. What I'd propose (take this with a grain of salt obviously) is some sort of implementation where the code reduction passes are all continually run until they are done. After that, do the same thing but with the substitution passes. I don't know if there are any specific passes that just make code prettier for substitution, but they would (hypothetically) be run once in between. This is probably not the best way to go about this, but I think it could help. Thanks, Karl On Tue, Jan 28, 2020 at 5:35 PM Doerfert, Johannes <jdoerfert at anl.gov> wrote:> Hi Karl, > > here is my, slightly oversimplified, take on this, I hope it helps. > > We have a fixed, manually curated pipeline which seems to perform > reasonably well (see for example > llvm/lib/Transforms/IPO/PassManagerBuilder.cpp). > There are (call graph SCC) passes that run as part of this pipeline > potentially multiple times, but still in the fixed order (as far as I know). > > EJ (cc'ed) and I are going to propose a GSoC project to "learn" the > interplay between sets of passes, e.g., what has to go together and in > which order, and, potentially, alternative pipelines we could offer to > people. > There are various details that are not totally clear yet but based on > existing research it seems there are nice improvements to be expected if we > find a way to manage the infrastructure challenges that come with such an > effort. > > Cheers, > Johannes > > > ________________________________________ > From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Karl Rehm > via llvm-dev <llvm-dev at lists.llvm.org> > Sent: Tuesday, January 28, 2020 16:19 > To: llvm-dev at lists.llvm.org > Subject: [llvm-dev] Confused about optimization pass order > > Hello, > I'm wondering how exactly LLVM deals with passes that open up > opportunities for other passes. For example, InstCombine says that it opens > many opportunities for dead code/store elimination. However, the reverse > may also be true. How does LLVM currently handle this? >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200128/05c93bfe/attachment.html>
Maybe Matching Threads
- Global removal pass - potential for improvement?
- Global removal pass - potential for improvement?
- Global removal pass - potential for improvement?
- Global removal pass - potential for improvement?
- Questions about jump threading optimization and what we can do