
Simon Peyton Jones pushed to branch wip/andreask/spec_tyfams at Glasgow Haskell Compiler / GHC Commits: 39a685d7 by Simon Peyton Jones at 2025-07-04T13:52:43+01:00 Treat tuple dicationaries uniformly; don't unbox them See the explanation in https://gitlab.haskell.org/ghc/ghc/-/issues/19747#note_626297 ToDo: needs better Notes etc. This is for CI - - - - - e9bce3a3 by Simon Peyton Jones at 2025-07-04T13:55:01+01:00 Comment out the ad-hoc specCase stuff See #26158. Needs more documentation - - - - - 2 changed files: - compiler/GHC/Core/Opt/DmdAnal.hs - compiler/GHC/Core/Opt/Specialise.hs Changes: ===================================== compiler/GHC/Core/Opt/DmdAnal.hs ===================================== @@ -23,7 +23,7 @@ import GHC.Core.DataCon import GHC.Core.Utils import GHC.Core.TyCon import GHC.Core.Type -import GHC.Core.Predicate( isEqualityClass, isCTupleClass ) +import GHC.Core.Predicate( isEqualityClass {- , isCTupleClass -} ) import GHC.Core.FVs ( rulesRhsFreeIds, bndrRuleAndUnfoldingIds ) import GHC.Core.Coercion ( Coercion ) import GHC.Core.TyCo.FVs ( coVarsOfCos ) @@ -2194,8 +2194,10 @@ doNotUnbox :: Type -> Bool doNotUnbox arg_ty = case tyConAppTyCon_maybe arg_ty of Just tc | Just cls <- tyConClass_maybe tc - -> not (isEqualityClass cls || isCTupleClass cls) + -> not (isEqualityClass cls {- || isCTupleClass cls -}) -- See (DNB2) and (DNB1) in Note [Do not unbox class dictionaries] + -- + -- *** TODO *** document the removal of isCTupleClass! _ -> False @@ -2243,7 +2245,7 @@ Wrinkle (DNB1): we /do/ want to unbox tuple dictionaries (#23398) f = /\a. \d:(% Eq a, Show a %). ... f @a (% sel1 d, sel2 d %)... where there is a recurive call to `f`, or to another function that takes the same tuple dictionary, but where the tuple is built from the components of - `d`. The Simplier does not fix this. But if we unpacked the dictionary + `d`. The Simplifier does not fix this. But if we unpacked the dictionary we'd get $wf = /\a. \(d1:Eq a) (d2:Show a). let d = (% d1, d2 %) in ...f @a (% sel1 d, sel2 d %) ===================================== compiler/GHC/Core/Opt/Specialise.hs ===================================== @@ -1283,6 +1283,7 @@ specCase :: SpecEnv , OutId , [OutAlt] , UsageDetails) +{- specCase env scrut' case_bndr [Alt con args rhs] | -- See Note [Floating dictionaries out of cases] isDictTy (idType case_bndr) @@ -1343,6 +1344,7 @@ specCase env scrut' case_bndr [Alt con args rhs] && tyCoVarsOfType var_ty `disjointVarSet` arg_set where var_ty = idType var +-} specCase env scrut case_bndr alts = do { (alts', uds_alts) <- mapAndCombineSM spec_alt alts View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e61488225a0c5a97e0a77443592c168... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e61488225a0c5a97e0a77443592c168... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)