type_ok_for_let_to_case
) where
-import Ubiq{-uitous-}
+IMP_Ubiq(){-uitous-}
+IMPORT_DELOOPER(SmplLoop) -- paranoia checking
import BinderInfo
import CmdLineOpts ( SimplifierSwitch(..) )
import CoreSyn
-import CoreUtils ( manifestlyWHNF )
+import CoreUnfold ( SimpleUnfolding, mkFormSummary, FormSummary(..) )
import Id ( idType, isBottomingId, idWantsToBeINLINEd, dataConArgTys,
getIdArity, GenId{-instance Eq-}
)
import IdInfo ( arityMaybe )
import Maybes ( maybeToBool )
-import PrelInfo ( augmentId, buildId, realWorldStateTy )
+import PrelVals ( augmentId, buildId )
import PrimOp ( primOpIsCheap )
import SimplEnv
import SimplMonad
-import Type ( eqTy, isPrimType, maybeAppDataTyCon, getTyVar_maybe )
+import Type ( eqTy, isPrimType, maybeAppDataTyConExpandingDicts, getTyVar_maybe )
+import TysWiredIn ( realWorldStateTy )
import TyVar ( GenTyVar{-instance Eq-} )
import Util ( isIn, panic )
try (App (App (Var bld) _) _) | bld == buildId = True
try (App (App (App (Var aug) _) _) _) | aug == augmentId = True
- try other = manifestlyWHNF other
- {- but *not* necessarily "manifestlyBottom other"...
+ try other = case mkFormSummary other of
+ VarForm -> True
+ ValueForm -> True
+ other -> False
+ {- but *not* necessarily "BottomForm"...
We may want to float a let out of a let to expose WHNFs,
but to do that to expose a "bottom" is a Bad Idea:
returnSmpl (PrimAlts [] (BindDefault (binder, bad_occ_info) (Var binder)))
| otherwise
- = case (maybeAppDataTyCon rhs_ty) of
+ = case (maybeAppDataTyConExpandingDicts rhs_ty) of
Just (tycon, ty_args, [data_con]) -> -- algebraic type suitable for unpacking
let
inst_con_arg_tys = dataConArgTys data_con ty_args
type_ok_for_let_to_case :: Type -> Bool
type_ok_for_let_to_case ty
- = case (maybeAppDataTyCon ty) of
+ = case (maybeAppDataTyConExpandingDicts ty) of
Nothing -> False
Just (tycon, ty_args, []) -> False
Just (tycon, ty_args, non_null_data_cons) -> True