[commit: ghc] master: Vectoriser: improve top-level check and vectFnExpr (40614d8)

Manuel Chakravarty chak at cse.unsw.edu.au
Wed Feb 6 04:17:09 CET 2013


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

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/40614d8ee14f712d5585d0ae7e61759c62399b4b

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

commit 40614d8ee14f712d5585d0ae7e61759c62399b4b
Author: Manuel M T Chakravarty <chak at cse.unsw.edu.au>
Date:   Wed Dec 12 16:08:32 2012 +1100

    Vectoriser: improve top-level check and vectFnExpr

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

 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 88b23fa..a323902 100644
--- a/compiler/vectorise/Vectorise/Exp.hs
+++ b/compiler/vectorise/Vectorise/Exp.hs
@@ -262,9 +262,13 @@ liftSimple aexpr@((fvs_orig, VISimple), expr)
     }
   where
     vars = varSetElems fvs
-    fvs  = filterVarSet isToplevel fvs_orig -- only include 'Id's that are not toplevel
+    fvs  = filterVarSet (not . isToplevel) fvs_orig -- only include 'Id's that are not toplevel
     
-    isToplevel v | isId v    = not . uf_is_top . realIdUnfolding $ v
+    isToplevel v | isId v    = case realIdUnfolding v of
+                                 NoUnfolding                     -> False
+                                 OtherCon      {}                -> True
+                                 DFunUnfolding {}                -> True 
+                                 CoreUnfolding {uf_is_top = top} -> top 
                  | otherwise = False
 
     mkAnnLams :: [Var] -> VarSet -> AnnExpr' Var (VarSet, VectAvoidInfo) -> CoreExprWithVectInfo
@@ -438,7 +442,8 @@ vectFnExpr _ _ aexpr
   = vectScalarFun . deAnnotate $ aexpr
   | otherwise
     -- not an abstraction: vectorise as a non-scalar vanilla expression
-  = pprPanic "Vectorise.Exp.vectFnExpr: unexpected expression" (ppr . deAnnotate $ aexpr)
+    -- NB: we can get here legitimately due to the recursion in the first case above
+  = vectExpr aexpr
 
 -- |Vectorise type and dictionary applications.
 --





More information about the ghc-commits mailing list