projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Comments and layout only, relating to Roman's inlining-and-conlike patch
[ghc-hetmet.git]
/
compiler
/
coreSyn
/
CoreUnfold.lhs
diff --git
a/compiler/coreSyn/CoreUnfold.lhs
b/compiler/coreSyn/CoreUnfold.lhs
index
9e3bb4a
..
2d83a0f
100644
(file)
--- a/
compiler/coreSyn/CoreUnfold.lhs
+++ b/
compiler/coreSyn/CoreUnfold.lhs
@@
-120,8
+120,9
@@
mkCoreUnfolding top_lvl expr arity guidance
= CoreUnfolding { uf_tmpl = occurAnalyseExpr expr,
uf_arity = arity,
uf_is_top = top_lvl,
= CoreUnfolding { uf_tmpl = occurAnalyseExpr expr,
uf_arity = arity,
uf_is_top = top_lvl,
- uf_is_value = exprIsHNF expr,
- uf_is_cheap = exprIsCheap expr,
+ uf_is_value = exprIsHNF expr,
+ uf_is_conlike = exprIsConLike expr,
+ uf_is_cheap = exprIsCheap expr,
uf_expandable = exprIsExpandable expr,
uf_guidance = guidance }
uf_expandable = exprIsExpandable expr,
uf_guidance = guidance }
@@
-936,7
+937,7
@@
Note [Conlike is interesting]
Consider
f d = ...((*) d x y)...
... f (df d')...
Consider
f d = ...((*) d x y)...
... f (df d')...
-where df is con-like. Then we'd really like to inline so that the
+where df is con-like. Then we'd really like to inline 'f' so that the
rule for (*) (df d) can fire. To do this
a) we give a discount for being an argument of a class-op (eg (*) d)
b) we say that a con-like argument (eg (df d)) is interesting
rule for (*) (df d) can fire. To do this
a) we give a discount for being an argument of a class-op (eg (*) d)
b) we say that a con-like argument (eg (df d)) is interesting
@@
-958,10
+959,11
@@
interestingArg e = go e 0
-- data constructors here
| idArity v > n = ValueArg -- Catches (eg) primops with arity but no unfolding
| n > 0 = NonTrivArg -- Saturated or unknown call
-- data constructors here
| idArity v > n = ValueArg -- Catches (eg) primops with arity but no unfolding
| n > 0 = NonTrivArg -- Saturated or unknown call
- | evald_unfolding = ValueArg -- n==0; look for a value
+ | conlike_unfolding = ValueArg -- n==0; look for an interesting unfolding
+ -- See Note [Conlike is interesting]
| otherwise = TrivArg -- n==0, no useful unfolding
where
| otherwise = TrivArg -- n==0, no useful unfolding
where
- evald_unfolding = isEvaldUnfolding (idUnfolding v)
+ conlike_unfolding = isConLikeUnfolding (idUnfolding v)
go (Type _) _ = TrivArg
go (App fn (Type _)) n = go fn n
go (Type _) _ = TrivArg
go (App fn (Type _)) n = go fn n