summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dda227b)
This inlines any function whose normalized version just contains a single
definition. This might be a bit too enthusiastic, though it probably helps
a lot.
inlinetopleveltop = everywhere ("inlinetoplevel", inlinetoplevel)
needsInline :: CoreExpr -> Bool
inlinetopleveltop = everywhere ("inlinetoplevel", inlinetoplevel)
needsInline :: CoreExpr -> Bool
--- Any function that just evaluates to another function, can be inlined
---needsInline (Var f) = True
-needsInline _ = False
+needsInline expr = case splitNormalized expr of
+ -- Inline any function that only has a single definition, it is probably
+ -- simple enough. This might inline some stuff that it shouldn't though it
+ -- will never inline user-defined functions (inlinetoplevel only tries
+ -- system names) and inlining should never break things.
+ (args, [bind], res) -> True
+ _ -> False
--------------------------------
-- Scrutinee simplification
--------------------------------
-- Scrutinee simplification