[commit: ghc] master: Have static pointers work with -fno-full-laziness. (0b70ec0)

git at git.haskell.org git at git.haskell.org
Tue Nov 1 14:11:49 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/0b70ec0c3b72a7f87776743e64b47b65ef0ca4a5/ghc

>---------------------------------------------------------------

commit 0b70ec0c3b72a7f87776743e64b47b65ef0ca4a5
Author: Facundo Domínguez <facundo.dominguez at tweag.io>
Date:   Fri Oct 28 19:25:05 2016 -0300

    Have static pointers work with -fno-full-laziness.
    
    Summary:
    Before this patch, static pointers wouldn't be floated to
    the top-level.
    
    Test Plan: ./validate
    
    Reviewers: simonpj, bgamari, austin
    
    Subscribers: mboes, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2662
    
    GHC Trac Issues: #11656


>---------------------------------------------------------------

0b70ec0c3b72a7f87776743e64b47b65ef0ca4a5
 compiler/simplCore/SimplCore.hs                    | 26 ++++++++++++++--------
 ...inters.hs => CgStaticPointersNoFullLazyness.hs} |  0
 ...tdout => CgStaticPointersNoFullLazyness.stdout} |  0
 testsuite/tests/codeGen/should_run/all.T           |  2 ++
 4 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs
index 0af167e..ca869dc 100644
--- a/compiler/simplCore/SimplCore.hs
+++ b/compiler/simplCore/SimplCore.hs
@@ -204,16 +204,20 @@ getCoreToDo dflags
                            [simpl_phase 0 ["post-worker-wrapper"] max_iter]
                            ))
 
+    -- Static forms are moved to the top level with the FloatOut pass.
+    -- See Note [Grand plan for static forms].
+    static_ptrs_float_outwards =
+      runWhen static_ptrs $ CoreDoFloatOutwards FloatOutSwitches
+        { floatOutLambdas   = Just 0
+        , floatOutConstants = True
+        , floatOutOverSatApps = False
+        , floatToTopLevelOnly = True
+        }
+
     core_todo =
      if opt_level == 0 then
        [ vectorisation,
-         -- Static forms are moved to the top level with the FloatOut pass.
-         -- See Note [Grand plan for static forms].
-         runWhen static_ptrs $ CoreDoFloatOutwards FloatOutSwitches {
-                                 floatOutLambdas   = Just 0,
-                                 floatOutConstants = True,
-                                 floatOutOverSatApps = False,
-                                 floatToTopLevelOnly = True },
+         static_ptrs_float_outwards,
          CoreDoSimplify max_iter
              (base_mode { sm_phase = Phase 0
                         , sm_names = ["Non-opt simplification"] })
@@ -238,12 +242,12 @@ getCoreToDo dflags
         -- so that overloaded functions have all their dictionary lambdas manifest
         runWhen do_specialise CoreDoSpecialising,
 
-        runWhen full_laziness $
+        if full_laziness then
            CoreDoFloatOutwards FloatOutSwitches {
                                  floatOutLambdas   = Just 0,
                                  floatOutConstants = True,
                                  floatOutOverSatApps = False,
-                                 floatToTopLevelOnly = False },
+                                 floatToTopLevelOnly = False }
                 -- Was: gentleFloatOutSwitches
                 --
                 -- I have no idea why, but not floating constants to
@@ -261,6 +265,10 @@ getCoreToDo dflags
                 -- difference at all to performance if we do it here,
                 -- but maybe we save some unnecessary to-and-fro in
                 -- the simplifier.
+        else
+           -- Even with full laziness turned off, we still need to float static
+           -- forms to the top level. See Note [Grand plan for static forms].
+           static_ptrs_float_outwards,
 
         simpl_phases,
 
diff --git a/testsuite/tests/codeGen/should_run/CgStaticPointers.hs b/testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.hs
similarity index 100%
copy from testsuite/tests/codeGen/should_run/CgStaticPointers.hs
copy to testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.hs
diff --git a/testsuite/tests/codeGen/should_run/CgStaticPointers.stdout b/testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.stdout
similarity index 100%
copy from testsuite/tests/codeGen/should_run/CgStaticPointers.stdout
copy to testsuite/tests/codeGen/should_run/CgStaticPointersNoFullLazyness.stdout
diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T
index 65e3dc0..23caa8c 100644
--- a/testsuite/tests/codeGen/should_run/all.T
+++ b/testsuite/tests/codeGen/should_run/all.T
@@ -119,6 +119,8 @@ test('T8256', normal, compile_and_run, ['-dcore-lint -O1'])
 test('T6084',normal, compile_and_run, ['-O2'])
 test('CgStaticPointers', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
      compile_and_run, [''])
+test('CgStaticPointersNoFullLazyness', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
+     compile_and_run, ['-O -fno-full-laziness'])
 test('StaticArraySize', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
      compile_and_run, ['-O2'])
 test('StaticByteArraySize', normal, compile_and_run, ['-O2'])



More information about the ghc-commits mailing list