summaryrefslogtreecommitdiff
path: root/compiler/vectorise/Vectorise.hs
diff options
context:
space:
mode:
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>2011-12-18 17:12:54 +1100
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>2011-12-18 17:15:38 +1100
commit0c41d677f3b31a89aa8499d3a6862d87ac464c4a (patch)
tree1ba45b77e7b94f0dd4bea94201613680077c4017 /compiler/vectorise/Vectorise.hs
parentb2d27e42ff655728e7fc4ad26659c2b614bf5f22 (diff)
downloadhaskell-0c41d677f3b31a89aa8499d3a6862d87ac464c4a.tar.gz
Fix scalar vectorisation of superclasses and recursive dfuns
Diffstat (limited to 'compiler/vectorise/Vectorise.hs')
-rw-r--r--compiler/vectorise/Vectorise.hs16
1 files changed, 12 insertions, 4 deletions
diff --git a/compiler/vectorise/Vectorise.hs b/compiler/vectorise/Vectorise.hs
index cd87868081..88fc947242 100644
--- a/compiler/vectorise/Vectorise.hs
+++ b/compiler/vectorise/Vectorise.hs
@@ -218,15 +218,23 @@ vectTopBind b@(Rec bs)
-- Add a vectorised binding to an imported top-level variable that has a VECTORISE [SCALAR] pragma
-- in this module.
--
+-- RESTIRCTION: Currently, we cannot use the pragma vor mutually recursive definitions.
+--
vectImpBind :: Id -> VM CoreBind
vectImpBind var
= do { -- Vectorise the right-hand side, create an appropriate top-level binding and add it
-- to the vectorisation map. For the non-lifted version, we refer to the original
-- definition — i.e., 'Var var'.
- ; (inline, isScalar, expr') <- vectTopRhs [] var (Var var)
- ; var' <- vectTopBinder var inline expr'
- ; when isScalar $
- addGlobalScalarVar var
+ -- NB: To support recursive definitions, we tie a lazy knot.
+ ; (var', _, expr') <- fixV $
+ \ ~(_, inline, rhs) ->
+ do { var' <- vectTopBinder var inline rhs
+ ; (inline, isScalar, expr') <- vectTopRhs [] var (Var var)
+
+ ; when isScalar $
+ addGlobalScalarVar var
+ ; return (var', inline, expr')
+ }
-- We add any newly created hoisted top-level bindings.
; hs <- takeHoisted