sizeExpr: fix a bug in the size calculation
authorSimon Marlow <marlowsd@gmail.com>
Wed, 10 Feb 2016 09:19:34 +0000 (09:19 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 11 Feb 2016 14:57:00 +0000 (14:57 +0000)
commit51a33924fc118d9b6c1db556c75c0d010ef95e18
tree14001a4bfd50008dcc2b0ac78c1266411e6f9073
parent023bf8d402652f63de9622e00276cb7b6cb4b261
sizeExpr: fix a bug in the size calculation

There were two bugs here:

* We weren't ignoring Cast in size_up_app
* An application of a non-variable wasn't being charged correct

The result was that some things looked too cheap.  In my case I had
things like

    ((f x) `cast` ...) y

which was given size 21 instead of 30, and this had knock-on effects
elsewhere that caused some large code bloat.

Test Plan:
* nofib runs (todo)
* validate

Reviewers: simonpj, austin, bgamari, erikd

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1900

GHC Trac Issues: #11564
compiler/coreSyn/CoreUnfold.hs