[commit: ghc] wip/cbv-conv-thunk: Speculative evaluate thunks known to Converge (7e6bb34)
git at git.haskell.org
git at git.haskell.org
Thu Jan 9 18:35:37 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/cbv-conv-thunk
Link : http://ghc.haskell.org/trac/ghc/changeset/7e6bb343d1550982feec6b3b3255e55676b7f1db/ghc
>---------------------------------------------------------------
commit 7e6bb343d1550982feec6b3b3255e55676b7f1db
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Mon Jan 6 14:12:57 2014 +0000
Speculative evaluate thunks known to Converge
This is an attempt to use the by-products of nested cpr analysis.
>---------------------------------------------------------------
7e6bb343d1550982feec6b3b3255e55676b7f1db
compiler/basicTypes/Demand.lhs | 7 +++++++
compiler/basicTypes/Id.lhs | 7 ++++++-
compiler/simplCore/Simplify.lhs | 2 +-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/compiler/basicTypes/Demand.lhs b/compiler/basicTypes/Demand.lhs
index 4fbf3ca..0e7996e 100644
--- a/compiler/basicTypes/Demand.lhs
+++ b/compiler/basicTypes/Demand.lhs
@@ -812,6 +812,10 @@ isBotRes :: DmdResult -> Bool
isBotRes Diverges = True
isBotRes _ = False
+isConvRes :: DmdResult -> Bool
+isConvRes (Converges {}) = True
+isConvRes _ = False
+
trimCPRInfo :: Bool -> Bool -> DmdResult -> DmdResult
trimCPRInfo trim_all trim_sums res
= trimR res
@@ -1439,6 +1443,9 @@ isNopSig (StrictSig ty) = isNopDmdType ty
isBottomingSig :: StrictSig -> Bool
isBottomingSig (StrictSig (DmdType _ _ res)) = isBotRes res
+isConvSig :: StrictSig -> Bool
+isConvSig (StrictSig (DmdType _ _ res)) = isConvRes res
+
nopSig, botSig :: StrictSig
nopSig = StrictSig nopDmdType
botSig = StrictSig botDmdType
diff --git a/compiler/basicTypes/Id.lhs b/compiler/basicTypes/Id.lhs
index 50b3641..9ad99f3 100644
--- a/compiler/basicTypes/Id.lhs
+++ b/compiler/basicTypes/Id.lhs
@@ -47,7 +47,7 @@ module Id (
-- ** Predicates on Ids
isImplicitId, isDeadBinder,
- isStrictId,
+ isStrictId, isConvId,
isExportedId, isLocalId, isGlobalId,
isRecordSelector, isNaughtyRecordSelector,
isClassOpId_maybe, isDFunId,
@@ -495,6 +495,11 @@ isStrictId id
-- Take the best of both strictnesses - old and new
(isStrictDmd (idDemandInfo id))
+isConvId :: Id -> Bool
+isConvId id
+ = ASSERT2( isId id, text "isConvId: not an id: " <+> ppr id )
+ (isConvSig (idStrictness id))
+
---------------------------------
-- UNFOLDING
idUnfolding :: Id -> Unfolding
diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs
index 03150c6..422e3d0 100644
--- a/compiler/simplCore/Simplify.lhs
+++ b/compiler/simplCore/Simplify.lhs
@@ -1347,7 +1347,7 @@ simplNonRecE env bndr (rhs, rhs_se) (bndrs, body) cont
; -- pprTrace "preInlineUncond" (ppr bndr <+> ppr rhs) $
simplLam (extendIdSubst env bndr (mkContEx rhs_se rhs)) bndrs body cont }
- | isStrictId bndr -> -- Includes coercions
+ | isStrictId bndr || isConvId bndr -> -- Includes coercions
do { simplExprF (rhs_se `setFloats` env) rhs
(StrictBind bndr bndrs body env cont) }
More information about the ghc-commits
mailing list