summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CoreTidy.hs
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2016-03-31 10:18:15 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2016-04-14 17:18:54 +0200
commit2f56242b2fb9249420fce132bbded49c289b23a3 (patch)
tree805887ba4b2e4d77369cd93e281c1e9f9ab0072b /compiler/coreSyn/CoreTidy.hs
parent3a34b5c32303734c794f27728025e8a9fb410fb3 (diff)
downloadhaskell-wip/T11731.tar.gz
Add a final demand analyzer run right before TidyCorewip/T11731
in order to have precise used-once information in the exported strictness signatures, as well as precise used-once information on thunks. This avoids the bad effects of #11731. The subsequent worker-wrapper pass is responsible for removing the demand environment part of the strictness signature. It does not run after the final demand analyzer pass, so remove this also in CoreTidy. The subsequent worker-wrapper pass is also responsible for removing used-once-information from the demands and strictness signatures, as these might not be preserved by the simplifier. This is _not_ done by CoreTidy, because we _do_ want this information, as produced by the last round of the demand analyzer, to be available to the code generator.
Diffstat (limited to 'compiler/coreSyn/CoreTidy.hs')
-rw-r--r--compiler/coreSyn/CoreTidy.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/coreSyn/CoreTidy.hs b/compiler/coreSyn/CoreTidy.hs
index aed4e214ad..782e11a42a 100644
--- a/compiler/coreSyn/CoreTidy.hs
+++ b/compiler/coreSyn/CoreTidy.hs
@@ -18,6 +18,7 @@ import CoreSyn
import CoreArity
import Id
import IdInfo
+import Demand ( zapUsageEnvSig )
import Type( tidyType, tidyTyCoVarBndr )
import Coercion( tidyCo )
import Var
@@ -187,6 +188,8 @@ tidyLetBndr rec_tidy_env env@(tidy_env, var_env) (id,rhs)
--
-- Similarly for the demand info - on a let binder, this tells
-- CorePrep to turn the let into a case.
+ -- But: Remove the usage demand here
+ -- (See Note [Zapping DmdEnv after Demand Analyzer] in WorkWrap)
--
-- Similarly arity info for eta expansion in CorePrep
--
@@ -196,7 +199,7 @@ tidyLetBndr rec_tidy_env env@(tidy_env, var_env) (id,rhs)
new_info = vanillaIdInfo
`setOccInfo` occInfo old_info
`setArityInfo` exprArity rhs
- `setStrictnessInfo` strictnessInfo old_info
+ `setStrictnessInfo` zapUsageEnvSig (strictnessInfo old_info)
`setDemandInfo` demandInfo old_info
`setInlinePragInfo` inlinePragInfo old_info
`setUnfoldingInfo` new_unf