diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2011-07-21 12:52:01 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2011-07-21 12:52:01 +0100 |
commit | f88b20f4139773a956430c99664d2db5b8c01202 (patch) | |
tree | 458530f9901c03d4af943d66ec511d89a1334b76 /compiler/simplCore/SimplUtils.lhs | |
parent | 98e9096cdcfe7501109b66e3a22e7a41eee4521b (diff) | |
download | haskell-f88b20f4139773a956430c99664d2db5b8c01202.tar.gz |
Simplify the treatment of RULES in OccurAnal
I realised that my recently-added cunning stuff about
RULES for imported Ids was simply wrong, so this patch
removes it. See Note [Rules for imported functions],
which explains it all.
This patch also does quite a bit of refactoring in
the treatment of loop breakers.
Diffstat (limited to 'compiler/simplCore/SimplUtils.lhs')
-rw-r--r-- | compiler/simplCore/SimplUtils.lhs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/simplCore/SimplUtils.lhs b/compiler/simplCore/SimplUtils.lhs index 7d5d764fc6..b49b2460da 100644 --- a/compiler/simplCore/SimplUtils.lhs +++ b/compiler/simplCore/SimplUtils.lhs @@ -669,11 +669,11 @@ active_unfolding_gentle id prag = idInlinePragma id ---------------------- -activeRule :: DynFlags -> SimplEnv -> Maybe (Activation -> Bool) +activeRule :: SimplEnv -> Activation -> Bool -- Nothing => No rules at all -activeRule _dflags env - | not (sm_rules mode) = Nothing -- Rewriting is off - | otherwise = Just (isActive (sm_phase mode)) +activeRule env + | not (sm_rules mode) = \_ -> False -- Rewriting is off + | otherwise = isActive (sm_phase mode) where mode = getMode env \end{code} @@ -906,7 +906,7 @@ postInlineUnconditionally -> Bool postInlineUnconditionally env top_lvl bndr occ_info rhs unfolding | not active = False - | isLoopBreaker occ_info = False -- If it's a loop-breaker of any kind, don't inline + | isWeakLoopBreaker occ_info = False -- If it's a loop-breaker of any kind, don't inline -- because it might be referred to "earlier" | isExportedId bndr = False | isStableUnfolding unfolding = False -- Note [InlineRule and postInlineUnconditionally] @@ -1000,6 +1000,7 @@ ones that are trivial): * There is less point, because the main goal is to get rid of local bindings used in multiple case branches. + * The inliner should inline trivial things at call sites anyway. Note [InlineRule and postInlineUnconditionally] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |