[GHC] #11731: Simplifier: Inlining trivial let can lose sharing
GHC
ghc-devs at haskell.org
Tue Mar 22 13:15:41 UTC 2016
#11731: Simplifier: Inlining trivial let can lose sharing
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
Humph. I was thinking that if a function has a particular strictness
signature we can't change it. Certainly we can't change the strictness
signature for an imported function.
BUT we CAN change the strictness signatures of local functions and
actually those are the ones that matter, because their sharing properties
may worsen, as above.
Indeed we already have the idea of running the demand analyser just before
code generation: `-flate-dmd-anal`. (Main motivation: discover used-once
thunks that weren't previously used-once.)
Does using `-flate-dmd-anal` fix the problem? It may not becuase there is
a simplifer run afterwards; but cleraly this bug only shows up rarely
anyway, so running it late might actually fix it
Thinking about it
* ''Until'' code generation, the used-once info is ignored; only one-
shot-call info is used
* ''During'' code generation, the used-once info is used; and the one-
shot-call info is ignored.
So perhaps
* We should not even ''generate'' used-once info in the main run of the
demand analyser, since it is so easily invalidated.
* In the run of the simplifier after late demand analysis we should be
careful not to eliminate the dangerous lets.
I tried the test program with `-O`; but it only prints `"Evaluated"` once.
So, strangely, I can't reproduce the bug. What exact commands did you
use?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11731#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list