diff options
author | simonpj@microsoft.com <unknown> | 2009-11-03 15:27:52 +0000 |
---|---|---|
committer | simonpj@microsoft.com <unknown> | 2009-11-03 15:27:52 +0000 |
commit | d10fa3041959b3e05a4718ff9d1ab8201d1d591e (patch) | |
tree | a1ba0c15ee73667bd556233b0226b0ec60ad43ce /compiler | |
parent | ae368b7c1654da96e4ca1a0485fe6e0818ef8426 (diff) | |
download | haskell-d10fa3041959b3e05a4718ff9d1ab8201d1d591e.tar.gz |
Tweak simpleOptExpr, so that it respects nested INLINE pragmas
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/coreSyn/CoreSubst.lhs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/coreSyn/CoreSubst.lhs b/compiler/coreSyn/CoreSubst.lhs index 3fe48009a8..3224cc2763 100644 --- a/compiler/coreSyn/CoreSubst.lhs +++ b/compiler/coreSyn/CoreSubst.lhs @@ -48,6 +48,7 @@ import IdInfo import Unique import UniqSupply import Maybes +import BasicTypes ( isAlwaysActive ) import Outputable import PprCore () -- Instances import FastString @@ -667,6 +668,7 @@ simpleOptExpr expr | isId b -- let x = e in <body> , safe_to_inline (idOccInfo b) || exprIsTrivial r' + , isAlwaysActive (idInlineActivation b) -- Note [Inline prag in simplOpt] = Left (extendIdSubst subst b r') | otherwise @@ -682,3 +684,22 @@ simpleOptExpr expr safe_to_inline (IAmALoopBreaker {}) = False safe_to_inline NoOccInfo = False \end{code} + +Note [Inline prag in simplOpt] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +If there's an INLINE/NOINLINE pragma that restricts the phase in +which the binder can be inlined, we don't inline here; after all, +we don't know what phase we're in. Here's an example + + foo :: Int -> Int -> Int + {-# INLINE foo #-} + foo m n = inner m + where + {-# INLINE [1] inner #-} + inner m = m+n + + bar :: Int -> Int + bar n = foo n 1 + +When inlining 'foo' in 'bar' we want the let-binding for 'inner' +to remain visible until Phase 1
\ No newline at end of file |