| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For a long-time mkDupableCont has had a bug that allows it to duplicate
an arbitrary continuation, which it should not do, of course.
The bug was that in the Select case of mkDupableCont we were calling
prepareCaseCont, which did not duplicate the continuation if there is
but a single alternative. This is quite right in the case of the call
in rebuildCase, but quite wrong in mkDupableCont.
The bug manifest as follows. In the expression
f (case ... of { ..several alts.. })
(when f is strict), we should transform to
f (...transformed arg...)
The application of f should not be pushed down (see notes with the
ArgOf case of mkDupableCont. But that was not happening in an example
like this (see how the call to f is pushed inwards).
f (a `div` abs (b::Int))
--->
case b_afT of wild_aHa { GHC.Base.I# x_aHc ->
let {
$j_sIe :: GHC.Prim.Int# -> GHC.Base.Int
[]
$j_sIe =
\ (ds1_aHr [Nothing OneShot] :: GHC.Prim.Int#) ->
Foo7.f
(case ds1_aHr of ds2_aHq {
__DEFAULT ->
case a_afS of wild1_aHM { GHC.Base.I# x_aHO ->
GHC.Base.I# (GHC.Base.divInt# x_aHO ds2_aHq)
};
0 -> GHC.Err.divZeroError @ GHC.Base.Int
})
} in
case GHC.Prim.>=# x_aHc 0 of wild1_aHe [Dead Nothing] {
GHC.Base.False ->
let {
ds1_aHr :: GHC.Prim.Int#
[]
ds1_aHr = GHC.Prim.negateInt# x_aHc
} in $j_sIe ds1_aHr;
GHC.Base.True -> $j_sIe x_aHc
}
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consider
data T a where
T1 :: T Int
T2 :: T Bool
T3 :: T Char
f :: T Bool -> Int
f x = case x of
DEFAULT -> ...
T2 -> 3
Here the DEFAULT case covers multiple constructors (T1,T3), but none
of them can match a scrutinee of type (T Bool). So we can prune away
the default case altogether.
In implementing this, I re-factored this bit of the simplifier, elminiating
prepareAlts from SimplUtils, and putting all the work into simplAlts in
Simplify
The proximate cause was a program written by Manuel using PArrays
|
|
Most of the other users of the fptools build system have migrated to
Cabal, and with the move to darcs we can now flatten the source tree
without losing history, so here goes.
The main change is that the ghc/ subdir is gone, and most of what it
contained is now at the top level. The build system now makes no
pretense at being multi-project, it is just the GHC build system.
No doubt this will break many things, and there will be a period of
instability while we fix the dependencies. A straightforward build
should work, but I haven't yet fixed binary/source distributions.
Changes to the Building Guide will follow, too.
|