summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2021-05-10 15:47:12 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-11 16:59:17 -0400
commit5daf1aa9dd5c03ec782c72f06b4704e31d92ec32 (patch)
treea72cb6eacae0d9d5fae7996440c4e5fa75b7732b
parent099183437c9a181c93502026216ab8eea81db520 (diff)
downloadhaskell-5daf1aa9dd5c03ec782c72f06b4704e31d92ec32.tar.gz
Document unfolding treatment of 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