summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2021-05-10 15:47:12 +0200
committerAndreas Klebinger <klebinger.andreas@gmx.at>2021-05-10 21:12:53 +0200
commit16a50e2d5764b3ea71bd511fa0769255a73dad45 (patch)
tree432be54e3b6618e7712a0bcdf1a1f5dffc3b973b
parent736d47ffb7370ba4348b142c913b88e4c82347d0 (diff)
downloadhaskell-wip/andreask/simplLamBndr.tar.gz
Document unfolding treatment of simplLamBndr.wip/andreask/simplLamBndr
Fixes #19817
-rw-r--r--compiler/GHC/Core/Opt/Simplify.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/GHC/Core/Opt/Simplify.hs b/compiler/GHC/Core/Opt/Simplify.hs
index dfbfd30e64..3d1a8ce3aa 100644
--- a/compiler/GHC/Core/Opt/Simplify.hs
+++ b/compiler/GHC/Core/Opt/Simplify.hs
@@ -1554,9 +1554,11 @@ simplLamBndr :: SimplEnv -> InBndr -> SimplM (SimplEnv, OutBndr)
-- Used for lambda binders. These sometimes have unfoldings added by
-- the worker/wrapper pass that must be preserved, because they can't
-- be reconstructed from context. For example:
--- f x = case x of (a,b) -> fw a b x
--- fw a b x{=(a,b)} = ...
--- The "{=(a,b)}" is an unfolding we can't reconstruct otherwise.
+-- f x = case x of StrictPair a b -> fw a b x
+-- fw a{=OtherCon[]} b{=OtherCon[]} x{=(StrictPair a b)} = ...
+-- The "{=(StrictPair a b)}" is an unfolding we can't reconstruct otherwise.
+-- Since simplBinder already retains OtherCon bindings we only have to special
+-- case core unfoldings like the one for `x`.
simplLamBndr env bndr
| isId bndr && hasCoreUnfolding old_unf -- Special case
= do { (env1, bndr1) <- simplBinder env bndr