summaryrefslogtreecommitdiff
path: root/compiler/GHC/Iface
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2022-04-07 17:21:47 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-06 06:13:17 -0400
commitfab0ee93abda33bf5c7eb5ca0372e12bd140a252 (patch)
treedfb79e20a525328a52bd5ea9168583b836f9ab54 /compiler/GHC/Iface
parent1f6c56ae9aa4ab4977ba376ac901d5256bf0aba0 (diff)
downloadhaskell-fab0ee93abda33bf5c7eb5ca0372e12bd140a252.tar.gz
Change `-fprof-late` to insert cost centres after unfolding creation.
The former behaviour of adding cost centres after optimization but before unfoldings are created is not available via the flag `prof-late-inline` instead. I also reduced the overhead of -fprof-late* by pushing the cost centres into lambdas. This means the cost centres will only account for execution of functions and not their partial application. Further I made LATE_CC cost centres it's own CC flavour so they now won't clash with user defined ones if a user uses the same string for a custom scc. LateCC: Don't put cost centres inside constructor workers. With -fprof-late they are rarely useful as the worker is usually inlined. Even if the worker is not inlined or we use -fprof-late-linline they are generally not helpful but bloat compile and run time significantly. So we just don't add sccs inside constructor workers. ------------------------- Metric Decrease: T13701 -------------------------
Diffstat (limited to 'compiler/GHC/Iface')
-rw-r--r--compiler/GHC/Iface/Tidy.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Iface/Tidy.hs b/compiler/GHC/Iface/Tidy.hs
index 1edd3cb9bf..7fec591196 100644
--- a/compiler/GHC/Iface/Tidy.hs
+++ b/compiler/GHC/Iface/Tidy.hs
@@ -347,7 +347,7 @@ data UnfoldingExposure
data TidyOpts = TidyOpts
{ opt_name_cache :: !NameCache
- , opt_collect_ccs :: !Bool
+ , opt_collect_ccs :: !Bool -- ^ Always true if we compile with -prof
, opt_unfolding_opts :: !UnfoldingOpts
, opt_expose_unfoldings :: !UnfoldingExposure
-- ^ Which unfoldings to expose
@@ -468,7 +468,7 @@ tidyProgram opts (ModGuts { mg_module = mod
-- unfoldings.
collectCostCentres :: Module -> CoreProgram -> [CoreRule] -> S.Set CostCentre
collectCostCentres mod_name binds rules
- = foldl' go_bind (go_rules S.empty) binds
+ = {-# SCC collectCostCentres #-} foldl' go_bind (go_rules S.empty) binds
where
go cs e = case e of
Var{} -> cs