Add a CSE pass to Stg (#9291)
authorJoachim Breitner <mail@joachim-breitner.de>
Thu, 15 Dec 2016 18:57:43 +0000 (10:57 -0800)
committerJoachim Breitner <mail@joachim-breitner.de>
Thu, 5 Jan 2017 14:13:47 +0000 (09:13 -0500)
commit19d5c7312bf0ad9ae764168132aecf3696d5410b
tree4ca88418e91ce41b026389d75f985d0bd9a72292
parentbaf9ebe55a51827c0511b3a670e60b9bb3617ab5
Add a CSE pass to Stg (#9291)

This CSE pass only targets data constructor applications. This is
probably the best we can do, as function calls and primitive operations
might have side-effects.

Introduces the flag -fstg-cse, enabled by default with -O for now. It
might also be a good candiate for -O2.

Differential Revision: https://phabricator.haskell.org/D2871
16 files changed:
compiler/basicTypes/Id.hs
compiler/basicTypes/Var.hs
compiler/coreSyn/CoreSyn.hs
compiler/coreSyn/TrieMap.hs
compiler/ghc.cabal.in
compiler/main/DynFlags.hs
compiler/simplStg/SimplStg.hs
compiler/simplStg/StgCse.hs [new file with mode: 0644]
compiler/simplStg/UnariseStg.hs
compiler/stgSyn/StgSyn.hs
docs/users_guide/using-optimisation.rst
testsuite/tests/simplStg/Makefile [new file with mode: 0644]
testsuite/tests/simplStg/should_run/Makefile [new file with mode: 0644]
testsuite/tests/simplStg/should_run/T9291.hs [new file with mode: 0644]
testsuite/tests/simplStg/should_run/T9291.stdout [new file with mode: 0644]
testsuite/tests/simplStg/should_run/all.T [new file with mode: 0644]