[GHC] #15939: StgLint fails because Stg bindings are not dependency-ordered

#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

#15939: StgLint fails because Stg bindings are not dependency-ordered -------------------------------------+------------------------------------- Reporter: osa1 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9718 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): Another problem with (3) is that it needs to traverse the whole program, we can't resuse free variable fields of `CgStgTopBinding` because those don't include top-level free vars, but we need those for the dependency analysis. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15939#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15939: StgLint fails because Stg bindings are not dependency-ordered -------------------------------------+------------------------------------- Reporter: osa1 | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9718 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by osa1): * status: new => closed * resolution: => fixed Comment: 04caa935ac22bd2bd1a254f26df9dca4ee6abdd1 implemented (1) and StgLint is now enabled by default in the test suite. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15939#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC