diff options
Diffstat (limited to 'compiler/GHC/Stg/Unarise.hs')
-rw-r--r-- | compiler/GHC/Stg/Unarise.hs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/compiler/GHC/Stg/Unarise.hs b/compiler/GHC/Stg/Unarise.hs index 6b41063f9b..b3ae7957d9 100644 --- a/compiler/GHC/Stg/Unarise.hs +++ b/compiler/GHC/Stg/Unarise.hs @@ -231,7 +231,7 @@ STG programs after unarisation have these invariants: This means that it's safe to wrap `StgArg`s of DataCon applications with `GHC.StgToCmm.Env.NonVoid`, for example. - * Similar to unboxed tuples, Note [Rubbish values] of TupleRep may only + * Similar to unboxed tuples, Note [Rubbish literals] of TupleRep may only appear in return position. * Alt binders (binders in patterns) are always non-void. @@ -390,7 +390,7 @@ unariseExpr rho (StgCase scrut bndr alt_ty alts) , Just args' <- unariseMulti_maybe rho dc args ty_args = elimCase rho args' bndr alt_ty alts - -- See (3) of Note [Rubbish values] in GHC.Types.Literal + -- See (3) of Note [Rubbish literals] in GHC.Types.Literal | StgLit lit <- scrut , Just args' <- unariseRubbish_maybe lit = elimCase rho args' bndr alt_ty alts @@ -427,19 +427,18 @@ unariseMulti_maybe rho dc args ty_args -- Doesn't return void args. unariseRubbish_maybe :: Literal -> Maybe [OutStgArg] -unariseRubbish_maybe lit - | LitRubbish preps <- lit - , [prep] <- preps +unariseRubbish_maybe (LitRubbish rep) + | [prep] <- preps , not (isVoidRep prep) - -- Single, non-void PrimRep. Nothing to do! - = Nothing + = Nothing -- Single, non-void PrimRep. Nothing to do! - | LitRubbish preps <- lit - -- Multiple reps, possibly with VoidRep. Eliminate! - = Just [ StgLitArg (LitRubbish [prep]) | prep <- preps, not (isVoidRep prep) ] + | otherwise -- Multiple reps, possibly with VoidRep. Eliminate via elimCase + = Just [ StgLitArg (LitRubbish (primRepToType prep)) + | prep <- preps, not (isVoidRep prep) ] + where + preps = runtimeRepPrimRep (text "unariseRubbish_maybe") rep - | otherwise - = Nothing +unariseRubbish_maybe _ = Nothing -------------------------------------------------------------------------------- |