diff options
author | Simon Peyton Jones <simon.peytonjones@gmail.com> | 2022-03-11 16:55:38 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-07 12:57:21 -0400 |
commit | 83363c8b04837ee871a304cf85207cf79b299fb0 (patch) | |
tree | 714c6533cf3deba12d4204cdf0b2aa38b26933d4 /testsuite/tests | |
parent | 54b1882416558936d171d78749400b1c838b11b8 (diff) | |
download | haskell-83363c8b04837ee871a304cf85207cf79b299fb0.tar.gz |
Use prepareBinding in tryCastWorkerWrapper
As #21144 showed, tryCastWorkerWrapper was calling prepareRhs, and
then unconditionally floating the bindings, without the checks of
doFloatFromRhs. That led to floating an unlifted binding into
a Rec group.
This patch refactors prepareBinding to make these checks,
and do them uniformly across all calls. A nice improvement.
Other changes
* Instead of passing around a RecFlag and a TopLevelFlag; and sometimes
a (Maybe SimplCont) for join points, define a new Simplifier-specific
data type BindContext:
data BindContext = BC_Let TopLevelFlag RecFlag
| BC_Join SimplCont
and use it consistently.
* Kill off completeNonRecX by inlining it. It was only called in
one place.
* Add a wrapper simplImpRules for simplRules.
Compile time on T9630 drops by 4.7%; little else changes.
Metric Decrease:
T9630
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T21144.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/all.T | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T21144.hs b/testsuite/tests/simplCore/should_compile/T21144.hs new file mode 100644 index 0000000000..b4f8600fca --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T21144.hs @@ -0,0 +1,4 @@ +module T21144 where + +peps :: a ~ Double => a +peps = x where x = fromIntegral (floatDigits x) ** 2 diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 13a8602bb7..5a23e84c75 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -389,3 +389,6 @@ test('OpaqueNoSpecConstr', normal, compile, ['-O -ddump-simpl -dsuppress-uniques test('OpaqueNoSpecialise', normal, compile, ['-O -ddump-simpl -dsuppress-uniques']) test('OpaqueNoStrictArgWW', normal, compile, ['-O -fworker-wrapper-cbv -ddump-simpl -dsuppress-uniques']) test('OpaqueNoWW', normal, compile, ['-O -ddump-simpl -dsuppress-uniques']) + +test('T21144', normal, compile, ['-O']) + |