summaryrefslogtreecommitdiff
path: root/compiler/simplCore
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2016-03-31 18:29:50 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2016-03-31 18:29:50 +0200
commit6ea42c72dc924eddba3f2ee22fa4e514084fa5cc (patch)
tree5b434321d5ea5c36a9c03334088395dc127fcc85 /compiler/simplCore
parentda260a5bddf990959f639a3551b335ee26c766f6 (diff)
downloadhaskell-6ea42c72dc924eddba3f2ee22fa4e514084fa5cc.tar.gz
Revert "Demand Analyzer: Do not set OneShot information"
This reverts commit 28fe0eea4d161b707f67aae26fddaa2e60d8a901 due to various regressions. I’m not sure why my local ./validate --slow run did not catch this, though.
Diffstat (limited to 'compiler/simplCore')
-rw-r--r--compiler/simplCore/OccurAnal.hs33
1 files changed, 9 insertions, 24 deletions
diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs
index 91332c4416..6628ee70ee 100644
--- a/compiler/simplCore/OccurAnal.hs
+++ b/compiler/simplCore/OccurAnal.hs
@@ -1395,29 +1395,19 @@ markManyIf False uds = uds
{-
Note [Use one-shot information]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The occurrrence analyser propagates one-shot-lambda information in two
-situations:
-
- * Applications: eg build (\c n -> blah)
-
+The occurrrence analyser propagates one-shot-lambda information in two situation
+ * Applications: eg build (\cn -> blah)
Propagate one-shot info from the strictness signature of 'build' to
- the \c n.
-
- This strictness signature can come from a module interface, in the case of
- an imported function, or from a previous run of the demand analyser.
+ the \cn
* Let-bindings: eg let f = \c. let ... in \n -> blah
in (build f, build f)
-
Propagate one-shot info from the demanand-info on 'f' to the
lambdas in its RHS (which may not be syntactically at the top)
- This information must have come from a previous run of the demanand
- analyser.
-
-Previously, the demand analyser would *also* set the one-shot information, but
-that code was buggy (see #11770), so doing it only in on place, namely here, is
-saner.
+Some of this is done by the demand analyser, but this way it happens
+much earlier, taking advantage of the strictness signature of
+imported functions.
Note [Binders in case alternatives]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1544,7 +1534,7 @@ oneShotGroup :: OccEnv -> [CoreBndr]
-> ( OccEnv
, [CoreBndr] )
-- The result binders have one-shot-ness set that they might not have had originally.
- -- This happens in (build (\c n -> e)). Here the occurrence analyser
+ -- This happens in (build (\cn -> e)). Here the occurrence analyser
-- linearity context knows that c,n are one-shot, and it records that fact in
-- the binder. This is useful to guide subsequent float-in/float-out tranformations
@@ -1565,13 +1555,8 @@ oneShotGroup env@(OccEnv { occ_one_shots = ctxt }) bndrs
= case ctxt of
[] -> go [] bndrs (bndr : rev_bndrs)
(one_shot : ctxt) -> go ctxt bndrs (bndr': rev_bndrs)
- where
- bndr' = updOneShotInfo bndr one_shot
- -- Use updOneShotInfo, not setOneShotInfo, as pre-existing
- -- one-shot info might be better than what we can infer, e.g.
- -- due to explicit use of the magic 'oneShot' function.
- -- See Note [The oneShot function]
-
+ where
+ bndr' = updOneShotInfo bndr one_shot
| otherwise
= go ctxt bndrs (bndr:rev_bndrs)