summaryrefslogtreecommitdiff
path: root/libraries/base
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2022-07-15 17:47:32 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2022-11-10 12:20:03 +0000
commitf9f17b68b144a7ecb91395c1e987bbf4f91c0180 (patch)
treeb5e1460afc1926dd30646b6facaa26f87e031efd /libraries/base
parent90c5abd4581b404f715e72ad55303e18d0c31d68 (diff)
downloadhaskell-f9f17b68b144a7ecb91395c1e987bbf4f91c0180.tar.gz
Fire RULES in the Specialiser
The Specialiser has, for some time, fires class-op RULES in the specialiser itself: see Note [Specialisation modulo dictionary selectors] This MR beefs it up a bit, so that it fires /all/ RULES in the specialiser, not just class-op rules. See Note [Fire rules in the specialiser] The result is a bit more specialisation; see test simplCore/should_compile/T21851_2 This pushed me into a bit of refactoring. I made a new data types GHC.Core.Rules.RuleEnv, which combines - the several source of rules (local, home-package, external) - the orphan-module dependencies in a single record for `getRules` to consult. That drove a bunch of follow-on refactoring, including allowing me to remove cr_visible_orphan_mods from the CoreReader data type. I moved some of the RuleBase/RuleEnv stuff into GHC.Core.Rule. The reorganisation in the Simplifier improve compile times a bit (geom mean -0.1%), but T9961 is an outlier Metric Decrease: T9961
Diffstat (limited to 'libraries/base')
-rw-r--r--libraries/base/GHC/Real.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/libraries/base/GHC/Real.hs b/libraries/base/GHC/Real.hs
index aaff2ea3a9..4aee6ba720 100644
--- a/libraries/base/GHC/Real.hs
+++ b/libraries/base/GHC/Real.hs
@@ -701,11 +701,14 @@ half of y - 1 can be computed as y `quot` 2, optimising subtraction away.
Note [Inlining (^)
~~~~~~~~~~~~~~~~~~
-The INLINABLE pragma allows (^) to be specialised at its call sites.
+The INLINABLE [1] pragma allows (^) to be specialised at its call sites.
If it is called repeatedly at the same type, that can make a huge
difference, because of those constants which can be repeatedly
calculated.
+We don't inline until phase 1, to give a chance for the RULES
+"^2/Int" etc to fire first.
+
Currently the fromInteger calls are not floated because we get
\d1 d2 x y -> blah
after the gentle round of simplification.