Several small refactoring patches
This is a small collection of commits and minor refactorings which I have accumulated. None have their own tickets.
commit 38f73d99c7c4e4343cfa6ef9c4c97b59d05a87bc (HEAD -> wip/spj-refactor-Jul21, origin/wip/spj-refactor-Jul21)
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Thu Jul 22 23:50:43 2021 +0100
Make the occurrence analyser a bit stricter
occAnalArgs and occAnalApp are very heavily used functions, so it pays
to make them rather strict: fewer thunks constructed. All these
thunks are ultimately evaluated anyway.
This patch gives a welcome reduction compile time allocation of around
0.5% across the board. For T9961 it's a 2.2% reduction.
Metric Decrease:
T9961
commit 5ba7c2a202a9398ae8fd584a3c7a0326fec50312 (HEAD -> wip/spj-refactor-Jul21, origin/wip/spj-refactor-Jul21, HEAD-2)
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Thu Jun 24 11:25:40 2021 +0100
White space, spelling, and a tiny refactor
No change in behaviour
compiler/GHC/Core/Opt/Simplify/Env.hs | 9 ++++++---
compiler/GHC/Core/Unfold/Make.hs | 6 +++---
2 files changed, 9 insertions(+), 6 deletions(-)
commit 0f4adcd4e092245ccd91ab11da364807d303970d
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Thu Jun 24 11:30:53 2021 +0100
Extend the in-scope set to silence substExpr warnings
substExpr warns if it finds a LocalId that isn't in the in-scope set.
This patch extends the in-scope set to silence the warnings. (It has
no effect on behaviour.)
compiler/GHC/Core/SimpleOpt.hs | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
commit ef9e8a0e6b50766bcbbe3e3ec9d22b319698119c
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Mon Jun 21 11:51:02 2021 +0100
Improve postInlineUnconditionally
See Note [Use occ-anald RHS in postInlineUnconditionally].
This explains how to eliminate an extra round of simplification,
which can happen if postInlineUnconditionally uses a RHS
that is no occurrence-analysed.
This opportunity has been there for ages; I discovered it
when looking at a compile-time perf regression that happened
because the opportunity wasn't exploited.
compiler/GHC/Core/Opt/Simplify.hs | 43 +++++++++++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 14 deletions(-)
commit 4ca1c4caa4aa633454285925bfbba9cc9f240a6d
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Mon May 31 14:31:36 2021 +0100
Print out module name in "bailing out" message
compiler/GHC/Core/Opt/Pipeline.hs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
commit 3eae14a215bc2f12e9517d3b4ab02fc19e2135b0
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Sat May 29 22:51:16 2021 +0100
Fix smallEnoughToInline
I noticed that smallEnoughToInline said "no" to UnfWhen guidance,
which seems quite wrong -- those functions are particularly small.
compiler/GHC/Core/Unfold.hs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)