From 059c3c9d7c84fc37c69e9f414ff736d47081e72c Mon Sep 17 00:00:00 2001 From: Sebastian Graf Date: Mon, 28 Jan 2019 16:49:04 +0100 Subject: Separate CPR analysis from the Demand analyser The reasons for that can be found in the wiki: https://gitlab.haskell.org/ghc/ghc/wikis/nested-cpr/split-off-cpr We now run CPR after demand analysis (except for after the final demand analysis run just before code gen). CPR got its own dump flags (`-ddump-cpr-anal`, `-ddump-cpr-signatures`), but not its own flag to activate/deactivate. It will run with `-fstrictness`/`-fworker-wrapper`. As explained on the wiki page, this step is necessary for a sane Nested CPR analysis. And it has quite positive impact on compiler performance: Metric Decrease: T9233 T9675 T9961 T15263 --- compiler/coreSyn/MkCore.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'compiler/coreSyn/MkCore.hs') diff --git a/compiler/coreSyn/MkCore.hs b/compiler/coreSyn/MkCore.hs index a261a98451..e21d980775 100644 --- a/compiler/coreSyn/MkCore.hs +++ b/compiler/coreSyn/MkCore.hs @@ -74,6 +74,7 @@ import TysPrim import DataCon ( DataCon, dataConWorkId ) import IdInfo import Demand +import Cpr import Name hiding ( varName ) import Outputable import FastString @@ -797,7 +798,8 @@ tYPE_ERROR_ID = mkRuntimeErrorId typeErrorName aBSENT_SUM_FIELD_ERROR_ID = mkVanillaGlobalWithInfo absentSumFieldErrorName (mkSpecForAllTys [alphaTyVar] (mkTyVarTy alphaTyVar)) -- forall a . a - (vanillaIdInfo `setStrictnessInfo` mkClosedStrictSig [] botRes + (vanillaIdInfo `setStrictnessInfo` mkClosedStrictSig [] botDiv + `setCprInfo` mkCprSig 0 botCpr `setArityInfo` 0 `setCafInfo` NoCafRefs) -- #15038 @@ -812,6 +814,7 @@ mkRuntimeErrorId name = mkVanillaGlobalWithInfo name runtimeErrorTy bottoming_info where bottoming_info = vanillaIdInfo `setStrictnessInfo` strict_sig + `setCprInfo` mkCprSig 1 botCpr `setArityInfo` 1 -- Make arity and strictness agree @@ -824,7 +827,7 @@ mkRuntimeErrorId name -- any pc_bottoming_Id will itself have CafRefs, which bloats -- SRTs. - strict_sig = mkClosedStrictSig [evalDmd] botRes + strict_sig = mkClosedStrictSig [evalDmd] botDiv runtimeErrorTy :: Type -- forall (rr :: RuntimeRep) (a :: rr). Addr# -> a -- cgit v1.2.1