[commit: ghc] master: DPH: free top-level variables don't prevent encapsulation (767663b)

Manuel Chakravarty chak at cse.unsw.edu.au
Tue Feb 19 04:31:53 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/767663b583b185bdf375799d8d34b340dada930e

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

commit 767663b583b185bdf375799d8d34b340dada930e
Author: Manuel M T Chakravarty <chak at cse.unsw.edu.au>
Date:   Mon Feb 18 17:48:43 2013 +1100

    DPH: free top-level variables don't prevent encapsulation

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

 compiler/vectorise/Vectorise/Exp.hs |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/compiler/vectorise/Vectorise/Exp.hs b/compiler/vectorise/Vectorise/Exp.hs
index 706fc85..fb0c148 100644
--- a/compiler/vectorise/Vectorise/Exp.hs
+++ b/compiler/vectorise/Vectorise/Exp.hs
@@ -1211,12 +1211,17 @@ maybeParrTy ty
 maybeParrTy (ForAllTy _ ty) = maybeParrTy ty
 maybeParrTy _               = return False
 
--- Are the types of all variables in the 'Scalar' class?
+-- Are the types of all variables in the 'Scalar' class or toplevel variables?
+--
+-- NB: 'liftSimple' does not abstract over toplevel variables.
 --
 allScalarVarType :: [Var] -> VM Bool
-allScalarVarType vs = and <$> mapM (isScalar . varType) vs
+allScalarVarType vs = and <$> mapM isScalarOrToplevel vs
+  where
+    isScalarOrToplevel v | isToplevel v = return True
+                         | otherwise    = isScalar (varType v)
 
--- Are the types of all variables in the set in the 'Scalar' class?
+-- Are the types of all variables in the set in the 'Scalar' class or toplevel variables?
 --
 allScalarVarTypeSet :: VarSet -> VM Bool
 allScalarVarTypeSet = allScalarVarType . varSetElems





More information about the ghc-commits mailing list