diff options
| author | Philipp Krüger <matheus.dev@gmail.com> | 2019-11-21 12:33:07 +0100 |
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-11-28 02:54:05 -0500 |
| commit | 5f84b52a9c439ae2739bf1899a2adbae9c6d4f67 (patch) | |
| tree | 5976935b88e084e5d1e6f92164c3b160f8c96b12 /compiler/coreSyn | |
| parent | e122ba33e8426a7b7f18216c451f6288e90c966e (diff) | |
| download | haskell-5f84b52a9c439ae2739bf1899a2adbae9c6d4f67.tar.gz | |
Reduce boolean blindness in OccInfo(OneOcc) #17482
* Transformed the type aliases `InterestingCxt`, `InsideLam` and `OneBranch`
into data types.
* Added Semigroup and Monoid instances for use in orOccInfo in OccurAnal.hs
* Simplified some usage sites by using pattern matching instead of boolean algebra.
Metric Increase:
T12150
This increase was on a Mac-build of exactly 1%. This commit does *not* re-intruduce
the asymptotic memory usage described in T12150.
Diffstat (limited to 'compiler/coreSyn')
| -rw-r--r-- | compiler/coreSyn/CoreOpt.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index a2eeb9beb8..4a0322f00c 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -418,11 +418,12 @@ simple_bind_pair env@(SOE { soe_inl = inl_env, soe_subst = subst }) -- Unconditionally safe to inline safe_to_inline :: OccInfo -> Bool - safe_to_inline (IAmALoopBreaker {}) = False - safe_to_inline IAmDead = True - safe_to_inline occ@(OneOcc {}) = not (occ_in_lam occ) - && occ_one_br occ - safe_to_inline (ManyOccs {}) = False + safe_to_inline IAmALoopBreaker{} = False + safe_to_inline IAmDead = True + safe_to_inline OneOcc{ occ_in_lam = NotInsideLam + , occ_one_br = InOneBranch } = True + safe_to_inline OneOcc{} = False + safe_to_inline ManyOccs{} = False ------------------- simple_out_bind :: TopLevelFlag |
