diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2018-01-23 10:37:37 +0000 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2018-01-23 10:37:37 +0000 |
commit | 30f275c3679d3f01d26c5d469931a0fb0b0c8541 (patch) | |
tree | 7b71b48ef675b85b6916826b5524f1177c580604 /compiler/coreSyn/CoreUtils.hs | |
parent | 575c009d9e4b25384ef984c09b2c54f909693e93 (diff) | |
download | haskell-wip/T14688.tar.gz |
patchwip/T14688
Diffstat (limited to 'compiler/coreSyn/CoreUtils.hs')
-rw-r--r-- | compiler/coreSyn/CoreUtils.hs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index 5e32dc6093..c99e05f31a 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -1131,18 +1131,18 @@ in this (which it previously was): -} -------------------- +exprIsWorkFree :: CoreExpr -> Bool -- See Note [exprIsWorkFree] +exprIsWorkFree = exprIsCheapX True isWorkFreeApp + exprIsCheap :: CoreExpr -> Bool -exprIsCheap = exprIsCheapX isCheapApp +exprIsCheap = exprIsCheapX True isCheapApp exprIsExpandable :: CoreExpr -> Bool -- See Note [exprIsExpandable] -exprIsExpandable = exprIsCheapX isExpandableApp - -exprIsWorkFree :: CoreExpr -> Bool -- See Note [exprIsWorkFree] -exprIsWorkFree = exprIsCheapX isWorkFreeApp +exprIsExpandable = exprIsCheapX False isExpandableApp -------------------- -exprIsCheapX :: CheapAppFun -> CoreExpr -> Bool -exprIsCheapX ok_app e +exprIsCheapX :: Bool -> CheapAppFun -> CoreExpr -> Bool +exprIsCheapX ok_case ok_app e = ok e where ok e = go 0 e @@ -1153,7 +1153,8 @@ exprIsCheapX ok_app e go _ (Type {}) = True go _ (Coercion {}) = True go n (Cast e _) = go n e - go n (Case scrut _ _ alts) = ok scrut && + go n (Case scrut _ _ alts) = ok_case && + ok scrut && and [ go n rhs | (_,_,rhs) <- alts ] go n (Tick t e) | tickishCounts t = False | otherwise = go n e |