projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make sure DEFAULT always comes first in generated PA dictionaries
[ghc-hetmet.git]
/
compiler
/
vectorise
/
VectType.hs
diff --git
a/compiler/vectorise/VectType.hs
b/compiler/vectorise/VectType.hs
index
d3a1ee2
..
9d9db53
100644
(file)
--- a/
compiler/vectorise/VectType.hs
+++ b/
compiler/vectorise/VectType.hs
@@
-315,20
+315,23
@@
paMethods = [(FSLIT("lengthPA"), buildLengthPA),
(FSLIT("replicatePA"), buildReplicatePA)]
buildLengthPA :: TyCon -> TyCon -> VM CoreExpr
(FSLIT("replicatePA"), buildReplicatePA)]
buildLengthPA :: TyCon -> TyCon -> VM CoreExpr
-buildLengthPA _ arr_tc
+buildLengthPA vect_tc arr_tc
= do
= do
- arg <- newLocalVar FSLIT("xs") arg_ty
+ parr_ty <- mkPArrayType (mkTyConApp vect_tc arg_tys)
+ arg <- newLocalVar FSLIT("xs") parr_ty
+ let scrut = unwrapFamInstScrut arr_tc arg_tys (Var arg)
+ scrut_ty = exprType scrut
shape <- newLocalVar FSLIT("sel") shape_ty
body <- lengthPA (Var shape)
shape <- newLocalVar FSLIT("sel") shape_ty
body <- lengthPA (Var shape)
+ wilds <- mapM newDummyVar repr_tys
return . Lam arg
return . Lam arg
- $ Case (Var arg) (mkWildId arg_ty) intPrimTy
- [(DataAlt repr_dc, shape : map mkWildId repr_tys, body)]
+ $ Case scrut (mkWildId scrut_ty) intPrimTy
+ [(DataAlt repr_dc, shape : wilds, body)]
where
where
- arg_ty = mkTyConApp arr_tc . mkTyVarTys $ tyConTyVars arr_tc
+ arg_tys = mkTyVarTys $ tyConTyVars arr_tc
[repr_dc] = tyConDataCons arr_tc
shape_ty : repr_tys = dataConRepArgTys repr_dc
[repr_dc] = tyConDataCons arr_tc
shape_ty : repr_tys = dataConRepArgTys repr_dc
-
-- data T = C0 t1 ... tm
-- ...
-- Ck u1 ... un
-- data T = C0 t1 ... tm
-- ...
-- Ck u1 ... un
@@
-395,7
+398,7
@@
buildReplicatePA vect_tc arr_tc
arr_ty <- mkPArrayType ty
return $ Case val wild arr_ty
arr_ty <- mkPArrayType ty
return $ Case val wild arr_ty
- [(DataAlt dc, pre ++ (var : post), rep), (DEFAULT, [], empty)]
+ [(DEFAULT, [], empty), (DataAlt dc, pre ++ (var : post), rep)]
-- | Split the given tycons into two sets depending on whether they have to be
-- converted (first list) or not (second list). The first argument contains
-- | Split the given tycons into two sets depending on whether they have to be
-- converted (first list) or not (second list). The first argument contains