diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2016-05-16 21:05:24 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2016-06-08 21:27:17 -0700 |
commit | 11ff1df8a7c25485c9c7508d65bcb380e592010d (patch) | |
tree | d358116efebf72d50edc040480504cc2e49a82e3 /compiler/main/TidyPgm.hs | |
parent | acb9e85cad6b26a7f69276bac709b6406ff7ab6e (diff) | |
download | haskell-11ff1df8a7c25485c9c7508d65bcb380e592010d.tar.gz |
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
Diffstat (limited to 'compiler/main/TidyPgm.hs')
-rw-r--r-- | compiler/main/TidyPgm.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs index daf3d00584..d7b45cedb3 100644 --- a/compiler/main/TidyPgm.hs +++ b/compiler/main/TidyPgm.hs @@ -550,7 +550,7 @@ constructed in an optimised form. E.g. record selector for Then the unfolding looks like x = \t. case t of MkT x1 -> let x = I# x1 in x This generates bad code unless it's first simplified a bit. That is -why CoreUnfold.mkImplicitUnfolding uses simleExprOpt to do a bit of +why CoreUnfold.mkImplicitUnfolding uses simpleOptExpr to do a bit of optimisation first. (Only matters when the selector is used curried; eg map x ys.) See Trac #2070. @@ -575,7 +575,7 @@ Oh: two other reasons for injecting them late: the sense of chooseExternalIds); else the Ids mentioned in *their* RHSs will be treated as external and you get an interface file saying a18 = <blah> - but nothing refererring to a18 (because the implicit Id is the + but nothing referring to a18 (because the implicit Id is the one that does, and implicit Ids don't appear in interface files). - More seriously, the tidied type-envt will include the implicit |