Rational for the special case in mkWWcpr_help

Simon Peyton Jones simonpj at microsoft.com
Wed Sep 5 14:33:31 UTC 2018


I think it would yield the same code in the end.  Maybe it was just seeking to avoid unnecessary clutter in a particularly common case (eg returning I# x).

Seems to have been introduce in
commit 731f53de7930c38b5023a871146bd0ec066edf3a
Author: simonpj <unknown>
   Fri Sep 17 09:15:44 1999 +0000

Simon

From: ghc-devs <ghc-devs-bounces at haskell.org> On Behalf Of Spiwack, Arnaud
Sent: 05 September 2018 15:02
To: ghc-devs at haskell.org
Subject: Rational for the special case in mkWWcpr_help

Dear all,

The function mkWWcpr_help, which creates a wrapper and a worker after strictness analysis, has a special case when there is a single result of unlifted type:

Wrapper:     case (..call worker..) of x -> C x
Worker:      case (   ..body..    ) of C x -> x

But I don't understand how it is different from using (# #) as would result from the general case:

Wrapper:     case (..call worker..) of (# x #) -> C x
Worker:      case (   ..body..    ) of C x -> (# x #)

That is, my understanding of the latter is that it would yield the exact same code. I'm obviously missing something, I'd love to know what.

Best,
Arnaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180905/fc3bfaf7/attachment.html>


More information about the ghc-devs mailing list