[Git][ghc/ghc][wip/T21470] Wibble
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Wed Sep 28 12:53:35 UTC 2022
Simon Peyton Jones pushed to branch wip/T21470 at Glasgow Haskell Compiler / GHC
Commits:
f7a033ac by Simon Peyton Jones at 2022-09-28T13:54:57+01:00
Wibble
Fix Specialiser for dead binders
(todo: merge with previous commit)
- - - - -
1 changed file:
- compiler/GHC/Core/Opt/Specialise.hs
Changes:
=====================================
compiler/GHC/Core/Opt/Specialise.hs
=====================================
@@ -2458,6 +2458,7 @@ specHeader env (bndr : bndrs) (UnspecType : args)
-- a wildcard binder to match the dictionary (See Note [Specialising Calls] for
-- the nitty-gritty), as a LHS rule and unfolding details.
specHeader env (bndr : bndrs) (SpecDict d : args)
+ | not (isDeadBinder bndr)
= do { (env1, bndr') <- newDictBndr env bndr -- See Note [Zap occ info in rule binders]
; let (env2, dx_bind, spec_dict) = bindAuxiliaryDict env1 bndr bndr' d
; (_, env3, leftover_bndrs, rule_bs, rule_es, bs', dx, spec_args)
@@ -2474,15 +2475,18 @@ specHeader env (bndr : bndrs) (SpecDict d : args)
)
}
--- Finally, we have the unspecialised argument 'i'. We need to produce
--- a binder, LHS and RHS argument for the RULE, and a binder for the
--- specialised body.
+-- Finally, we don't want to specialise on this argument 'i':
+-- - It's an UnSpecArg, or
+-- - It's a dead dictionary
+-- We need to produce a binder, LHS and RHS argument for the RULE, and
+-- a binder for the specialised body.
--
-- NB: Calls to 'specHeader' will trim off any trailing 'UnspecArg's, which is
-- why 'i' doesn't appear in our RULE above. But we have no guarantee that
-- there aren't 'UnspecArg's which come /before/ all of the dictionaries, so
-- this case must be here.
-specHeader env (bndr : bndrs) (UnspecArg : args)
+specHeader env (bndr : bndrs) (_ : args)
+ -- The "_" can be UnSpecArg, or SpecDict where the bndr is dead
= do { -- see Note [Zap occ info in rule binders]
let (env', bndr') = substBndr env (zapIdOccInfo bndr)
; (useful, env'', leftover_bndrs, rule_bs, rule_es, bs', dx, spec_args)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f7a033ac30301c942594c59e8ad5f03a3e2ecd3e
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f7a033ac30301c942594c59e8ad5f03a3e2ecd3e
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220928/dc08da7f/attachment-0001.html>
More information about the ghc-commits
mailing list