Fix bugs in vectorisation of case expressions
authorRoman Leshchinskiy <rl@cse.unsw.edu.au>
Mon, 19 Nov 2007 01:37:14 +0000 (01:37 +0000)
committerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Mon, 19 Nov 2007 01:37:14 +0000 (01:37 +0000)
compiler/vectorise/VectType.hs
compiler/vectorise/VectUtils.hs
compiler/vectorise/Vectorise.hs

index 9bf11e6..a9db43c 100644 (file)
@@ -1022,7 +1022,7 @@ fromVect (FunTy arg_ty res_ty) expr
       vres_ty <- vectType res_ty
       apply   <- builtin applyClosureVar
       body    <- fromVect res_ty
-               $ Var apply `mkTyApps` [arg_ty, res_ty] `mkApps` [expr, Var arg]
+               $ Var apply `mkTyApps` [varg_ty, vres_ty] `mkApps` [expr, varg]
       return $ Lam arg body
 fromVect ty expr
   = identityConv ty >> return expr
index fcdcfd9..5c099c0 100644 (file)
@@ -259,7 +259,7 @@ emptyPA :: Type -> VM CoreExpr
 emptyPA = paMethod pa_empty
 
 packPA :: Type -> CoreExpr -> CoreExpr -> CoreExpr -> VM CoreExpr
-packPA ty xs len sel = liftM (`mkApps` [len, sel])
+packPA ty xs len sel = liftM (`mkApps` [xs, len, sel])
                              (paMethod pa_pack ty)
 
 combinePA :: Type -> CoreExpr -> CoreExpr -> CoreExpr -> [CoreExpr]
index 63575b9..fac66ec 100644 (file)
@@ -446,6 +446,7 @@ packLiftingContext len shape tag fvs res_ty p
                 $ varSetElems fvs
           (vexpr, lexpr) <- p
           return (vexpr, Let (NonRec sel_var sel_expr)
+                         . mkLets (concat bnds)
                          $ Case len lc_var res_ty [(DEFAULT, [], lexpr)])
 
 packFreeVar :: CoreExpr -> CoreExpr -> Var -> VM [CoreBind]