From f87bd8c930c2a0c6c5e77da9b442bc0603df9071 Mon Sep 17 00:00:00 2001 From: nineonine Date: Thu, 10 Feb 2022 00:10:19 -0800 Subject: ghci: fix -ddump-stg-cg (#21052) The pre-codegen Stg AST dump was not available in ghci because it was performed in 'doCodeGen'. This was now moved to 'coreToStg' area. --- compiler/GHC/Driver/Main.hs | 6 +++--- testsuite/tests/ghci/should_run/T21052.script | 4 ++++ testsuite/tests/ghci/should_run/T21052.stdout | 10 ++++++++++ testsuite/tests/ghci/should_run/all.T | 1 + 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 testsuite/tests/ghci/should_run/T21052.script create mode 100644 testsuite/tests/ghci/should_run/T21052.stdout 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']) -- cgit v1.2.1