StgLint fails because Stg bindings are not dependency-ordered
After 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 (closed) 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
).
Trac metadata
Trac field | Value |
---|---|
Version | |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | sgraf, simonpj |
Operating system | |
Architecture |