[commit: ghc] wip/T14068: During loopification, zap occurrence info on the lambda binders (156f879)

git at git.haskell.org git at git.haskell.org
Wed Aug 2 15:40:44 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T14068
Link       : http://ghc.haskell.org/trac/ghc/changeset/156f8790d07e276eaf105eaab191149569e66eb0/ghc

>---------------------------------------------------------------

commit 156f8790d07e276eaf105eaab191149569e66eb0
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Wed Aug 2 10:04:48 2017 -0400

    During loopification, zap occurrence info on the lambda binders
    
    If we have
    
      letrec f x[dead] = … f () …
      in g f
    
    loopification turns that into
    
      let f x = joinrec f x[dead] = … f () …
                in jump j x
      in g f
    
    Note that the parameter x of f is no longer dead!


>---------------------------------------------------------------

156f8790d07e276eaf105eaab191149569e66eb0
 compiler/simplCore/Simplify.hs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs
index c612b2f..6ccd1f2 100644
--- a/compiler/simplCore/Simplify.hs
+++ b/compiler/simplCore/Simplify.hs
@@ -1671,9 +1671,13 @@ maybeLoopify (Rec [(bndr, rhs)])
   | Just (bndr', join_bndr, join_rhs) <- loopificationJoinPointBinding_maybe bndr rhs
   = do  { let Just arity = isJoinId_maybe join_bndr
         ; let (join_params, _join_body) = collectNBinders arity join_rhs
-        ; let rhs' = mkLams join_params $
+        ; let join_params' =
+                [ if isId var then zapIdOccInfo var else var
+                | var <- join_params ]
+            -- Some might be marked as dead (in the RHS), but there are not dead here
+        ; let rhs' = mkLams join_params' $
                      mkLetRec [(join_bndr,join_rhs)] $
-                     mkVarApps (Var join_bndr) join_params
+                     mkVarApps (Var join_bndr) join_params'
         ; Just (NonRec bndr' rhs')
         }
 maybeLoopify _ = Nothing



More information about the ghc-commits mailing list