[GHC] #15939: StgLint fails because Stg bindings are not dependency-ordered
GHC
ghc-devs at haskell.org
Fri Nov 23 05:07:29 UTC 2018
#15939: StgLint fails because Stg bindings are not dependency-ordered
-------------------------------------+-------------------------------------
Reporter: osa1 | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version:
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets: #9718
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
After Phab:D5370 if I enable `-dstg-lint` when running the test suite I
get
about a dozen failures. I didn't check all, but most of them are because
Stg
bindings are not dependency-ordered, so some bindings come later in the
list of
bindings than their uses. I added a few debug prints to figure out if we
ever
have the bindings ordered in the pipeline. As far as I can see, by the
time we
desugar we have dependency-ordered bindings, but simplifier breaks the
ordering
by introducing uses. There are also "implicit" bindings introduced after
simplifications (e.g. in CorePrep). Because of this by the time we start
Stg
generation we already have incorrect ordering.
I think we have these options:
- Don't assume dependency ordering in StgLint. Bring all top-level binders
into
the scope before linting bindings.
- Somehow maintain dependency ordering in all of the Core passes so that
by the
time we start generating Stg we have an ordered list of bindings. (seems
hard)
- Sort Stg bindings in `CoreToStg`.
(1) and (3) are equally simple, but (3) requires an extra pass over
bindings.
However, to be able to do the `CafInfo` analysis for #9718 efficiently we
need
(3), so I suggest implementing (3). We can then enable `-dstg-lint` in the
test
suite for all tests (add it to `TEST_HC_OPTS` in `testsuite/mk/test/mk`).
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15939>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list