summaryrefslogtreecommitdiff
path: root/compiler/GHC/HsToCore
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-12-16 12:48:52 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-19 02:14:42 -0500
commit173112cad82630b02eb91acb1f5fb91a96fa02b9 (patch)
treec9a154eb05c3189bc53ecf6569b869db6fdce342 /compiler/GHC/HsToCore
parentc2430398481f5aab12fd94e6549c7b9bbd1e43fe (diff)
downloadhaskell-173112cad82630b02eb91acb1f5fb91a96fa02b9.tar.gz
Make noinline more reliable
This patch makes the desugarer rewrite noinline (f d) --> noinline f d This makes 'noinline' much more reliable: see #18995 It's explained in the improved Note [noinlineId magic] in GHC.Types.Id.Make
Diffstat (limited to 'compiler/GHC/HsToCore')
-rw-r--r--compiler/GHC/HsToCore/Utils.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/GHC/HsToCore/Utils.hs b/compiler/GHC/HsToCore/Utils.hs
index 01085b3270..ac66b00813 100644
--- a/compiler/GHC/HsToCore/Utils.hs
+++ b/compiler/GHC/HsToCore/Utils.hs
@@ -494,6 +494,13 @@ mkCoreAppDs _ (Var f `App` Type _r `App` Type ty1 `App` Type ty2 `App` arg1) arg
-> v1 -- Note [Desugaring seq], points (2) and (3)
_ -> mkWildValBinder Many ty1
+mkCoreAppDs _ (Var f `App` Type _r) arg
+ | f `hasKey` noinlineIdKey -- See Note [noinlineId magic] in GHC.Types.Id.Make
+ , (fun, args) <- collectArgs arg
+ , not (null args)
+ = (Var f `App` Type (exprType fun) `App` fun)
+ `mkCoreApps` args
+
mkCoreAppDs s fun arg = mkCoreApp s fun arg -- The rest is done in GHC.Core.Make
-- NB: No argument can be levity polymorphic