[Git][ghc/ghc][master] Fix -ddump-stg flag

Marge Bot gitlab at gitlab.haskell.org
Fri Aug 21 13:37:18 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
2d8ca917 by Sylvain Henry at 2020-08-21T09:37:15-04:00
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.

- - - - -


6 changed files:

- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Stg/Pipeline.hs
- docs/users_guide/debugging.rst
- testsuite/tests/simplCore/should_compile/all.T
- testsuite/tests/simplCore/should_compile/noinline01.stderr


Changes:

=====================================
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


=====================================
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"


=====================================
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' $


=====================================
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
 ~~~~~~~~~~~~~~~~~~~~
 


=====================================
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',


=====================================
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 []] =



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2d8ca9170328249a436c3b5647b8e548d32b11c8

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2d8ca9170328249a436c3b5647b8e548d32b11c8
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200821/40e8c8ba/attachment-0001.html>


More information about the ghc-commits mailing list