[commit: ghc] wip/fix-validate: Don't do binder-swap for GlobalIds (561ba84)

git at git.haskell.org git at git.haskell.org
Thu Feb 21 19:32:10 UTC 2019


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

On branch  : wip/fix-validate
Link       : http://ghc.haskell.org/trac/ghc/changeset/561ba841e566e6463e7c6db1712b554be2879af5/ghc

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

commit 561ba841e566e6463e7c6db1712b554be2879af5
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Feb 21 09:34:01 2019 +0000

    Don't do binder-swap for GlobalIds
    
    This patch disables the binder-swap transformation in the
    (relatively rare) case when the scrutinee is a GlobalId.
    Reason: we are getting Lint errors so that GHC doesn't
    even validate.  Trac #16346.
    
    This is NOT the final solution -- it's just a stop-gap
    to get us running again.
    
    The final solution is in Trac #16296


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

561ba841e566e6463e7c6db1712b554be2879af5
 compiler/simplCore/OccurAnal.hs | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs
index 5287817..c3414b1 100644
--- a/compiler/simplCore/OccurAnal.hs
+++ b/compiler/simplCore/OccurAnal.hs
@@ -2402,9 +2402,14 @@ mkAltEnv env@(OccEnv { occ_gbl_scrut = pe }) scrut case_bndr
       _               -> (env { occ_encl = OccVanilla }, Nothing)
 
   where
-    add_scrut v rhs = ( env { occ_encl = OccVanilla
-                            , occ_gbl_scrut = pe `extendVarSet` v }
-                      , Just (localise v, rhs) )
+    add_scrut v rhs
+      | isGlobalId v = (env { occ_encl = OccVanilla }, Nothing)
+      | otherwise    = ( env { occ_encl = OccVanilla
+                             , occ_gbl_scrut = pe `extendVarSet` v }
+                       , Just (localise v, rhs) )
+      -- ToDO: this isGlobalId stuff is a TEMPORARY FIX
+      --       to avoid the binder-swap for GlobalIds
+      --       See Trac #16346
 
     case_bndr' = Var (zapIdOccInfo case_bndr)
                    -- See Note [Zap case binders in proxy bindings]



More information about the ghc-commits mailing list