diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2014-05-08 11:21:16 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2014-08-28 11:14:05 +0100 |
commit | 6e0f6ededff6018a88dd390590a09f79842ccfa5 (patch) | |
tree | c2d4f46cfdcf8b236d9ac751c48f0b0ccced7503 /compiler/simplCore | |
parent | e9cd1d5e9d6f0e019d6433a3c7dd9585b3f7ae6b (diff) | |
download | haskell-6e0f6ededff6018a88dd390590a09f79842ccfa5.tar.gz |
Refactor unfoldings
There are two main refactorings here
1. Move the uf_arity field
out of CoreUnfolding
into UnfWhen
It's a lot tidier there. If I've got this right, no behaviour
should change.
2. Define specUnfolding and use it in DsBinds and Specialise
a) commons-up some shared code
b) makes sure that Specialise correctly specialises DFun
unfoldings (which it didn't before)
The two got put together because both ended up interacting in the
specialiser.
They cause zero difference to nofib.
Diffstat (limited to 'compiler/simplCore')
-rw-r--r-- | compiler/simplCore/Simplify.lhs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs index cc214f7513..d722f5164c 100644 --- a/compiler/simplCore/Simplify.lhs +++ b/compiler/simplCore/Simplify.lhs @@ -744,19 +744,19 @@ simplUnfolding env top_lvl id new_rhs unf ; args' <- mapM (simplExpr env') args ; return (mkDFunUnfolding bndrs' con args') } - CoreUnfolding { uf_tmpl = expr, uf_arity = arity - , uf_src = src, uf_guidance = guide } + CoreUnfolding { uf_tmpl = expr, uf_src = src, uf_guidance = guide } | isStableSource src -> do { expr' <- simplExpr rule_env expr ; case guide of - UnfWhen sat_ok _ -- Happens for INLINE things - -> let guide' = UnfWhen sat_ok (inlineBoringOk expr') + UnfWhen { ug_arity = arity, ug_unsat_ok = sat_ok } -- Happens for INLINE things + -> let guide' = UnfWhen { ug_arity = arity, ug_unsat_ok = sat_ok + , ug_boring_ok = inlineBoringOk expr' } -- Refresh the boring-ok flag, in case expr' -- has got small. This happens, notably in the inlinings -- for dfuns for single-method classes; see -- Note [Single-method classes] in TcInstDcls. -- A test case is Trac #4138 - in return (mkCoreUnfolding src is_top_lvl expr' arity guide') + in return (mkCoreUnfolding src is_top_lvl expr' guide') -- See Note [Top-level flag on inline rules] in CoreUnfold _other -- Happens for INLINABLE things |