summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-03-03 17:54:24 +0100
committerSylvain Henry <sylvain@haskus.fr>2021-04-06 18:34:01 +0200
commit173db7dee1fcda4c4c8c1b3ff1674785e9a51e7c (patch)
tree25d7b0cca9f3265220ad1b78128b5c5e3f47a08f
parent27090636b0c3f00daacde65f6cf8e80557dd6846 (diff)
downloadhaskell-173db7dee1fcda4c4c8c1b3ff1674785e9a51e7c.tar.gz
CoreTidy: handle special cases to preserve more sharing.wip/tidy-perf
Metric Decrease: T16577
-rw-r--r--compiler/GHC/Core/TyCo/Tidy.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/Core/TyCo/Tidy.hs b/compiler/GHC/Core/TyCo/Tidy.hs
index 47b90d356c..d25135af06 100644
--- a/compiler/GHC/Core/TyCo/Tidy.hs
+++ b/compiler/GHC/Core/TyCo/Tidy.hs
@@ -158,8 +158,9 @@ tidyTypes env tys = strictMap (tidyType env) tys
--
-- See Note [Strictness in tidyType and friends]
tidyType :: TidyEnv -> Type -> Type
-tidyType _ (LitTy n) = LitTy n
+tidyType _ t@(LitTy {}) = t -- Preserve sharing
tidyType env (TyVarTy tv) = TyVarTy $! tidyTyCoVarOcc env tv
+tidyType _ t@(TyConApp _ []) = t -- Preserve sharing if possible
tidyType env (TyConApp tycon tys) = TyConApp tycon $! tidyTypes env tys
tidyType env (AppTy fun arg) = (AppTy $! (tidyType env fun)) $! (tidyType env arg)
tidyType env ty@(FunTy _ w arg res) = let { !w' = tidyType env w