diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-02-01 09:19:30 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-02-01 12:19:52 +0000 |
commit | efce943ca20b55b18f948681e6b44fd892dbddd2 (patch) | |
tree | 5d06b346b23ff054ee4970528d2a45f2aedf1688 | |
parent | db5a4b83b14bf4f1adb417b7664347fdaf637fd6 (diff) | |
download | haskell-efce943ca20b55b18f948681e6b44fd892dbddd2.tar.gz |
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!
-rw-r--r-- | compiler/coreSyn/CoreLint.hs | 2 | ||||
-rw-r--r-- | compiler/deSugar/Desugar.hs | 3 | ||||
-rw-r--r-- | compiler/main/DynFlags.hs | 3 | ||||
-rw-r--r-- | docs/users_guide/debugging.rst | 11 | ||||
-rw-r--r-- | 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 e866f0d3ec..e83f8392d2 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 518f02f1a0..05d322680c 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 cf889ecd72..6cea932bf5 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 399791925c..48222ae467 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 795e1730a9..49683b7db4 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, ['']) |