Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tobias Decking
GHC
Commits
e731cb13
Commit
e731cb13
authored
Oct 09, 2012
by
ian@well-typed.com
Browse files
Make -f(no-)pre-inlining a dynamic flag
parent
a327c140
Changes
6
Hide whitespace changes
Inline
Side-by-side
compiler/main/DynFlags.hs
View file @
e731cb13
...
...
@@ -341,6 +341,10 @@ data DynFlag
|
Opt_RelativeDynlibPaths
|
Opt_Hpc
-- PreInlining is on by default. The option is there just to see how
-- bad things get if you turn it off!
|
Opt_SimplPreInlining
-- output style opts
|
Opt_ErrorSpans
-- Include full span info in error messages,
-- instead of just the start position.
...
...
@@ -2331,6 +2335,7 @@ fFlags = [
(
"prof-count-entries"
,
Opt_ProfCountEntries
,
nop
),
(
"prof-cafs"
,
Opt_AutoSccsOnIndividualCafs
,
nop
),
(
"hpc"
,
Opt_Hpc
,
nop
),
(
"pre-inlining"
,
Opt_SimplPreInlining
,
nop
),
(
"use-rpaths"
,
Opt_RPath
,
nop
)
]
...
...
@@ -2512,6 +2517,7 @@ defaultFlags settings
Opt_GhciHistory
,
Opt_HelpfulErrors
,
Opt_ProfCountEntries
,
Opt_SimplPreInlining
,
Opt_RPath
]
...
...
compiler/main/StaticFlagParser.hs
View file @
e731cb13
...
...
@@ -120,7 +120,6 @@ isStaticFlag f =
"dno-black-holing"
,
"fno-state-hack"
,
"fruntime-types"
,
"fno-pre-inlining"
,
"fno-opt-coercion"
,
"fno-flat-cache"
,
"fexcess-precision"
,
...
...
compiler/main/StaticFlags.hs
View file @
e731cb13
...
...
@@ -35,7 +35,6 @@ module StaticFlags (
-- optimisation opts
opt_NoStateHack
,
opt_CprOff
,
opt_SimplNoPreInlining
,
opt_SimplExcessPrecision
,
opt_NoOptCoercion
,
opt_NoFlatCache
,
...
...
@@ -179,10 +178,6 @@ opt_CprOff = lookUp (fsLit "-fcpr-off")
-- Switch off CPR analysis in the new demand analyser
-- Simplifier switches
opt_SimplNoPreInlining
::
Bool
opt_SimplNoPreInlining
=
lookUp
(
fsLit
"-fno-pre-inlining"
)
-- NoPreInlining is there just to see how bad things
-- get if you don't do it!
opt_SimplExcessPrecision
::
Bool
opt_SimplExcessPrecision
=
lookUp
(
fsLit
"-fexcess-precision"
)
...
...
compiler/simplCore/SimplUtils.lhs
View file @
e731cb13
...
...
@@ -34,7 +34,6 @@ import SimplEnv
import CoreMonad ( SimplifierMode(..), Tick(..) )
import MkCore ( sortQuantVars )
import DynFlags
import StaticFlags
import CoreSyn
import qualified CoreSubst
import PprCore
...
...
@@ -812,12 +811,12 @@ is a term (not a coercion) so we can't necessarily inline the latter in
the former.
\begin{code}
preInlineUnconditionally :: SimplEnv -> TopLevelFlag -> InId -> InExpr -> Bool
preInlineUnconditionally env top_lvl bndr rhs
preInlineUnconditionally ::
DynFlags ->
SimplEnv -> TopLevelFlag -> InId -> InExpr -> Bool
preInlineUnconditionally
dflags
env top_lvl bndr rhs
| not active = False
| isStableUnfolding (idUnfolding bndr) = False -- Note [InlineRule and preInlineUnconditionally]
| isTopLevel top_lvl && isBottomingId bndr = False -- Note [Top-level bottoming Ids]
|
o
pt_Simpl
No
PreInlining
= False
|
not (dopt O
pt_SimplPreInlining
dflags)
= False
| isCoVar bndr = False -- Note [Do not inline CoVars unconditionally]
| otherwise = case idOccInfo bndr of
IAmDead -> True -- Happens in ((\x.1) v)
...
...
compiler/simplCore/Simplify.lhs
View file @
e731cb13
...
...
@@ -291,12 +291,12 @@ simplRecOrTopPair :: SimplEnv
-> SimplM SimplEnv -- Returns an env that includes the binding
simplRecOrTopPair env top_lvl is_rec old_bndr new_bndr rhs
| preInlineUnconditionally env top_lvl old_bndr rhs -- Check for unconditional inline
= do { tick (PreInlineUnconditionally old_bndr)
; return (extendIdSubst env old_bndr (mkContEx env rhs)) }
| otherwise
=
simplLazyBind env top_lvl is_rec old_bndr new_bndr rhs env
= do dflags <- getDynFlags
-- Check for unconditional inline
if preInlineUnconditionally dflags env top_lvl old_bndr rhs
then do tick (PreInlineUnconditionally old_bndr)
return (extendIdSubst env old_bndr (mkContEx env rhs))
else
simplLazyBind env top_lvl is_rec old_bndr new_bndr rhs env
\end{code}
...
...
@@ -1333,21 +1333,24 @@ simplNonRecE env bndr (Type ty_arg, rhs_se) (bndrs, body) cont
; simplLam (extendTvSubst env bndr ty_arg') bndrs body cont }
simplNonRecE env bndr (rhs, rhs_se) (bndrs, body) cont
| preInlineUnconditionally env NotTopLevel bndr rhs
= do { tick (PreInlineUnconditionally bndr)
; -- pprTrace "preInlineUncond" (ppr bndr <+> ppr rhs) $
simplLam (extendIdSubst env bndr (mkContEx rhs_se rhs)) bndrs body cont }
| isStrictId bndr -- Includes coercions
= do { simplExprF (rhs_se `setFloats` env) rhs
(StrictBind bndr bndrs body env cont) }
| otherwise
= ASSERT( not (isTyVar bndr) )
do { (env1, bndr1) <- simplNonRecBndr env bndr
; let (env2, bndr2) = addBndrRules env1 bndr bndr1
; env3 <- simplLazyBind env2 NotTopLevel NonRecursive bndr bndr2 rhs rhs_se
; simplLam env3 bndrs body cont }
= do dflags <- getDynFlags
case () of
_
| preInlineUnconditionally dflags env NotTopLevel bndr rhs ->
do { tick (PreInlineUnconditionally bndr)
; -- pprTrace "preInlineUncond" (ppr bndr <+> ppr rhs) $
simplLam (extendIdSubst env bndr (mkContEx rhs_se rhs)) bndrs body cont }
| isStrictId bndr -> -- Includes coercions
do { simplExprF (rhs_se `setFloats` env) rhs
(StrictBind bndr bndrs body env cont) }
| otherwise ->
ASSERT( not (isTyVar bndr) )
do { (env1, bndr1) <- simplNonRecBndr env bndr
; let (env2, bndr2) = addBndrRules env1 bndr bndr1
; env3 <- simplLazyBind env2 NotTopLevel NonRecursive bndr bndr2 rhs rhs_se
; simplLam env3 bndrs body cont }
\end{code}
%************************************************************************
...
...
docs/users_guide/flags.xml
View file @
e731cb13
...
...
@@ -1627,7 +1627,7 @@
<row>
<entry><option>
-fno-pre-inlining
</option></entry>
<entry>
Turn off pre-inlining
</entry>
<entry>
stat
ic
</entry>
<entry>
dynam
ic
</entry>
<entry>
-
</entry>
</row>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment