[commit: ghc] supercompiler: More feedback from ghcHeuristics (6f53c83)

Max Bolingbroke <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : supercompiler

http://hackage.haskell.org/trac/ghc/changeset/6f53c83c46a145f02f0e5b94aefce58685942137

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

commit 6f53c83c46a145f02f0e5b94aefce58685942137
Author: Max Bolingbroke <[email protected]>
Date:   Wed Mar 28 11:23:48 2012 +0100

    More feedback from ghcHeuristics

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

 .../Supercompile/Evaluator/Evaluate.hs             |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/compiler/supercompile/Supercompile/Evaluator/Evaluate.hs b/compiler/supercompile/Supercompile/Evaluator/Evaluate.hs
index 6a69dbc..977e703 100644
--- a/compiler/supercompile/Supercompile/Evaluator/Evaluate.hs
+++ b/compiler/supercompile/Supercompile/Evaluator/Evaluate.hs
@@ -104,16 +104,20 @@ ghcHeuristics x (lone_variable, arg_infos, cont_info) = case idUnfolding x of
                            -> tryUnfolding dflags1 x lone_variable 
                                            arg_infos cont_info is_top 
                                            is_cheap uf_arity guidance
-  CoreSyn.NoUnfolding      -> False
-  CoreSyn.OtherCon {}      -> False
+  CoreSyn.NoUnfolding      -> trce (text "No unfolding") False
+  CoreSyn.OtherCon {}      -> trce (text "No positive unfolding") False
   -- GHC actually only looks through DFunUnfoldings in exprIsConApp_maybe,
   -- so I'll do this rough heuristic instead:
-  CoreSyn.DFunUnfolding {} -> length arg_infos >= idArity x
+  CoreSyn.DFunUnfolding {} -> trce (text "Dictionary unfolding") length arg_infos >= idArity x
  where dflags0 = defaultDynFlags (error "ghcHeuristics: Settings in DynFlags used!")
        -- Set these two flags so that we get information about failed inlinings:
        dflags1 | tRACE     = dopt_set (dopt_set dflags0 Opt_D_verbose_core2core) Opt_D_dump_inlinings
                | otherwise = dflags0
 
+       trce :: SDoc -> a -> a
+       trce | tRACE     = pprTrace ("Considering inlining: " ++ showSDoc (ppr x))
+            | otherwise = flip const
+
 -- | Non-expansive simplification we can do everywhere safely
 --
 -- Normalisation only ever releases deeds: it is *never* a net consumer of deeds. So normalisation
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.