[PassManagerBuilder] Add a few more scalar optimization passes
authorJames Molloy <james.molloy@arm.com>
Tue, 15 Dec 2015 09:24:01 +0000 (09:24 +0000)
committerJames Molloy <james.molloy@arm.com>
Tue, 15 Dec 2015 09:24:01 +0000 (09:24 +0000)
commitbfebefca9f4b3bae066ad26da532060b837e0a16
tree938cb95b211a1da606d4ed40cd53c9668b2b2390
parent18d1bc23aba958d1103c0d759579bd3e39f869e6
[PassManagerBuilder] Add a few more scalar optimization passes

This patch does two things:
  1. mem2reg is now run immediately after globalopt. Now that globalopt
     can localize variables more aggressively, it makes sense to lower
     them to SSA form earlier rather than later so they can benefit from
     the full set of optimization passes.

  2. More scalar optimizations are run after the loop optimizations in
     LTO mode. The loop optimizations (especially indvars) can clean up
     scalar code sufficiently to make it worthwhile running more scalar
     passes. I've particularly added SCCP here as it isn't run anywhere
     else in the LTO pass pipeline.

Mem2reg is super cheap and shouldn't affect compilation time at all. The
rest of the added passes are in the LTO pipeline only so doesn't affect
the vast majority of compilations, just the link step.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255634 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/PassManagerBuilder.cpp