[commit: ghc] master: Add -ddump-ds-preopt (efce943)
git at git.haskell.org
git at git.haskell.org
Thu Feb 1 12:53:51 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/efce943ca20b55b18f948681e6b44fd892dbddd2/ghc
>---------------------------------------------------------------
commit efce943ca20b55b18f948681e6b44fd892dbddd2
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Thu Feb 1 09:19:30 2018 +0000
Add -ddump-ds-preopt
This allows you to see the output immediately after desugaring
but before any optimisation.
I've wanted this for some time, but I was triggered into action
by Trac #13032 comment:9.
Interestingly, the change means that with -dcore-lint we will
now Lint the output before the very simple optimiser;
and this showed up Trac #14749. But that's not the fault
of -ddump-ds-preopt!
>---------------------------------------------------------------
efce943ca20b55b18f948681e6b44fd892dbddd2
compiler/coreSyn/CoreLint.hs | 2 +-
compiler/deSugar/Desugar.hs | 3 ---
compiler/main/DynFlags.hs | 3 +++
docs/users_guide/debugging.rst | 11 ++++++++---
testsuite/tests/typecheck/should_compile/all.T | 2 +-
5 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs
index e866f0d..e83f839 100644
--- a/compiler/coreSyn/CoreLint.hs
+++ b/compiler/coreSyn/CoreLint.hs
@@ -275,7 +275,7 @@ coreDumpFlag CoreDoSpecialising = Just Opt_D_dump_spec
coreDumpFlag CoreDoSpecConstr = Just Opt_D_dump_spec
coreDumpFlag CoreCSE = Just Opt_D_dump_cse
coreDumpFlag CoreDoVectorisation = Just Opt_D_dump_vect
-coreDumpFlag CoreDesugar = Just Opt_D_dump_ds
+coreDumpFlag CoreDesugar = Just Opt_D_dump_ds_preopt
coreDumpFlag CoreDesugarOpt = Just Opt_D_dump_ds
coreDumpFlag CoreTidy = Just Opt_D_dump_simpl
coreDumpFlag CorePrep = Just Opt_D_dump_prep
diff --git a/compiler/deSugar/Desugar.hs b/compiler/deSugar/Desugar.hs
index 518f02f..05d3226 100644
--- a/compiler/deSugar/Desugar.hs
+++ b/compiler/deSugar/Desugar.hs
@@ -160,10 +160,7 @@ deSugar hsc_env
-- You might think it doesn't matter, but the simplifier brings all top-level
-- things into the in-scope set before simplifying; so we get no unfolding for F#!
-#if defined(DEBUG)
- -- Debug only as pre-simple-optimisation program may be really big
; endPassIO hsc_env print_unqual CoreDesugar final_pgm rules_for_imps
-#endif
; (ds_binds, ds_rules_for_imps, ds_vects)
<- simpleOptPgm dflags mod final_pgm rules_for_imps vects0
-- The simpleOptPgm gets rid of type
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index cf889ec..6cea932 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -347,6 +347,7 @@ data DumpFlag
| Opt_D_dump_core_stats
| Opt_D_dump_deriv
| Opt_D_dump_ds
+ | Opt_D_dump_ds_preopt
| Opt_D_dump_foreign
| Opt_D_dump_inlinings
| Opt_D_dump_rule_firings
@@ -3058,6 +3059,8 @@ dynamic_flags_deps = [
(setDumpFlag Opt_D_dump_deriv)
, make_ord_flag defGhcFlag "ddump-ds"
(setDumpFlag Opt_D_dump_ds)
+ , make_ord_flag defGhcFlag "ddump-ds-preopt"
+ (setDumpFlag Opt_D_dump_ds_preopt)
, make_ord_flag defGhcFlag "ddump-foreign"
(setDumpFlag Opt_D_dump_foreign)
, make_ord_flag defGhcFlag "ddump-inlinings"
diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst
index 3997919..48222ae 100644
--- a/docs/users_guide/debugging.rst
+++ b/docs/users_guide/debugging.rst
@@ -212,11 +212,16 @@ subexpression elimination pass.
Print a one-line summary of the size of the Core program at the end
of the optimisation pipeline.
-.. ghc-flag:: -ddump-ds
- :shortdesc: Dump desugarer output
+.. ghc-flag:: -ddump-ds -ddump-ds-preopt
+ :shortdesc: Dump desugarer output.
:type: dynamic
- Dump desugarer output
+ Dump desugarer output. `-ddump-ds` dumps the output after the very simple
+ optimiser has run (which discards a lot of clutter and
+ hence is a sensible default. `-ddump-ds-preopt` shows
+ the output after desugaring but before the very simple
+ optimiser.
+
.. ghc-flag:: -ddump-simpl-iterations
:shortdesc: Dump output from each simplifier iteration
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T
index 795e173..49683b7 100644
--- a/testsuite/tests/typecheck/should_compile/all.T
+++ b/testsuite/tests/typecheck/should_compile/all.T
@@ -566,7 +566,7 @@ test('T13651a', normal, compile, [''])
test('T13680', normal, compile, [''])
test('T13785', normal, compile, [''])
test('T13804', normal, compile, [''])
-test('T13822', normal, compile, [''])
+test('T13822', expect_broken(14749), compile, [''])
test('T13848', normal, compile, [''])
test('T13871', normal, compile, [''])
test('T13879', normal, compile, [''])
More information about the ghc-commits
mailing list