reflex
reflex copied to clipboard
Reflex.Optimizer plugin causing panic on GHC 8.6.5
I noticed this trying out this plugin on my own project, but it also causes a panic in reflex:
$ cabal new-build -fuse-reflex-optimizer
.....
Building library for reflex-0.6.2.4..
[ 1 of 52] Compiling Control.Monad.ReaderIO ( src/Control/Monad/ReaderIO.hs, /tmp/reflex/dist-newstyle/build/x86_64-linux/ghc-8.6.5/reflex-0.6.2.4/build/Control/Monad/ReaderIO.o )
[ 2 of 52] Compiling Data.AppendMap ( src/Data/AppendMap.hs, /tmp/reflex/dist-newstyle/build/x86_64-linux/ghc-8.6.5/reflex-0.6.2.4/build/Data/AppendMap.o )
[ 3 of 52] Compiling Data.Map.Misc ( src/Data/Map/Misc.hs, /tmp/reflex/dist-newstyle/build/x86_64-linux/ghc-8.6.5/reflex-0.6.2.4/build/Data/Map/Misc.o )
[ 4 of 52] Compiling Reflex.FastWeak ( src/Reflex/FastWeak.hs, /tmp/reflex/dist-newstyle/build/x86_64-linux/ghc-8.6.5/reflex-0.6.2.4/build/Reflex/FastWeak.o )
[ 5 of 52] Compiling Reflex.FunctorMaybe ( src/Reflex/FunctorMaybe.hs, /tmp/reflex/dist-newstyle/build/x86_64-linux/ghc-8.6.5/reflex-0.6.2.4/build/Reflex/FunctorMaybe.o )
[ 6 of 52] Compiling Reflex.Optimizer ( src/Reflex/Optimizer.hs, /tmp/reflex/dist-newstyle/build/x86_64-linux/ghc-8.6.5/reflex-0.6.2.4/build/Reflex/Optimizer.o )
[ 7 of 52] Compiling Data.WeakBag ( src/Data/WeakBag.hs, /tmp/reflex/dist-newstyle/build/x86_64-linux/ghc-8.6.5/reflex-0.6.2.4/build/Data/WeakBag.o )
[Simplifier, Specialise,
Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False}),
Simplifier, Simplifier, Simplifier, Float inwards,
Called arity analysis, Simplifier, Demand analysis,
Worker Wrapper binds, Simplifier, Exitification transformation,
Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = True}),
Common sub-expression, Float inwards, Liberate case, Simplifier,
SpecConstr, Common sub-expression, Simplifier, Demand analysis]
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.5 for x86_64-unknown-linux):
idInfo
b_aCDM
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/basicTypes/Var.hs:541:34 in ghc:Var
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
I initially assumed that this was from the call to idInfo in the plugin itself and this would be a simple fix, but that seems not to be the case.
It looks like this makes the panic go away:
simpl@(CoreDoSimplify _ _) -> [ simpl]
-- simpl@(CoreDoSimplify _ _) -> [CoreDoSpecialising, simpl]
but I don't understand how any of this plugin stuff works yet (no docs, hurray). It looks like this was added in 6f255aab95 as another optimization tweak; would love an explanation.
And I wonder if this actually represents a GHC bug then...