[Git][ghc/ghc][wip/T22404] Simplify the shadowing case

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Wed Jul 12 20:30:54 UTC 2023



Simon Peyton Jones pushed to branch wip/T22404 at Glasgow Haskell Compiler / GHC


Commits:
63679314 by Simon Peyton Jones at 2023-07-12T21:27:21+01:00
Simplify the shadowing case

- - - - -


1 changed file:

- compiler/GHC/Core/Opt/OccurAnal.hs


Changes:

=====================================
compiler/GHC/Core/Opt/OccurAnal.hs
=====================================
@@ -2873,9 +2873,11 @@ addInScope env@(OccEnv { occ_in_scope = in_scope, occ_join_points = join_points
     fix_up_uds (thing_inside env_w_bndrs)
 
   | otherwise    -- Shadowing!  Lots of things to do
-  = fix_up_uds $ add_bad_joins $
+  = fix_up_uds $
+    add_bad_joins $
     thing_inside $
-    drop_shadowed_swaps $ drop_shadowed_joins $
+    drop_shadowed_swaps $
+    drop_shadowed_joins $
     env_w_bndrs
 
   where
@@ -2891,7 +2893,8 @@ addInScope env@(OccEnv { occ_in_scope = in_scope, occ_join_points = join_points
 
     drop_shadowed_joins :: OccEnv -> OccEnv
     -- See Note [Occurrence analysis for join points] wrinkle2 (W1) and (W2)
-    drop_shadowed_joins env = env { occ_join_points = good_joins `delVarEnvList` bndrs }
+--    drop_shadowed_joins env = env { occ_join_points = good_joins `delVarEnvList` bndrs }
+    drop_shadowed_joins env = env { occ_join_points = emptyVarEnv }
 
     fix_up_uds :: WithUsageDetails a -> WithUsageDetails a
     -- Remove usage for bndrs
@@ -2917,11 +2920,14 @@ addInScope env@(OccEnv { occ_in_scope = in_scope, occ_join_points = join_points
       | uniq `elemUFM_Directly` ud_env uds = uds `andUDs` bad_join_uds
       | otherwise                          = uds
 
+    bad_joins = join_points
+{-
     bad_joins, good_joins :: IdEnv UsageDetails
     (bad_joins, good_joins) = partitionVarEnv bad_join_rhs join_points
 
     bad_join_rhs :: UsageDetails -> Bool
     bad_join_rhs (UD { ud_env = rhs_usage }) = any (`elemVarEnv` rhs_usage) bndrs
+-}
 
 addJoinPoint :: OccEnv -> Id -> UsageDetails -> OccEnv
 addJoinPoint env bndr rhs_uds



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6367931471a6386ad3f0362d8d4936442ca8048a

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6367931471a6386ad3f0362d8d4936442ca8048a
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/20230712/dd6da92d/attachment-0001.html>


More information about the ghc-commits mailing list