[commit: ghc] master: New internal dynamic flag: Very aggressive inlining (8212135)
git at git.haskell.org
git at git.haskell.org
Sat Feb 4 23:09:34 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/82121357f5bf0fd04500187a097c3b614e1fcfd1/ghc
>---------------------------------------------------------------
commit 82121357f5bf0fd04500187a097c3b614e1fcfd1
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Thu Feb 2 20:28:07 2017 -0500
New internal dynamic flag: Very aggressive inlining
This flag overrides the inliner heuristics to inline something
independent of cost, size, expected gains or boringness of the context.
It still adheres to arity, simplifier phase control and loop breakers.
This is not exposed via a command line flag and added for the benefit of
GHC API users.
Differential Revision: https://phabricator.haskell.org/D3069
>---------------------------------------------------------------
82121357f5bf0fd04500187a097c3b614e1fcfd1
compiler/coreSyn/CoreUnfold.hs | 9 ++++++++-
compiler/main/DynFlags.hs | 2 ++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs
index 11c4a5e..eaed698 100644
--- a/compiler/coreSyn/CoreUnfold.hs
+++ b/compiler/coreSyn/CoreUnfold.hs
@@ -913,6 +913,11 @@ ufFunAppDiscount
ufDearOp
The size of a foreign call or not-dupable PrimOp
+ufVeryAggressive
+ If True, the compiler ignores all the thresholds and inlines very
+ aggressively. It still adheres to arity, simplifier phase control and
+ loop breakers.
+
Note [Function applications]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1155,7 +1160,7 @@ tryUnfolding dflags id lone_variable
UnfNever -> traceInline dflags str (text "UnfNever") Nothing
UnfWhen { ug_arity = uf_arity, ug_unsat_ok = unsat_ok, ug_boring_ok = boring_ok }
- | enough_args && (boring_ok || some_benefit)
+ | enough_args && (boring_ok || some_benefit || ufVeryAggressive dflags)
-- See Note [INLINE for small functions (3)]
-> traceInline dflags str (mk_doc some_benefit empty True) (Just unf_template)
| otherwise
@@ -1165,6 +1170,8 @@ tryUnfolding dflags id lone_variable
enough_args = (n_val_args >= uf_arity) || (unsat_ok && n_val_args > 0)
UnfIfGoodArgs { ug_args = arg_discounts, ug_res = res_discount, ug_size = size }
+ | ufVeryAggressive dflags
+ -> traceInline dflags str (mk_doc some_benefit extra_doc True) (Just unf_template)
| is_wf && some_benefit && small_enough
-> traceInline dflags str (mk_doc some_benefit extra_doc True) (Just unf_template)
| otherwise
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index d7a5f1f..ef8ac96 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -868,6 +868,7 @@ data DynFlags = DynFlags {
ufDictDiscount :: Int,
ufKeenessFactor :: Float,
ufDearOp :: Int,
+ ufVeryAggressive :: Bool,
maxWorkerArgs :: Int,
@@ -1638,6 +1639,7 @@ defaultDynFlags mySettings =
ufDictDiscount = 30,
ufKeenessFactor = 1.5,
ufDearOp = 40,
+ ufVeryAggressive = False,
maxWorkerArgs = 10,
More information about the ghc-commits
mailing list