summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Opt/Arity.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-06-26 09:34:43 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2020-06-30 10:43:50 +0100
commitffd3254d5ea70470d49a8d43ccdcb2b5c01f4e91 (patch)
tree5f9671cd5c84ab81cbd6091884362890260f2540 /compiler/GHC/Core/Opt/Arity.hs
parenta3d69dc6c2134afe239caf4f881ba5542d2c2be0 (diff)
downloadhaskell-wip/T18395.tar.gz
Improve debug tracing for substitutionwip/T18395
This patch improves debug tracing a bit (#18395) * Remove the ancient SDoc argument to substitution, replacing it with a HasDebugCallStack constraint. The latter does the same job (indicate the call site) but much better. * Add HasDebugCallStack to simpleOptExpr, exprIsConApp_maybe I needed this to help nail the lookupIdSubst panic in #18326, #17784
Diffstat (limited to 'compiler/GHC/Core/Opt/Arity.hs')
-rw-r--r--compiler/GHC/Core/Opt/Arity.hs17
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/GHC/Core/Opt/Arity.hs b/compiler/GHC/Core/Opt/Arity.hs
index 5df571ee1c..8d51457ae0 100644
--- a/compiler/GHC/Core/Opt/Arity.hs
+++ b/compiler/GHC/Core/Opt/Arity.hs
@@ -1023,7 +1023,7 @@ etaInfoApp subst (Tick t e) eis
etaInfoApp subst expr _
| (Var fun, _) <- collectArgs expr
- , Var fun' <- lookupIdSubst (text "etaInfoApp" <+> ppr fun) subst fun
+ , Var fun' <- lookupIdSubst subst fun
, isJoinId fun'
= subst_expr subst expr
@@ -1132,13 +1132,16 @@ mkEtaWW orig_n ppr_orig_expr in_scope orig_ty
---------------
--- Don't use short-cutting substitution - we may be changing the types of join
--- points, so applying the in-scope set is necessary
--- TODO Check if we actually *are* changing any join points' types
-
+------------
subst_expr :: Subst -> CoreExpr -> CoreExpr
-subst_expr = substExpr (text "GHC.Core.Opt.Arity:substExpr")
+-- Apply a substitution to an expression. We use substExpr
+-- not substExprSC (short-cutting substitution) because
+-- we may be changing the types of join points, so applying
+-- the in-scope set is necessary.
+--
+-- ToDo: we could instead check if we actually *are*
+-- changing any join points' types, and if not use substExprSC.
+subst_expr = substExpr
--------------