[GHC] #7198: New codegen more than doubles compile time of T3294

GHC ghc-devs at haskell.org
Sun Mar 13 18:25:00 UTC 2016


#7198: New codegen more than doubles compile time of T3294
-------------------------------------+-------------------------------------
        Reporter:  simonmar          |                Owner:  simonmar
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.4.2
  (CodeGen)                          |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #4258             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by michalt):

 This sounds interesting and I wanted to attempt to fix this. :-) I'm not
 very familiar with the code, so some help would be super useful.
 IIRC there are a few things happening here:

 - We have a bunch of nested `let`s that we could try to flatten based on a
 heuristic that considers how many free variables the `let` has.

 - We generate a lot of unnecessary code for copying the values from the
 stack to the heap (using local variables instead of assigning them
 directly).

 - The original description also mentions reloads for unused variables. But
 I'm not sure I understand what exactly is this referring to. (Some example
 would be nice!)

 Based on that I have a few questions on how to approach solving this:

 - What would be a good place in the code to consider flattening of `let`s?

 - What code is responsible for the unnecessary code for copying the
 values? It seems that this is would be the `StgCmm*` modules that compile
 STG to cmm, is that correct?

 Note: looking at Cmm when compiled with optimizations, it seems to me that
 the sinking pass is able to optimize the unnecessary copying of values
 through local variables (the assignment are of the form `F64[Hp - 312] =
 F64[Sp + 8];`).

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7198#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list