projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use exprIsCheap in floating, just as the simplifier does
[ghc-hetmet.git]
/
compiler
/
simplCore
/
SetLevels.lhs
diff --git
a/compiler/simplCore/SetLevels.lhs
b/compiler/simplCore/SetLevels.lhs
index
f8ab29d
..
6dfb5f1
100644
(file)
--- a/
compiler/simplCore/SetLevels.lhs
+++ b/
compiler/simplCore/SetLevels.lhs
@@
-290,6
+290,10
@@
lvlExpr ctxt_lvl env (_, AnnNote note expr)
= lvlExpr ctxt_lvl env expr `thenLvl` \ expr' ->
returnLvl (Note note expr')
= lvlExpr ctxt_lvl env expr `thenLvl` \ expr' ->
returnLvl (Note note expr')
+lvlExpr ctxt_lvl env (_, AnnCast expr co)
+ = lvlExpr ctxt_lvl env expr `thenLvl` \ expr' ->
+ returnLvl (Cast expr' co)
+
-- We don't split adjacent lambdas. That is, given
-- \x y -> (x+1,y)
-- we don't float to give
-- We don't split adjacent lambdas. That is, given
-- \x y -> (x+1,y)
-- we don't float to give
@@
-767,8
+771,7
@@
absVarsOf dest_lvl (_, lvl_env, _, id_env) v
Just (abs_vars, _) -> abs_vars
Nothing -> [v]
Just (abs_vars, _) -> abs_vars
Nothing -> [v]
- add_tyvars v | isId v = v : varSetElems (idFreeTyVars v)
- | otherwise = [v]
+ add_tyvars v = v : varSetElems (varTypeTyVars v)
-- We are going to lambda-abstract, so nuke any IdInfo,
-- and add the tyvars of the Id (if necessary)
-- We are going to lambda-abstract, so nuke any IdInfo,
-- and add the tyvars of the Id (if necessary)
@@
-839,9
+842,11
@@
cloneRecVars NotTopLevel env@(_,_,subst,_) vs ctxt_lvl dest_lvl
returnUs (env', vs2)
-- VERY IMPORTANT: we must zap the demand info
returnUs (env', vs2)
-- VERY IMPORTANT: we must zap the demand info
- -- if the thing is going to float out past a lambda
+ -- if the thing is going to float out past a lambda,
+ -- or if it's going to top level (where things can't be strict)
zap_demand dest_lvl ctxt_lvl id
zap_demand dest_lvl ctxt_lvl id
- | ctxt_lvl == dest_lvl = id -- Stays put
- | otherwise = zapDemandIdInfo id -- Floats out
+ | ctxt_lvl == dest_lvl,
+ not (isTopLvl dest_lvl) = id -- Stays, and not going to top level
+ | otherwise = zapDemandIdInfo id -- Floats out
\end{code}
\end{code}