Commits on Source (5)
-
Reduces allocation for the test case I was looking at by about 1.2%. Mostly from avoiding allocation of some folding functions which turn into let-no-escape bindings which just reuse their environment instead. We also force inlining in a few key places in CmmSink which helps a bit more.
51e3bb6d -
Helps avoid allocating the folding function. Improves perf for T3294 by about 1%.
69ae10c3 -
About 0.6% reduction in allocations for the code I was looking at. Not a huge difference but no need to throw away performance.
6e3da800 -
Sinking requires us to track live local regs after each cmm statement. We used to do this via "Set LocalReg". However we can replace this with a solution based on IntSet which is overall more efficient without losing much. The thing we lose is width of the variables, which isn't used by the sinking pass anyway. I also reworked how we keep assignments to regs mentioned in skipped assignments. I put the details into Note [Keeping assignemnts mentioned in skipped RHSs]. The gist of it is instead of keeping track of it via the use count which is a `IntMap Int` we now use the live regs set (IntSet) which is quite a bit faster. I think it also matches the semantics a lot better. The skipped (not discarded) assignment does in fact keep the regs on it's rhs alive so keeping track of this in the live set seems like the clearer solution as well. Improves allocations for T3294 by yet another 1%.
aef44d7f -
Optimization either returns Nothing if nothing is to be done or `Just <cmmExpr>` otherwise. There is no point in being lazy in `cmmExpr`. We usually inspect this element so the thunk gets forced not long after. We might eliminate it as dead code once in a blue moon but that's not a case worth optimizing for. Overall the impact of this is rather low. As Cmm.Opt doesn't allocate much (compared to the rest of GHC) to begin with.
59f2249b
Showing
- compiler/GHC/Cmm/Expr.hs 8 additions, 6 deletionscompiler/GHC/Cmm/Expr.hs
- compiler/GHC/Cmm/LRegSet.hs 53 additions, 0 deletionscompiler/GHC/Cmm/LRegSet.hs
- compiler/GHC/Cmm/Liveness.hs 69 additions, 0 deletionscompiler/GHC/Cmm/Liveness.hs
- compiler/GHC/Cmm/Node.hs 5 additions, 0 deletionscompiler/GHC/Cmm/Node.hs
- compiler/GHC/Cmm/Opt.hs 51 additions, 51 deletionscompiler/GHC/Cmm/Opt.hs
- compiler/GHC/Cmm/Sink.hs 88 additions, 54 deletionscompiler/GHC/Cmm/Sink.hs
- compiler/GHC/Cmm/Utils.hs 5 additions, 3 deletionscompiler/GHC/Cmm/Utils.hs
- compiler/GHC/Utils/Outputable.hs 4 additions, 0 deletionscompiler/GHC/Utils/Outputable.hs
- compiler/ghc.cabal.in 1 addition, 0 deletionscompiler/ghc.cabal.in
compiler/GHC/Cmm/LRegSet.hs
0 → 100644