summaryrefslogtreecommitdiff
path: root/compiler/simplCore/CallArity.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/simplCore/CallArity.hs')
-rw-r--r--compiler/simplCore/CallArity.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/simplCore/CallArity.hs b/compiler/simplCore/CallArity.hs
index 0cf0c2f44f..ba1aa243ac 100644
--- a/compiler/simplCore/CallArity.hs
+++ b/compiler/simplCore/CallArity.hs
@@ -7,6 +7,8 @@ module CallArity
, callArityRHS -- for testing
) where
+import GhcPrelude
+
import VarSet
import VarEnv
import DynFlags ( DynFlags )
@@ -340,7 +342,7 @@ For a mutually recursive let, we begin by
3. We combine the analysis result from the body and the memoized results for
the arguments (if already present).
4. For each variable, we find out the incoming arity and whether it is called
- once, based on the the current analysis result. If this differs from the
+ once, based on the current analysis result. If this differs from the
memoized results, we re-analyse the rhs and update the memoized table.
5. If nothing had to be reanalyzed, we are done.
Otherwise, repeat from step 3.
@@ -350,7 +352,7 @@ Note [Thunks in recursive groups]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We never eta-expand a thunk in a recursive group, on the grounds that if it is
-part of a recursive group, then it will be called multipe times.
+part of a recursive group, then it will be called multiple times.
This is not necessarily true, e.g. it would be safe to eta-expand t2 (but not
t1) in the following code:
@@ -404,7 +406,7 @@ published papers on Call Arity describe it.
In practice, there are thunks that do a just little work, such as
pattern-matching on a variable, and the benefits of eta-expansion likely
-oughtweigh the cost of doing that repeatedly. Therefore, this implementation of
+outweigh the cost of doing that repeatedly. Therefore, this implementation of
Call Arity considers everything that is not cheap (`exprIsCheap`) as a thunk.
Note [Call Arity and Join Points]
@@ -733,7 +735,7 @@ domRes (_, ae) = varEnvDom ae
lookupCallArityRes :: CallArityRes -> Var -> (Arity, Bool)
lookupCallArityRes (g, ae) v
= case lookupVarEnv ae v of
- Just a -> (a, not (v `elemUnVarSet` (neighbors g v)))
+ Just a -> (a, not (g `hasLoopAt` v))
Nothing -> (0, False)
calledWith :: CallArityRes -> Var -> UnVarSet
@@ -758,4 +760,4 @@ lubArityEnv :: VarEnv Arity -> VarEnv Arity -> VarEnv Arity
lubArityEnv = plusVarEnv_C min
lubRess :: [CallArityRes] -> CallArityRes
-lubRess = foldl lubRes emptyArityRes
+lubRess = foldl' lubRes emptyArityRes