summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornineonine <mail4chemik@gmail.com>2022-02-10 00:10:19 -0800
committernineonine <mail4chemik@gmail.com>2022-02-14 11:37:31 -0800
commitf87bd8c930c2a0c6c5e77da9b442bc0603df9071 (patch)
tree14ba39e2132e86e36a9e68d80fc914ec60630190
parentef5cf55d71e84a0a42596b4ec253ecb0d63f149b (diff)
downloadhaskell-wip/T21052.tar.gz
ghci: fix -ddump-stg-cg (#21052)wip/T21052
The pre-codegen Stg AST dump was not available in ghci because it was performed in 'doCodeGen'. This was now moved to 'coreToStg' area.
-rw-r--r--compiler/GHC/Driver/Main.hs6
-rw-r--r--testsuite/tests/ghci/should_run/T21052.script4
-rw-r--r--testsuite/tests/ghci/should_run/T21052.stdout10
-rw-r--r--testsuite/tests/ghci/should_run/all.T1
4 files changed, 18 insertions, 3 deletions
diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs
index b07d566a5b..d0d29a83e7 100644
--- a/compiler/GHC/Driver/Main.hs
+++ b/compiler/GHC/Driver/Main.hs
@@ -1803,9 +1803,6 @@ doCodeGen hsc_env this_mod denv data_tycons
tmpfs = hsc_tmpfs hsc_env
platform = targetPlatform dflags
- putDumpFileMaybe logger Opt_D_dump_stg_cg "CodeGenInput STG:" FormatSTG
- (pprGenStgTopBindings (initStgPprOpts dflags) stg_binds_w_fvs)
-
-- Do tag inference on optimized STG
(!stg_post_infer,export_tag_info) <-
{-# SCC "StgTagFields" #-} inferTags dflags logger this_mod stg_binds_w_fvs
@@ -1891,6 +1888,9 @@ myCoreToStg logger dflags ictxt for_bytecode this_mod ml prepd_binds = do
stg2stg logger ictxt (initStgPipelineOpts dflags for_bytecode)
this_mod stg_binds
+ putDumpFileMaybe logger Opt_D_dump_stg_cg "CodeGenInput STG:" FormatSTG
+ (pprGenStgTopBindings (initStgPprOpts dflags) stg_binds_with_fvs)
+
return (stg_binds_with_fvs, denv, cost_centre_info)
{- **********************************************************************
diff --git a/testsuite/tests/ghci/should_run/T21052.script b/testsuite/tests/ghci/should_run/T21052.script
new file mode 100644
index 0000000000..ad373c82cb
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/T21052.script
@@ -0,0 +1,4 @@
+:set -ddump-stg-cg
+:set -dsuppress-uniques
+
+foo = ()
diff --git a/testsuite/tests/ghci/should_run/T21052.stdout b/testsuite/tests/ghci/should_run/T21052.stdout
new file mode 100644
index 0000000000..1fee75de62
--- /dev/null
+++ b/testsuite/tests/ghci/should_run/T21052.stdout
@@ -0,0 +1,10 @@
+
+==================== CodeGenInput STG: ====================
+BCO_toplevel :: GHC.Types.IO [()]
+[LclId] =
+ {} \u []
+ let {
+ sat :: [()]
+ [LclId] =
+ CCCS :! [GHC.Tuple.() GHC.Types.[]];
+ } in GHC.Base.returnIO sat;
diff --git a/testsuite/tests/ghci/should_run/all.T b/testsuite/tests/ghci/should_run/all.T
index 4b4b151963..77c17a995c 100644
--- a/testsuite/tests/ghci/should_run/all.T
+++ b/testsuite/tests/ghci/should_run/all.T
@@ -81,3 +81,4 @@ test('T19460', just_ghci, ghci_script, ['T19460.script'])
test('T19733', just_ghci, compile_and_run, [''])
test('T19628', [extra_files(['T19628a.hs']), only_ways(['ghci']) ], compile_and_run, [''])
+test('T21052', just_ghci, ghci_script, ['T21052.script'])