summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2023-03-10 16:04:41 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-03-10 23:25:25 -0500
commitec263a59b886ea616dabce349df7a377d5356dd5 (patch)
tree3fcb08255b4736f7752c445c8415957eb09555cb
parentbab232795865e9abb82b75c7e72329778e23a345 (diff)
downloadhaskell-ec263a59b886ea616dabce349df7a377d5356dd5.tar.gz
Simplify: Move `wantEtaExpansion` before expensive `do_eta_expand` check
There is no need to run arity analysis and what not if we are not in a Simplifier phase that eta-expands or if we don't want to eta-expand the expression in the first place. Purely a refactoring with the goal of improving compiler perf.
-rw-r--r--compiler/GHC/Core/Opt/Simplify/Utils.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/GHC/Core/Opt/Simplify/Utils.hs b/compiler/GHC/Core/Opt/Simplify/Utils.hs
index ffecebd876..3a1dd75d1f 100644
--- a/compiler/GHC/Core/Opt/Simplify/Utils.hs
+++ b/compiler/GHC/Core/Opt/Simplify/Utils.hs
@@ -1859,11 +1859,12 @@ tryEtaExpandRhs :: SimplEnv -> BindContext -> OutId -> OutExpr
-> SimplM (ArityType, OutExpr)
-- See Note [Eta-expanding at let bindings]
tryEtaExpandRhs env bind_cxt bndr rhs
- | do_eta_expand -- If the current manifest arity isn't enough
- -- (never true for join points)
- , seEtaExpand env -- and eta-expansion is on
- , wantEtaExpansion rhs
- = -- Do eta-expansion.
+ | seEtaExpand env -- If Eta-expansion is on
+ , wantEtaExpansion rhs -- and we'd like to eta-expand e
+ , do_eta_expand -- and e's manifest arity is lower than
+ -- what it could be
+ -- (never true for join points)
+ = -- Do eta-expansion.
assertPpr( not (isJoinBC bind_cxt) ) (ppr bndr) $
-- assert: this never happens for join points; see GHC.Core.Opt.Arity
-- Note [Do not eta-expand join points]