Conservatively estimate levity in worker/wrapper
authorBen Gamari <bgamari.foss@gmail.com>
Thu, 31 May 2018 11:49:55 +0000 (07:49 -0400)
committerBen Gamari <ben@smart-cactus.org>
Sat, 2 Jun 2018 15:47:36 +0000 (11:47 -0400)
commitf0c1eb8b5640b0ec86b9fabb465ea5b841808d56
tree8cc92878ef62325536beaaba1594e9360a30c367
parentc983a1dbc01bb6ee68f67af5c7d662bc70845f6f
Conservatively estimate levity in worker/wrapper

The worker/wrapper transform needs to determine the levity of the result to
determine whether it needs to introduce a lambda to preserve laziness of the
result. For this is previously used isUnliftedType. However, this may fail in
the presence of levity polymorphism.

We now instead use isLiftedType_maybe, assuming that a lambda is needed if the
levity of the result cannot be determined.

Fixes #15186.

Test Plan: make test=T15186

Reviewers: simonpj, goldfire, tdammers

Reviewed By: simonpj

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15186

Differential Revision: https://phabricator.haskell.org/D4755
compiler/stranal/WwLib.hs
testsuite/tests/simplCore/should_compile/all.T