diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2018-12-07 23:23:10 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-12-07 23:23:29 -0500 |
commit | 04caa935ac22bd2bd1a254f26df9dca4ee6abdd1 (patch) | |
tree | bf98fb67cdce8352fc968a3a2590a8a631394ae5 /testsuite/mk | |
parent | 57c9b1ae4cafd0ee763451f2d4bc10220eef9689 (diff) | |
download | haskell-04caa935ac22bd2bd1a254f26df9dca4ee6abdd1.tar.gz |
Fix StgLint bound id check, generalize StgLint
StgLint was incorrectly using isLocalId for bound id check to see
whether an id is imported (in which case we don't expect it to be bound)
or local. The problem with isLocalId is that its semantics changes
after Core, as explained in the note: (last line)
Note [GlobalId/LocalId]
~~~~~~~~~~~~~~~~~~~~~~~
A GlobalId is
* always a constant (top-level)
* imported, or data constructor, or primop, or record selector
* has a Unique that is globally unique across the whole
GHC invocation (a single invocation may compile multiple
modules)
* never treated as a candidate by the free-variable finder;
it's a constant!
A LocalId is
* bound within an expression (lambda, case, local let(rec))
* or defined at top level in the module being compiled
* always treated as a candidate by the free-variable finder
After CoreTidy, top-level LocalIds are turned into GlobalIds
We now pass current module as a parameter to StgLint, which uses it to
see if an id should be bound (defined in the current module) or not
(imported).
Other changes:
- Generalized StgLint to make it work on both StgTopBinding and
CgStgTopBinding.
- Bring all top-level binders into scope before linting top-level
bindings to allow uses before definitions.
TODO: We should remove the binder from local vars when checking RHSs of
non-recursive bindings.
Test Plan: This validates.
Reviewers: simonpj, bgamari, sgraf
Reviewed By: simonpj, sgraf
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5370
Diffstat (limited to 'testsuite/mk')
-rw-r--r-- | testsuite/mk/test.mk | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index 6c995a4b88..4b1b4d7978 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -36,7 +36,8 @@ endif # TEST_HC_OPTS is passed to every invocation of TEST_HC # in nested Makefiles -TEST_HC_OPTS = -dcore-lint -dcmm-lint -no-user-$(GhcPackageDbFlag) -rtsopts $(EXTRA_HC_OPTS) +TEST_HC_OPTS = -dcore-lint -dstg-lint -dcmm-lint \ + -no-user-$(GhcPackageDbFlag) -rtsopts $(EXTRA_HC_OPTS) ifeq "$(MinGhcVersion711)" "YES" # Don't warn about missing specialisations. They can only occur with `-O`, but |