Fix #12076 by inlining trivial expressions in CorePrep.
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Tue, 17 May 2016 04:05:24 +0000 (21:05 -0700)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Thu, 9 Jun 2016 04:27:17 +0000 (21:27 -0700)
commit11ff1df8a7c25485c9c7508d65bcb380e592010d
treed358116efebf72d50edc040480504cc2e49a82e3
parentacb9e85cad6b26a7f69276bac709b6406ff7ab6e
Fix #12076 by inlining trivial expressions in CorePrep.

Summary:
This mostly follows the plan detailed by the discussion
Simon and I had, with one difference: instead of grabbing
the free variables of the trivial expressions to get the
embedded Ids, we just use getIdFromTrivialExpr_maybe to extract
out the Id.  If there is no Id, the expression cannot
refer to a function (as there are no literal functions)
and thus we do not need to saturate.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin, bgamari

Subscribers: thomie

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

GHC Trac Issues: #12076
compiler/basicTypes/BasicTypes.hs
compiler/coreSyn/CoreArity.hs
compiler/coreSyn/CorePrep.hs
compiler/coreSyn/CoreUtils.hs
compiler/main/TidyPgm.hs
testsuite/tests/simplCore/should_compile/T12076lit.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/T12076sat.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/all.T