summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-08-19 17:30:08 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-08-21 09:37:15 -0400
commit2d8ca9170328249a436c3b5647b8e548d32b11c8 (patch)
tree63b52b62234dfaf35252c4cdbeccd41c4bac7956
parent659eb31b7a40f0aa2ba43c3454b5d9006fde837d (diff)
downloadhaskell-2d8ca9170328249a436c3b5647b8e548d32b11c8.tar.gz
Fix -ddump-stg flag
-ddump-stg was dumping the initial STG (just after Core-to-STG pass) which was misleading because we want the final STG to know if a function allocates or not. Now we have a new flag -ddump-stg-from-core for this and -ddump-stg is deprecated.
-rw-r--r--compiler/GHC/Driver/Flags.hs6
-rw-r--r--compiler/GHC/Driver/Session.hs7
-rw-r--r--compiler/GHC/Stg/Pipeline.hs2
-rw-r--r--docs/users_guide/debugging.rst10
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T2
-rw-r--r--testsuite/tests/simplCore/should_compile/noinline01.stderr2
6 files changed, 20 insertions, 9 deletions
diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs
index a1691c1397..9f9e9edbab 100644
--- a/compiler/GHC/Driver/Flags.hs
+++ b/compiler/GHC/Driver/Flags.hs
@@ -68,9 +68,9 @@ data DumpFlag
| Opt_D_dump_simpl_iterations
| Opt_D_dump_spec
| Opt_D_dump_prep
- | Opt_D_dump_stg -- CoreToStg output
- | Opt_D_dump_stg_unarised -- STG after unarise
- | Opt_D_dump_stg_final -- STG after stg2stg
+ | Opt_D_dump_stg_from_core -- ^ Initial STG (CoreToStg output)
+ | Opt_D_dump_stg_unarised -- ^ STG after unarise
+ | Opt_D_dump_stg_final -- ^ Final STG (after stg2stg)
| Opt_D_dump_call_arity
| Opt_D_dump_exitify
| Opt_D_dump_stranal
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index 40ccb400bc..b5ded38737 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -2586,12 +2586,15 @@ dynamic_flags_deps = [
(setDumpFlag Opt_D_dump_spec)
, make_ord_flag defGhcFlag "ddump-prep"
(setDumpFlag Opt_D_dump_prep)
- , make_ord_flag defGhcFlag "ddump-stg"
- (setDumpFlag Opt_D_dump_stg)
+ , make_ord_flag defGhcFlag "ddump-stg-from-core"
+ (setDumpFlag Opt_D_dump_stg_from_core)
, make_ord_flag defGhcFlag "ddump-stg-unarised"
(setDumpFlag Opt_D_dump_stg_unarised)
, make_ord_flag defGhcFlag "ddump-stg-final"
(setDumpFlag Opt_D_dump_stg_final)
+ , make_dep_flag defGhcFlag "ddump-stg"
+ (setDumpFlag Opt_D_dump_stg_from_core)
+ "Use `-ddump-stg-from-core` or `-ddump-stg-final` instead"
, make_ord_flag defGhcFlag "ddump-call-arity"
(setDumpFlag Opt_D_dump_call_arity)
, make_ord_flag defGhcFlag "ddump-exitify"
diff --git a/compiler/GHC/Stg/Pipeline.hs b/compiler/GHC/Stg/Pipeline.hs
index 3891346dab..ea758e58db 100644
--- a/compiler/GHC/Stg/Pipeline.hs
+++ b/compiler/GHC/Stg/Pipeline.hs
@@ -52,7 +52,7 @@ stg2stg :: DynFlags -- includes spec of what stg-to-stg passes
-> IO [StgTopBinding] -- output program
stg2stg dflags this_mod binds
- = do { dump_when Opt_D_dump_stg "STG:" binds
+ = do { dump_when Opt_D_dump_stg_from_core "Initial STG:" binds
; showPass dflags "Stg2Stg"
-- Do the main business!
; binds' <- runStgM 'g' $
diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst
index 4b86617093..75728ae7d7 100644
--- a/docs/users_guide/debugging.rst
+++ b/docs/users_guide/debugging.rst
@@ -387,7 +387,7 @@ STG representation
These flags dump various phases of GHC's STG pipeline.
-.. ghc-flag:: -ddump-stg
+.. ghc-flag:: -ddump-stg-from-core
:shortdesc: Show CoreToStg output
:type: dynamic
@@ -411,6 +411,14 @@ These flags dump various phases of GHC's STG pipeline.
Show the output of the last STG pass before we generate Cmm.
+.. ghc-flag:: -ddump-stg
+ :shortdesc: *(deprecated)* Alias for :ghc-flag:`-ddump-stg-from-core`
+ :type: dynamic
+
+ Alias for :ghc-flag:`-ddump-stg-from-core`. Deprecated in favor of more explicit
+ flags: :ghc-flag:`-ddump-stg-from-core`, :ghc-flag:`-ddump-stg-final`, etc.
+
+
C-\\- representation
~~~~~~~~~~~~~~~~~~~~
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 0abd79858b..c033150957 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -210,7 +210,7 @@ test('T12076lit', normal, compile, ['-O'])
test('T12076sat', normal, compile, ['-O'])
test('T12212', normal, compile, ['-O'])
-test('noinline01', only_ways(['optasm']), compile, ['-ddump-stg -dsuppress-uniques -dsuppress-ticks -O'])
+test('noinline01', only_ways(['optasm']), compile, ['-ddump-stg-from-core -dsuppress-uniques -dsuppress-ticks -O'])
test('par01', only_ways(['optasm']), compile, ['-ddump-prep -dsuppress-uniques -dsuppress-ticks -O2'])
test('T12776', normal, compile, ['-O2'])
test('T9509',
diff --git a/testsuite/tests/simplCore/should_compile/noinline01.stderr b/testsuite/tests/simplCore/should_compile/noinline01.stderr
index f8b6cbb30f..d38b5dee03 100644
--- a/testsuite/tests/simplCore/should_compile/noinline01.stderr
+++ b/testsuite/tests/simplCore/should_compile/noinline01.stderr
@@ -1,5 +1,5 @@
-==================== STG: ====================
+==================== Initial STG: ====================
Noinline01.f [InlPrag=INLINE (sat-args=1)]
:: forall {p}. p -> GHC.Types.Bool
[GblId, Arity=1, Str=<L,A>, Unf=OtherCon []] =