Commit 895ff213 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.
Browse files

Vectoriser: fix vectorisation avoidance for case expressions

parent b77da25e
...@@ -1031,23 +1031,20 @@ vectAvoidInfo pvs ce@(fvs, AnnCase e var ty alts) ...@@ -1031,23 +1031,20 @@ vectAvoidInfo pvs ce@(fvs, AnnCase e var ty alts)
= do = do
{ ceVI <- vectAvoidInfoTypeOf ce { ceVI <- vectAvoidInfoTypeOf ce
; eVI <- vectAvoidInfo pvs e ; eVI <- vectAvoidInfo pvs e
; isScalarTy <- isScalar . annExprType $ e ; altsVI <- mapM (vectAvoidInfoAlt (isVIParr eVI)) alts
; altsVI <- mapM (vectAvoidInfoAlt (isVIParr eVI && not isScalarTy)) alts
; allScalarBndrs <- anyM allScalarAltBndrs altsVI
; let alteVIs = [eVI | (_, _, eVI) <- altsVI] ; let alteVIs = [eVI | (_, _, eVI) <- altsVI]
vi | isVIParr eVI && not allScalarBndrs = VIParr vi = foldl unlessVIParrExpr ceVI (eVI:alteVIs) -- NB: same effect as in the paper
| otherwise
= foldl unlessVIParrExpr ceVI alteVIs
; viTrace ce vi (eVI : alteVIs) ; viTrace ce vi (eVI : alteVIs)
; return ((fvs, vi), AnnCase eVI var ty altsVI) ; return ((fvs, vi), AnnCase eVI var ty altsVI)
} }
where where
vectAvoidInfoAlt isScalarScrut (con, bndrs, e) = (con, bndrs,) <$> vectAvoidInfo altPvs e vectAvoidInfoAlt scrutIsPar (con, bndrs, e)
where = do
altPvs | isScalarScrut = pvs { allScalar <- allScalarVarType bndrs
| otherwise = pvs `extendVarSetList` bndrs ; let altPvs | scrutIsPar && not allScalar = pvs `extendVarSetList` bndrs
| otherwise = pvs
allScalarAltBndrs (_, bndrs, _) = allScalarVarType bndrs ; (con, bndrs,) <$> vectAvoidInfo altPvs e
}
vectAvoidInfo pvs (fvs, AnnCast e (fvs_ann, ann)) vectAvoidInfo pvs (fvs, AnnCast e (fvs_ann, ann))
= do = do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment