diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2019-02-18 13:46:35 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-02-20 10:17:34 -0500 |
commit | 5eeefe4c1e007ea2098f241634b48a4dada785a5 (patch) | |
tree | e1755a98ac5bc6b2ca90f8f4d9f99bbadb320a03 /compiler | |
parent | e86606f2dd25a6ea55ed29a0434b82cf862c2544 (diff) | |
download | haskell-5eeefe4c1e007ea2098f241634b48a4dada785a5.tar.gz |
Improve the very simple optimiser slightly
There was a missing case in the very simple optimiser,
CoreOpt.simpleOptExpr, which led to Trac #13208 comment:2.
In particular, in simple_app, if we find a Let, we should
just float it outwards. Otherwise we leave behind some
easy-to-reduce beta-redexes.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/coreSyn/CoreOpt.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index 548b5de269..a2ac7b5be9 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -308,6 +308,16 @@ simple_app env (Tick t e) as | t `tickishScopesLike` SoftScope = mkTick t $ simple_app env e as +-- (let x = e in b) a1 .. an => let x = e in (b a1 .. an) +-- The let might appear there as a result of inlining +-- e.g. let f = let x = e in b +-- in f a1 a2 +-- (Trac #13208) +simple_app env (Let bind body) as + = case simple_opt_bind env bind of + (env', Nothing) -> simple_app env' body as + (env', Just bind) -> Let bind (simple_app env' body as) + simple_app env e as = finish_app env (simple_opt_expr env e) as |