[project @ 2001-11-16 15:42:26 by simonpj]
authorsimonpj <unknown>
Fri, 16 Nov 2001 15:42:26 +0000 (15:42 +0000)
committersimonpj <unknown>
Fri, 16 Nov 2001 15:42:26 +0000 (15:42 +0000)
commit772ffb22872ea6b3c8c6973c32389080b17229f1
tree906c64990db57e3cdfa33cbad6fa4ba2dc86f9be
parent2ce9f3af8a25f0ff3488a14ae2883111447f1c9c
[project @ 2001-11-16 15:42:26 by simonpj]
---------------------------------------
Add continuation splitting to Simplify
---------------------------------------

When the simplifier finds a 'case', it calls mkDupableAlt
to make the "continuation" (that is, the context of the
case expression) duplicatable, so that it can push it into
the case branches.  This is crucial for the case-of-case
transformation.

But it turns out that it's a bad idea to do that when
the context is "I'm the argument of a strict function".  Consider

f (case x of { True -> False; False -> True }) arg2

where f is a strict function.  Then we *could* (and were)
transforming to

let $j a = f a arg2
in
case x of { True -> $j False; False -> $j True }

But this is in general a terribly bad thing to do.
See the example in comments with Simplify.mkDupableCont.
ghc/compiler/simplCore/SimplUtils.lhs
ghc/compiler/simplCore/Simplify.lhs