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

GHC ghc-devs at haskell.org
Wed Jun 22 12:19:34 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 simonpj):

 Distinguish between
  * Global registers, like R1, Sp, which are part of the calling
 convention, and live in fixed places
  * Local registers, written `x`, `y`, etc in Cmm, which are just like
 local variables in a programming language.  There are an infinite number
 of them.  You can't take their address.

 We do indeed generate loads into a local register at the start; but we
 expect those loads to sink downstream to their use sites, so they don't
 necessarily cause register pressure.

 It's not safe to replace them with memory loads. Example
 {{{
 x = R1[4]
 call f( p, q )
 ...use x...
 }}}
 We must save `x` on the stack across the call.  R1 is involved in f's
 calling convention, so it may well change a lot.  Indeed any modification
 to R1 is going to invalidate your saved "x = R1[4]" delayed load.

 Plus the double-load efficiency problem that Simon mentions.

 Better to load into a local variable and then sink it.

 Does that make sense?

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


More information about the ghc-tickets mailing list