summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-12-05 13:50:48 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2016-12-05 17:40:05 +0000
commite912310206e86169c920319f587d310c8b9cafe0 (patch)
tree381862828ee0d99f6f32b42cfaa286d11701b74c
parent6305674f310633d159a4df4e2e0d033a698599d1 (diff)
downloadhaskell-e912310206e86169c920319f587d310c8b9cafe0.tar.gz
Use isFamFreeTyCon now we have it
Refactoring only
-rw-r--r--compiler/typecheck/TcFlatten.hs12
-rw-r--r--compiler/types/TyCon.hs2
-rw-r--r--testsuite/tests/perf/compiler/all.T4
3 files changed, 8 insertions, 10 deletions
diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs
index 94fdfb8c3f..700412b4b5 100644
--- a/compiler/typecheck/TcFlatten.hs
+++ b/compiler/typecheck/TcFlatten.hs
@@ -19,7 +19,6 @@ import TyCoRep -- performs delicate algorithm on types
import Coercion
import Var
import VarEnv
-import NameEnv
import Outputable
import TcSMonad as TcS
import BasicTypes( SwapFlag(..) )
@@ -895,19 +894,16 @@ flatten_one (AppTy ty1 ty2)
role2 co2 xi2 ty2
role1 ) } -- output should match fmode
-flatten_one ty@(TyConApp tc tys)
+flatten_one (TyConApp tc tys)
-- Expand type synonyms that mention type families
-- on the RHS; see Note [Flattening synonyms]
| Just (tenv, rhs, tys') <- expandSynTyCon_maybe tc tys
, let expanded_ty = mkAppTys (substTy (mkTvSubstPrs tenv) rhs) tys'
= do { mode <- getMode
- ; let used_tcs = tyConsOfType rhs
; case mode of
- FM_FlattenAll | anyNameEnv isTypeFamilyTyCon used_tcs
- -> do { traceFlat "flatten_one syn expand" (ppr ty $$ ppr used_tcs)
- ; flatten_one expanded_ty }
- _ -> do { traceFlat "flatten_one syn no expand" (ppr ty)
- ; flatten_ty_con_app tc tys } }
+ FM_FlattenAll | not (isFamFreeTyCon tc)
+ -> flatten_one expanded_ty
+ _ -> flatten_ty_con_app tc tys }
-- Otherwise, it's a type function application, and we have to
-- flatten it away as well, and generate a new given equality constraint
diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs
index ebb18f0a4b..ec2f5d5a09 100644
--- a/compiler/types/TyCon.hs
+++ b/compiler/types/TyCon.hs
@@ -627,7 +627,7 @@ data TyCon
synIsTau :: Bool, -- True <=> the RHS of this synonym does not
-- have any foralls, after expanding any
-- nested synonyms
- synIsFamFree :: Bool -- True <=> the RHS of this synonym does mention
+ synIsFamFree :: Bool -- True <=> the RHS of this synonym does not mention
-- any type synonym families (data families
-- are fine), again after expanding any
-- nested synonyms
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 7ce6562064..0ccde15106 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -767,7 +767,7 @@ test('T9872c',
test('T9872d',
[ only_ways(['normal']),
compiler_stats_num_field('bytes allocated',
- [(wordsize(64), 506691240, 5),
+ [(wordsize(64), 478169352, 5),
# 2014-12-18 796071864 Initally created
# 2014-12-18 739189056 Reduce type families even more eagerly
# 2015-01-07 687562440 TrieMap leaf compression
@@ -775,6 +775,8 @@ test('T9872d',
# 2015-12-11 566134504 TypeInType; see #11196
# 2016-02-08 534693648 Improved a bit by tyConRolesRepresentational
# 2016-03-18 506691240 optimize Unify & zonking
+ # 2016-12-05 478169352 using tyConIsTyFamFree, I think, but only
+ # a 1% improvement 482 -> 478
(wordsize(32), 264566040, 5)
# some date 328810212
# 2015-07-11 350369584