summaryrefslogtreecommitdiff
path: root/compiler/vectorise/Vectorise/Exp.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/vectorise/Vectorise/Exp.hs')
-rw-r--r--compiler/vectorise/Vectorise/Exp.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/compiler/vectorise/Vectorise/Exp.hs b/compiler/vectorise/Vectorise/Exp.hs
index 4676e182a9..98271900f0 100644
--- a/compiler/vectorise/Vectorise/Exp.hs
+++ b/compiler/vectorise/Vectorise/Exp.hs
@@ -62,7 +62,8 @@ vectPolyExpr loop_breaker recFns expr
(tvs, mono) = collectAnnTypeBinders expr
--- | Vectorise an expression.
+-- |Vectorise an expression.
+--
vectExpr :: CoreExprWithFVs -> VM VExpr
vectExpr (_, AnnType ty)
= liftM vType (vectType ty)
@@ -76,6 +77,17 @@ vectExpr (_, AnnLit lit)
vectExpr (_, AnnNote note expr)
= liftM (vNote note) (vectExpr expr)
+-- SPECIAL CASE: Vectorise/lift 'patError @ ty err' by only vectorising/lifting the type 'ty';
+-- its only purpose is to abort the program, but we need to adjust the type to keep CoreLint
+-- happy.
+vectExpr (_, AnnApp (_, AnnApp (_, AnnVar v) (_, AnnType ty)) err)
+ | v == pAT_ERROR_ID
+ = do { (vty, lty) <- vectAndLiftType ty
+ ; return (mkCoreApps (Var v) [Type vty, err'], mkCoreApps (Var v) [Type lty, err'])
+ }
+ where
+ err' = deAnnotate err
+
vectExpr e@(_, AnnApp _ arg)
| isAnnTypeArg arg
= vectTyAppExpr fn tys