diff options
| author | Roman Leshchinskiy <rl@cse.unsw.edu.au> | 2010-11-27 12:50:25 +0000 |
|---|---|---|
| committer | Roman Leshchinskiy <rl@cse.unsw.edu.au> | 2010-11-27 12:50:25 +0000 |
| commit | 71d0e9a03797a194209cb61b7f75c2e1c8ddf237 (patch) | |
| tree | e120600c71fa4228ae4a4439f34eed0aa3112167 /compiler | |
| parent | d91240674cd45cb4677adca5829a1851ba3cd044 (diff) | |
| download | haskell-71d0e9a03797a194209cb61b7f75c2e1c8ddf237.tar.gz | |
Inherit the ForceSpecConstr flag in non-recursive nested bindings
This makes sure that join points are fully specialised in loops which are
marked as ForceSpecConstr.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/specialise/SpecConstr.lhs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/specialise/SpecConstr.lhs b/compiler/specialise/SpecConstr.lhs index 0b61a57c0d..3c84d3a4ad 100644 --- a/compiler/specialise/SpecConstr.lhs +++ b/compiler/specialise/SpecConstr.lhs @@ -452,6 +452,10 @@ sc_force to True when calling specLoop. This flag does three things: * Specialise even for arguments that are not scrutinised in the loop (see argToPat; Trac #4488) +This flag is inherited for nested non-recursive bindings (which are likely to +be join points and hence should be fully specialised) but reset for nested +recursive bindings. + What alternatives did I consider? Annotating the loop itself doesn't work because (a) it is local and (b) it will be w/w'ed and I having w/w propagating annotation somehow doesn't seem like a good idea. The @@ -1041,11 +1045,9 @@ scExpr' env (Let (NonRec bndr rhs) body) ; (body_usg, body') <- scExpr body_env3 body - -- NB: We don't use the ForceSpecConstr mechanism (see - -- Note [Forcing specialisation]) for non-recursive bindings - -- at the moment. I'm not sure if this is the right thing to do. - ; let env' = scForce env False - ; (spec_usg, specs) <- specialise env' + -- NB: For non-recursive bindings we inherit sc_force flag from + -- the parent function (see Note [Forcing specialisation]) + ; (spec_usg, specs) <- specialise env (scu_calls body_usg) rhs_info (SI [] 0 (Just rhs_usg)) |
