[commit: ghc] master: No need for sortQuantVars in Exitify after all (270e3e9)

git at git.haskell.org git at git.haskell.org
Wed Apr 11 15:25:17 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/270e3e9bbaabad3d9a1348cea9e46a9ecf1e5ec2/ghc

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

commit 270e3e9bbaabad3d9a1348cea9e46a9ecf1e5ec2
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Wed Apr 11 11:24:01 2018 -0400

    No need for sortQuantVars in Exitify after all
    
    because `captured :: [Var]` is always in dependency order.
    
    I added a comment in the crucial point so that this does not trip us up
    again.


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

270e3e9bbaabad3d9a1348cea9e46a9ecf1e5ec2
 compiler/simplCore/Exitify.hs | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/compiler/simplCore/Exitify.hs b/compiler/simplCore/Exitify.hs
index 6e7d063..22edc20 100644
--- a/compiler/simplCore/Exitify.hs
+++ b/compiler/simplCore/Exitify.hs
@@ -48,7 +48,6 @@ import VarEnv
 import CoreFVs
 import FastString
 import Type
-import MkCore ( sortQuantVars )
 
 import Data.Bifunctor
 import Control.Monad
@@ -128,7 +127,7 @@ exitify in_scope pairs =
     -- variables bound on the way and lifts it out as a join point.
     --
     -- ExitifyM is a state monad to keep track of floated binds
-    go :: [Var]           -- ^ variables to abstract over
+    go :: [Var]           -- ^ variables to abstract over (in dependency order)
        -> CoreExprWithFVs -- ^ current expression in tail position
        -> ExitifyM CoreExpr
 
@@ -175,10 +174,8 @@ exitify in_scope pairs =
         is_interesting = anyVarSet isLocalId (fvs `minusVarSet` mkVarSet captured)
 
         -- The possible arguments of this exit join point
-        abs_vars =
-            map zap $
-            sortQuantVars $
-            filter (`elemVarSet` fvs) captured
+        -- No need for `sortQuantVars`, `captured` is already in dependency order
+        abs_vars = map zap $ filter (`elemVarSet` fvs) captured
 
         -- cf. SetLevels.abstractVars
         zap v | isId v = setIdInfo v vanillaIdInfo



More information about the ghc-commits mailing list