More improvements to worker/wrapper
This patch fixes #21888 (closed), and simplifies finaliseArgBoxities by eliminating the (recently introduced) data type FinalDecision.
A delicate interaction meant that this patch
commit d1c25a48154236861a413e058ea38d1b8320273f
Date: Tue Jul 12 16:33:46 2022 +0100
Refactor wantToUnboxArg a bit
make worker/wrapper go into an infinite loop. This patch
fixes it by narrowing the handling of case (B) of
Note [Boxity for bottoming functions]
, to deal only the
arguemnts that are type variables. Only then do we drop
the trimBoxity
call, which is what caused the bug.
I also
-
Added documentation of case (B), which was previously completely un-mentioned. And a regression test, T21888a, to test it.
-
Made
unboxDeeplyDmd
stop at lazy demands. It's rare anyway for a bottoming function to have a lazy argument (mainly when the data type is recursive and then we don't want to unbox deeply). Plus there isNote [No lazy, Unboxed demands in demand signature]
-
Refactored the Case equation for
dmdAnal
a bit, to do less redundant pattern matching.