Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
45b8d3bc
Commit
45b8d3bc
authored
Aug 19, 2010
by
simonpj@microsoft.com
Browse files
Be a bit less aggressive in mark-many inside a cast
parent
ebff59fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/simplCore/OccurAnal.lhs
View file @
45b8d3bc
...
...
@@ -826,7 +826,7 @@ occAnal env (Note note body)
occAnal env (Cast expr co)
= case occAnal env expr of { (usage, expr') ->
(mark
RhsUds env True
usage, Cast expr' co)
(mark
ManyIf (isRhsEnv env)
usage, Cast expr' co)
-- If we see let x = y `cast` co
-- then mark y as 'Many' so that we don't
-- immediately inline y again.
...
...
@@ -940,7 +940,14 @@ occAnalApp :: OccEnv
occAnalApp env (Var fun, args)
= case args_stuff of { (args_uds, args') ->
let
final_args_uds = markRhsUds env is_exp args_uds
final_args_uds = markManyIf (isRhsEnv env && is_exp) args_uds
-- We mark the free vars of the argument of a constructor or PAP
-- as "many", if it is the RHS of a let(rec).
-- This means that nothing gets inlined into a constructor argument
-- position, which is what we want. Typically those constructor
-- arguments are just variables, or trivial expressions.
--
-- This is the *whole point* of the isRhsEnv predicate
in
(fun_uds +++ final_args_uds, mkApps (Var fun) args') }
where
...
...
@@ -981,21 +988,11 @@ occAnalApp env (fun, args)
(final_uds, mkApps fun' args') }}
markRhsUds :: OccEnv -- Check if this is a RhsEnv
-> Bool -- and this is true
-> UsageDetails -- The do markMany on this
markManyIf :: Bool -- If this is true
-> UsageDetails -- Then do markMany on this
-> UsageDetails
-- We mark the free vars of the argument of a constructor or PAP
-- as "many", if it is the RHS of a let(rec).
-- This means that nothing gets inlined into a constructor argument
-- position, which is what we want. Typically those constructor
-- arguments are just variables, or trivial expressions.
--
-- This is the *whole point* of the isRhsEnv predicate
markRhsUds env is_pap arg_uds
| isRhsEnv env && is_pap = mapVarEnv markMany arg_uds
| otherwise = arg_uds
markManyIf True uds = mapVarEnv markMany uds
markManyIf False uds = uds
appSpecial :: OccEnv
-> Int -> CtxtTy -- Argument number, and context to use for it
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment