[llvm-dev] Confused about optimization pass order
Karl Rehm via llvm-dev
llvm-dev at lists.llvm.org
Tue Jan 28 14:49:23 PST 2020
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.
On Tue, Jan 28, 2020 at 5:35 PM Doerfert, Johannes <jdoerfert at anl.gov>
> 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
> 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
> 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
> 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
> 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...
More information about the llvm-dev