Ticket #9561: mergeSATInfo-cleanup.diff

File mergeSATInfo-cleanup.diff, 2.0 KB (added by dfeuer, 5 years ago)
  • compiler/simplCore/SAT.lhs

    diff --git a/compiler/simplCore/SAT.lhs b/compiler/simplCore/SAT.lhs
    index a0b3151..003bba5 100644
    a b pprStaticness NotStatic = ptext (sLit "NS") 
    139139
    140140
    141141mergeSATInfo :: SATInfo -> SATInfo -> SATInfo
    142 mergeSATInfo [] _  = []
    143 mergeSATInfo _  [] = []
    144 mergeSATInfo (NotStatic:statics) (_:apps) = NotStatic : mergeSATInfo statics apps
    145 mergeSATInfo (_:statics) (NotStatic:apps) = NotStatic : mergeSATInfo statics apps
    146 mergeSATInfo ((Static (VarApp v)):statics)  ((Static (VarApp v')):apps)  = (if v == v' then Static (VarApp v) else NotStatic) : mergeSATInfo statics apps
    147 mergeSATInfo ((Static (TypeApp t)):statics) ((Static (TypeApp t')):apps) = (if t `eqType` t' then Static (TypeApp t) else NotStatic) : mergeSATInfo statics apps
    148 mergeSATInfo ((Static (CoApp c)):statics) ((Static (CoApp c')):apps)     = (if c `coreEqCoercion` c' then Static (CoApp c) else NotStatic) : mergeSATInfo statics apps
    149 mergeSATInfo l  r  = pprPanic "mergeSATInfo" $ ptext (sLit "Left:") <> pprSATInfo l <> ptext (sLit ", ")
    150                                             <> ptext (sLit "Right:") <> pprSATInfo r
     142mergeSATInfo l r = zipWith mergeSA l r
     143  where
     144    mergeSA NotStatic _ = NotStatic
     145    mergeSA _ NotStatic = NotStatic
     146    mergeSA (Static (VarApp v)) (Static (VarApp v'))
     147      | v == v'   = Static (VarApp v)
     148      | otherwise = NotStatic
     149    mergeSA (Static (TypeApp t)) (Static (TypeApp t'))
     150      | t `eqType` t' = Static (TypeApp t)
     151      | otherwise     = NotStatic
     152    mergeSA (Static (CoApp c)) (Static (CoApp c'))
     153      | c `coreEqCoercion` c' = Static (CoApp c)
     154      | otherwise             = NotStatic
     155    mergeSA _ _  = pprPanic "mergeSATInfo" $
     156                          ptext (sLit "Left:")
     157                       <> pprSATInfo l <> ptext (sLit ", ")
     158                       <> ptext (sLit "Right:")
     159                       <> pprSATInfo r
    151160
    152161mergeIdSATInfo :: IdSATInfo -> IdSATInfo -> IdSATInfo
    153162mergeIdSATInfo = plusUFM_C mergeSATInfo