diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2022-01-17 19:37:29 +0100 |
---|---|---|
committer | Andreas Klebinger <klebinger.andreas@gmx.at> | 2022-01-25 17:36:06 +0100 |
commit | a552dc316f78f5120dd7544fa3ded51172e7a0ce (patch) | |
tree | be0399509b636ab5e6cd8425ada71ff02b9aa69f /compiler/GHC/Core.hs | |
parent | aa50e118b201ae4ac2714afb998d430c9a4a9caa (diff) | |
download | haskell-wip/andreask/fix_prim_ccs.tar.gz |
CorePrep: Don't try to wrap partial applications of primops in profiling ticks.wip/andreask/fix_prim_ccs
This fixes #20938.
Diffstat (limited to 'compiler/GHC/Core.hs')
-rw-r--r-- | compiler/GHC/Core.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs index cc7320f531..15a0674e38 100644 --- a/compiler/GHC/Core.hs +++ b/compiler/GHC/Core.hs @@ -47,7 +47,7 @@ module GHC.Core ( collectArgs, stripNArgs, collectArgsTicks, flattenBinds, exprToType, exprToCoercion_maybe, - applyTypeToArg, + applyTypeToArg, wrapLamBody, isValArg, isTypeArg, isCoArg, isTyCoArg, valArgCount, valBndrCount, isRuntimeArg, isRuntimeVar, @@ -1942,6 +1942,14 @@ collectArgs expr go (App f a) as = go f (a:as) go e as = (e, as) +-- | fmap on the body of a lambda. +-- wrapLamBody f (\x -> body) == (\x -> f body) +wrapLamBody :: (CoreExpr -> CoreExpr) -> CoreExpr -> CoreExpr +wrapLamBody f expr = go expr + where + go (Lam v body) = Lam v $ go body + go expr = f expr + -- | Attempt to remove the last N arguments of a function call. -- Strip off any ticks or coercions encountered along the way and any -- at the end. |