diff options
author | simonpj@microsoft.com <unknown> | 2010-10-27 18:41:07 +0000 |
---|---|---|
committer | simonpj@microsoft.com <unknown> | 2010-10-27 18:41:07 +0000 |
commit | 51367fba96fd863ce7d3e2571bd22366b47b900a (patch) | |
tree | 0b24d259d7db9c39c6aa0e85f3d26f30b7e61a7d /compiler/stranal | |
parent | 94bf0d3604ff0d2ecab246924af712bdd1c29a40 (diff) | |
download | haskell-51367fba96fd863ce7d3e2571bd22366b47b900a.tar.gz |
Don't worker-wrapper INLINABLE things
See Note [Don't w/w INLINABLE things] in WorkWrap
This fixes a bug that Milan found.
Diffstat (limited to 'compiler/stranal')
-rw-r--r-- | compiler/stranal/WorkWrap.lhs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler/stranal/WorkWrap.lhs b/compiler/stranal/WorkWrap.lhs index d329b5a078..a8f110c96c 100644 --- a/compiler/stranal/WorkWrap.lhs +++ b/compiler/stranal/WorkWrap.lhs @@ -173,6 +173,20 @@ I measured it on nofib, it didn't make much difference; just a few percent improved allocation on one benchmark (bspt/Euclid.space). But nothing got worse. +Note [Don't w/w INLINABLE things] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +If we have + {-# INLINABLE f #-} + f x y = .... +then in principle we might get a more efficient loop by w/w'ing f. +But that would make a new unfolding which would overwrite the old +one. So we leave INLINABLE things alone too. + +This is a slight infelicity really, because it means that adding +an INLINABLE pragma could make a program a bit less efficient, +because you lose the worker/wrapper stuff. But I don't see a way +to avoid that. + Note [Wrapper activation] ~~~~~~~~~~~~~~~~~~~~~~~~~ When should the wrapper inlining be active? It must not be active @@ -260,6 +274,7 @@ tryWW is_rec fn_id rhs checkSize :: Id -> CoreExpr -> UniqSM [(Id,CoreExpr)] -> UniqSM [(Id,CoreExpr)] -- See Note [Don't w/w inline things (a) and (b)] + -- and Note [Don't w/w INLINABLE things] checkSize fn_id rhs thing_inside | isStableUnfolding unfolding -- For DFuns and INLINE things, leave their = return [ (fn_id, rhs) ] -- unfolding unchanged; but still attach @@ -271,7 +286,8 @@ checkSize fn_id rhs thing_inside | otherwise = thing_inside where - unfolding = idUnfolding fn_id + unfolding = realIdUnfolding fn_id -- We want to see the unfolding + -- for loop breakers! inline_rule = mkInlineUnfolding Nothing rhs --------------------- |