[commit: ghc] wip/T14068: simplTopBinds: Call maybeLoopify before simplRecBndrs (507c35f)

git at git.haskell.org git at git.haskell.org
Fri Jan 5 21:16:28 UTC 2018


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

On branch  : wip/T14068
Link       : http://ghc.haskell.org/trac/ghc/changeset/507c35f9d900a38aeaf9a0b48c764ffad84c5b72/ghc

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

commit 507c35f9d900a38aeaf9a0b48c764ffad84c5b72
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Wed Nov 1 13:05:59 2017 -0400

    simplTopBinds: Call maybeLoopify before simplRecBndrs
    
    so that the post-loopified binder ends up in the SimplEnv


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

507c35f9d900a38aeaf9a0b48c764ffad84c5b72
 compiler/simplCore/Simplify.hs | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs
index 6e75a80..532b7ee 100644
--- a/compiler/simplCore/Simplify.hs
+++ b/compiler/simplCore/Simplify.hs
@@ -129,11 +129,12 @@ simplTopBinds env0 binds0
                 -- anything into scope, then we don't get a complaint about that.
                 -- It's rather as if the top-level binders were imported.
                 -- See note [Glomming] in OccurAnal.
-        ; env1 <- simplRecBndrs env0 (bindersOfBinds binds0)
-        ; (floats, env2) <- simpl_binds env1 binds0
+        ; env1 <- simplRecBndrs env0 (bindersOfBinds binds1)
+        ; (floats, env2) <- simpl_binds env1 binds1
         ; freeTick SimplifierDone
         ; return (floats, env2) }
   where
+    binds1 = [ maybeLoopify bind `orElse` bind | bind <- binds0 ]
         -- We need to track the zapped top-level binders, because
         -- they should have their fragile IdInfo zapped (notably occurrence info)
         -- That's why we run down binds and bndrs' simultaneously.
@@ -144,10 +145,6 @@ simplTopBinds env0 binds0
                                       ; (floats, env2) <- simpl_binds env1 binds
                                       ; return (float `addFloats` floats, env2) }
 
-    simpl_bind env bind | Just bind' <- maybeLoopify bind
-                        = do -- update the env, as maybeLoopify changes the id info
-                             env1 <- simplRecBndrs env (bindersOf bind')
-                             simpl_bind env1 bind'
     simpl_bind env (Rec pairs)  = simplRecBind env TopLevel Nothing pairs
     simpl_bind env (NonRec b r) = do { (env', b') <- addBndrRules env b (lookupRecBndr env b)
                                      ; simplRecOrTopPair env' TopLevel



More information about the ghc-commits mailing list