Commit efce943c authored by Simon Peyton Jones's avatar Simon Peyton Jones

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!
parent db5a4b83
......@@ -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
......@@ -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
; (ds_binds, ds_rules_for_imps, ds_vects)
<- simpleOptPgm dflags mod final_pgm rules_for_imps vects0
-- The simpleOptPgm gets rid of type
......@@ -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"
......@@ -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
.. ghc-flag:: -ddump-simpl-iterations
:shortdesc: Dump output from each simplifier iteration
......@@ -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, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment