[Git][ghc/ghc][wip/andreask/94-dlist] Fix #22425 - Broken eta-expansion over expensive work.
Andreas Klebinger (@AndreasK)
gitlab at gitlab.haskell.org
Fri Nov 18 11:08:43 UTC 2022
Andreas Klebinger pushed to branch wip/andreask/94-dlist at Glasgow Haskell Compiler / GHC
Commits:
307e8e9c by Andreas Klebinger at 2022-11-18T12:06:35+01:00
Fix #22425 - Broken eta-expansion over expensive work.
Through a mistake in the latest backport we started eta-expanding over
expensive work by mistake. E.g. over <expensive> in code like:
case x of
A -> id
B -> <expensive>
We fix this by only eta-expanding over <expensive> if all other branches
are headed by an oneShot lambda.
In the long story of broken eta-expansion on 9.2/9.4 this is hopefully
the last chapter.
-------------------------
Metric Increase:
CoOpt_Read
T1969
parsing001
-------------------------
- - - - -
1 changed file:
- compiler/GHC/Core/Opt/Arity.hs
Changes:
=====================================
compiler/GHC/Core/Opt/Arity.hs
=====================================
@@ -853,7 +853,7 @@ andArityType env (AT [] div1) at2 = andWithTail env div1 at2
andArityType env at1 (AT [] div2) = andWithTail env div2 at1
andWithTail :: ArityEnv -> Divergence -> ArityType -> ArityType
-andWithTail env div1 at2@(AT lams2 _)
+andWithTail env div1 at2
| isDeadEndDiv div1 -- case x of { T -> error; F -> \y.e }
= at2 -- Note [ABot branches: max arity wins]
@@ -861,7 +861,7 @@ andWithTail env div1 at2@(AT lams2 _)
= AT [] topDiv
| otherwise -- case x of { T -> plusInt <expensive>; F -> \y.e }
- = AT lams2 topDiv -- We know div1 = topDiv
+ = takeWhileOneShot at2 -- We know div1 = topDiv
-- See Note [Combining case branches: andWithTail]
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/307e8e9c6bd06ccc91db5050050a15eb877b0fd6
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/307e8e9c6bd06ccc91db5050050a15eb877b0fd6
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221118/54d38980/attachment-0001.html>
More information about the ghc-commits
mailing list