[commit: ghc] master: Remove unnecessary check in simplCast (2a5bdd9)
git at git.haskell.org
git at git.haskell.org
Fri Apr 20 22:05:31 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/2a5bdd9adb1cb4afecd3303f0cfcc224be5ce745/ghc
>---------------------------------------------------------------
commit 2a5bdd9adb1cb4afecd3303f0cfcc224be5ce745
Author: Tobias Dammers <tdammers at gmail.com>
Date: Fri Apr 20 16:38:34 2018 -0400
Remove unnecessary check in simplCast
The coercion optimizer will take care of it anyway, and the check is
prohibitively expensive.
See Trac #14737.
Reviewers: bgamari
Subscribers: simonpj, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4568
>---------------------------------------------------------------
2a5bdd9adb1cb4afecd3303f0cfcc224be5ce745
compiler/coreSyn/CoreOpt.hs | 12 ++++++++----
testsuite/tests/perf/compiler/all.T | 12 ++++++++----
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs
index 372c2ea..f1ff68d 100644
--- a/compiler/coreSyn/CoreOpt.hs
+++ b/compiler/coreSyn/CoreOpt.hs
@@ -958,8 +958,10 @@ pushCoTyArg :: CoercionR -> Type -> Maybe (Type, Maybe CoercionR)
-- If the returned coercion is Nothing, then it would have been reflexive;
-- it's faster not to compute it, though.
pushCoTyArg co ty
- | tyL `eqType` tyR
- = Just (ty, Nothing)
+ -- The following is inefficient - don't do `eqType` here, the coercion
+ -- optimizer will take care of it. See Trac #14737.
+ -- -- | tyL `eqType` tyR
+ -- -- = Just (ty, Nothing)
| isForAllTy tyL
= ASSERT2( isForAllTy tyR, ppr co $$ ppr ty )
@@ -991,8 +993,10 @@ pushCoValArg :: CoercionR -> Maybe (Coercion, Maybe Coercion)
-- If the second returned Coercion is actually Nothing, then no cast is necessary;
-- the returned coercion would have been reflexive.
pushCoValArg co
- | tyL `eqType` tyR
- = Just (mkRepReflCo arg, Nothing)
+ -- The following is inefficient - don't do `eqType` here, the coercion
+ -- optimizer will take care of it. See Trac #14737.
+ -- -- | tyL `eqType` tyR
+ -- -- = Just (mkRepReflCo arg, Nothing)
| isFunTy tyL
, (co1, co2) <- decomposeFunCo Representational co
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index ba36b41..2001cda 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -747,7 +747,7 @@ test('T9020',
# 2014-07-31: 343005716 (Windows) (general round of updates)
# 2017-03-24: 249904136 (x86/Linux, 64-bit machine)
- (wordsize(64), 423163832, 10)])
+ (wordsize(64), 562206104, 10)])
# prev: 795469104
# 2014-07-17: 728263536 (general round of updates)
# 2014-09-10: 785871680 post-AMP-cleanup
@@ -761,6 +761,7 @@ test('T9020',
# Program size collapses in first simplification
# 2017-03-31: 493596312 Fix memory leak in simplifier
# 2017-04-28: 423163832 Remove exponential behaviour in simplifier
+ # 2018-04-09: 562206104 Inexplicable, collateral of #14737
],
compile,[''])
@@ -1039,7 +1040,7 @@ test('T12227',
test('T12425',
[ only_ways(['optasm']),
compiler_stats_num_field('bytes allocated',
- [(wordsize(64), 134780272, 5),
+ [(wordsize(64), 141952368, 5),
# initial: 125831400
# 2017-01-18: 133380960 Allow top-level string literals in Core
# 2017-02-17: 153611448 Type-indexed Typeable
@@ -1047,6 +1048,7 @@ test('T12425',
# 2017-03-21: 134334800 Unclear
# 2017-04-28: 127500136 Remove exponential behaviour in simplifier
# 2017-05-23: 134780272 Addition of llvm-targets in dynflags (D3352)
+ # 2018-04-15: 141952368 Collateral of #14737
]),
],
compile,
@@ -1116,7 +1118,7 @@ test('T13056',
test('T12707',
[ compiler_stats_num_field('bytes allocated',
- [(wordsize(64), 1163821528, 5),
+ [(wordsize(64), 1237898376, 5),
# initial: 1271577192
# 2017-01-22: 1348865648 Allow top-level strings in Core
# 2017-01-31: 1280336112 Join points (#12988)
@@ -1124,6 +1126,7 @@ test('T12707',
# 2017-02-23: 1386110512 Type-indexed Typeable? (on Darwin)
# 2017-03-02: 1231809592 Drift from recent simplifier improvements
# 2017-05-14: 1163821528 (amd64/Linux) Two-pass CmmLayoutStack
+ # 2018-04-09: 1237898376 Inexplicable, collateral of #14737
]),
],
compile,
@@ -1235,9 +1238,10 @@ test('T14697',
test('T14683',
[ compiler_stats_num_field('bytes allocated',
- [(wordsize(64), 14675353056, 10),
+ [(wordsize(64), 10521594688, 10),
# initial: 25189145632
# 2018-04-19: 14675353056 Cache NthCo role (#14683)
+ # 2018-04-20: 10521594688 Remove unnecessary check in simplCast
]),
],
multimod_compile,
More information about the ghc-commits
mailing list