Don't track free variables in STG syntax by default
authorSebastian Graf <sebastian.graf@kit.edu>
Mon, 19 Nov 2018 16:48:44 +0000 (17:48 +0100)
committerSebastian Graf <sebastian.graf@kit.edu>
Mon, 19 Nov 2018 16:48:44 +0000 (17:48 +0100)
commit47bbc709cb221e32310c6e28eb2f33acf78488c7
tree07326ee259a4b547d4a568e815204b7c1f543567
parentcc615c697b54e3141e7b30b975de0b07dc9b8b29
Don't track free variables in STG syntax by default

Summary:
Currently, `CoreToStg` annotates `StgRhsClosure`s with their set of non-global
free variables.  This free variable information is only needed in the final
code generation step (i.e. `StgCmm.codeGen`), which leads to transformations
such as `StgCse` and `StgUnarise` having to maintain this information.

This is tiresome and unnecessary, so this patch introduces a trees-to-grow-like
approach that only introduces the free variable set into the syntax tree in the
code gen pass, along with a free variable analysis on STG terms to generate
that information.

Fixes #15754.

Reviewers: simonpj, osa1, bgamari, simonmar

Reviewed By: osa1

Subscribers: rwbarton, carter

GHC Trac Issues: #15754

Differential Revision: https://phabricator.haskell.org/D5324
16 files changed:
compiler/basicTypes/VarSet.hs
compiler/codeGen/StgCmm.hs
compiler/codeGen/StgCmmBind.hs
compiler/codeGen/StgCmmBind.hs-boot
compiler/codeGen/StgCmmExpr.hs
compiler/ghc.cabal.in
compiler/main/DynFlags.hs
compiler/main/HscMain.hs
compiler/simplStg/StgCse.hs
compiler/simplStg/StgStats.hs
compiler/simplStg/UnariseStg.hs
compiler/stgSyn/CoreToStg.hs
compiler/stgSyn/StgFVs.hs [new file with mode: 0644]
compiler/stgSyn/StgSyn.hs
compiler/utils/UniqDSet.hs
testsuite/tests/simplCore/should_compile/noinline01.stderr