diff options
-rw-r--r-- | compiler/GHC/CoreToStg/Prep.hs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs index 3eb714405c..5395a737d6 100644 --- a/compiler/GHC/CoreToStg/Prep.hs +++ b/compiler/GHC/CoreToStg/Prep.hs @@ -1407,8 +1407,21 @@ mkFloat dmd is_unlifted bndr rhs -- Don't make a case for a HNF binding, even if it's strict -- Otherwise we get case (\x -> e) of ...! - | is_unlifted = ASSERT2( ok_for_spec, ppr rhs ) - FloatCase rhs bndr DEFAULT [] True + | is_unlifted = FloatCase rhs bndr DEFAULT [] True + -- we used to ASSERT2(ok_for_spec, ppr rhs) here, but it is now disabled + -- because exprOkForSpeculation isn't stable under ANF-ing. See for + -- example #19489 where the following unlifted expression: + -- + -- GHC.Prim.(#|_#) @LiftedRep @LiftedRep @[a_ax0] @[a_ax0] + -- (GHC.Types.: @a_ax0 a2_agq a3_agl) + -- + -- is ok-for-spec but is ANF-ised into: + -- + -- let sat = GHC.Types.: @a_ax0 a2_agq a3_agl + -- in GHC.Prim.(#|_#) @LiftedRep @LiftedRep @[a_ax0] @[a_ax0] sat + -- + -- which isn't ok-for-spec because of the let-expression. + | is_hnf = FloatLet (NonRec bndr rhs) | otherwise = FloatLet (NonRec (setIdDemandInfo bndr dmd) rhs) -- See Note [Pin demand info on floats] |