[GHC] #10148: Optimization causes repeated computation

GHC ghc-devs at haskell.org
Mon Mar 9 12:53:29 UTC 2015


#10148: Optimization causes repeated computation
-------------------------------------+-------------------------------------
        Reporter:  akio              |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1-rc1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by nomeata):

 Fun fact: Most changes make the problem go away.
  * Changing the `data Array' a = ALeaf a` to a `newtype Array' a = ALeaf
 a`
  * not calling `go` in `array_adjust`
  * adding a `trace` to the pattern matching in `adjustA`
  * removing the pattern match there completely
  * removing the Bang Pattern in `gstep`
  * removing the first parameter from `Array`
  * marking `mkMaschine` `NOINLINE`

 Here is a cue: Removing the `!` on `t` in `mkMachine` removes *all* trace
 output. So it seems that (possibly as a result of minimizing the code),
 `t` and hence `array_adjust` is not actually used. This (function strict
 in an argument, but argument is unused) might make GHC be a bit too
 liberal in what it does with the code.

 (Didn’t look at Core so far, though).

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


More information about the ghc-tickets mailing list