[commit: ghc] wip/T14068: simplTopBinds: Call maybeLoopify before simplRecBndrs (294a175)

git at git.haskell.org git at git.haskell.org
Wed Nov 1 17:06:45 UTC 2017


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

On branch  : wip/T14068
Link       : http://ghc.haskell.org/trac/ghc/changeset/294a175d4e3a78b9e6630725e2ffc44a1a5883fe/ghc

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

commit 294a175d4e3a78b9e6630725e2ffc44a1a5883fe
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


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

294a175d4e3a78b9e6630725e2ffc44a1a5883fe
 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