summaryrefslogtreecommitdiff
path: root/compiler/vectorise
diff options
context:
space:
mode:
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>2012-12-12 16:08:32 +1100
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>2012-12-12 16:08:32 +1100
commit40614d8ee14f712d5585d0ae7e61759c62399b4b (patch)
tree036bd2edb7292829a90bafa2ed86e383d537653a /compiler/vectorise
parent3558690c5d73cab06f7cb4315a11ebd0dd6057e1 (diff)
downloadhaskell-40614d8ee14f712d5585d0ae7e61759c62399b4b.tar.gz
Vectoriser: improve top-level check and vectFnExpr
Diffstat (limited to 'compiler/vectorise')
-rw-r--r--compiler/vectorise/Vectorise/Exp.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/vectorise/Vectorise/Exp.hs b/compiler/vectorise/Vectorise/Exp.hs
index 88b23fabc7..a32390260c 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.
--