summaryrefslogtreecommitdiff
path: root/compiler/main
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2018-03-13 13:54:53 -0400
committerBen Gamari <ben@smart-cactus.org>2018-03-13 13:57:17 -0400
commitadc3415f14aa090c54c68149dcb1d99f19132a83 (patch)
treeff40375cbd41de0d0087c73cea3de15f3843d592 /compiler/main
parentabfe10487d2dba49bf511297f14575f9089cc5b1 (diff)
downloadhaskell-wip/D4327.tar.gz
WIP: Add likelyhood to alternatives from stg onwardswip/D4327
Summary: Adds a Freq value to Stg/Cmm cases/switches/conditionals. Currently only generates these values by checking alternatives for bottom expressions. They are passed along to the backend where they affect conditional generation slightly. As it stands runtime improvements seem to be less than expected. This might only be worth merging once we have more branch weights available. Reviewers: hvr, goldfire, bgamari, simonmar, simonpj, erikd Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie, carter GHC Trac Issues: #14672 Differential Revision: https://phabricator.haskell.org/D4327
Diffstat (limited to 'compiler/main')
-rw-r--r--compiler/main/DynFlags.hs16
-rw-r--r--compiler/main/ErrUtils.hs9
2 files changed, 19 insertions, 6 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index e6b9cf6b93..c59f26c1e8 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -485,6 +485,8 @@ data GeneralFlag
| Opt_SolveConstantDicts
| Opt_AlignmentSanitisation
| Opt_CatchBottoms
+ | Opt_UnlikelyBottoms -- ^ Assume bottoming alternatives are not taken.
+ | Opt_WeightBalanceAlts -- ^ Split trees by branch weight where applicable.
-- PreInlining is on by default. The option is there just to see how
-- bad things get if you turn it off!
@@ -583,6 +585,7 @@ data GeneralFlag
| Opt_SuppressUniques
| Opt_SuppressStgFreeVars
| Opt_SuppressTicks -- Replaces Opt_PprShowTicks
+ | Opt_SuppressTimestamps -- ^ Suppress timestamps in dumps
-- temporary flags
| Opt_AutoLinkPackages
@@ -3040,7 +3043,8 @@ dynamic_flags_deps = [
setGeneralFlag Opt_SuppressIdInfo
setGeneralFlag Opt_SuppressTicks
setGeneralFlag Opt_SuppressStgFreeVars
- setGeneralFlag Opt_SuppressTypeSignatures)
+ setGeneralFlag Opt_SuppressTypeSignatures
+ setGeneralFlag Opt_SuppressTimestamps)
------ Debugging ----------------------------------------------------
, make_ord_flag defGhcFlag "dstg-stats"
@@ -3835,10 +3839,12 @@ dFlagsDeps = [
flagSpec "suppress-idinfo" Opt_SuppressIdInfo,
flagSpec "suppress-unfoldings" Opt_SuppressUnfoldings,
flagSpec "suppress-module-prefixes" Opt_SuppressModulePrefixes,
+ flagSpec "suppress-timestamps" Opt_SuppressTimestamps,
flagSpec "suppress-type-applications" Opt_SuppressTypeApplications,
flagSpec "suppress-type-signatures" Opt_SuppressTypeSignatures,
flagSpec "suppress-uniques" Opt_SuppressUniques,
- flagSpec "suppress-var-kinds" Opt_SuppressVarKinds]
+ flagSpec "suppress-var-kinds" Opt_SuppressVarKinds
+ ]
-- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
fFlags :: [FlagSpec GeneralFlag]
@@ -3956,7 +3962,9 @@ fFlagsDeps = [
flagSpec "abstract-refinement-substitutions" Opt_AbstractRefSubstitutions,
flagSpec "unclutter-valid-substitutions" Opt_UnclutterValidSubstitutions,
flagSpec "show-loaded-modules" Opt_ShowLoadedModules,
- flagSpec "whole-archive-hs-libs" Opt_WholeArchiveHsLibs
+ flagSpec "whole-archive-hs-libs" Opt_WholeArchiveHsLibs,
+ flagSpec "unlikely-bottoms" Opt_UnlikelyBottoms,
+ flagSpec "weight-balance-alts" Opt_WeightBalanceAlts
]
-- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
@@ -4344,6 +4352,8 @@ optLevelFlags -- see Note [Documenting optimisation flags]
, ([2], Opt_LiberateCase)
, ([2], Opt_SpecConstr)
+ , ([1,2], Opt_UnlikelyBottoms)
+ , ([1,2], Opt_WeightBalanceAlts)
-- , ([2], Opt_RegsGraph)
-- RegsGraph suffers performance regression. See #7679
-- , ([2], Opt_StaticArgumentTransformation)
diff --git a/compiler/main/ErrUtils.hs b/compiler/main/ErrUtils.hs
index 13ff017e09..c7fb8babe9 100644
--- a/compiler/main/ErrUtils.hs
+++ b/compiler/main/ErrUtils.hs
@@ -500,9 +500,12 @@ dumpSDoc dflags print_unqual flag hdr doc =
doc' <- if null hdr
then return doc
else do t <- getCurrentTime
- let d = text (show t)
- $$ blankLine
- $$ doc
+ let timeStamp = if (gopt Opt_SuppressTimestamps dflags)
+ then empty
+ else text (show t)
+ let d = timeStamp
+ $$ blankLine
+ $$ doc
return $ mkDumpDoc hdr d
defaultLogActionHPrintDoc dflags handle doc' dump_style