[commit: ghc] master: Make callToPats deterministic in SpecConstr (5b2b7e3)
git at git.haskell.org
git at git.haskell.org
Fri Dec 4 14:06:15 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/5b2b7e338c822c34f86e8bd3ff442a979711d1fe/ghc
>---------------------------------------------------------------
commit 5b2b7e338c822c34f86e8bd3ff442a979711d1fe
Author: Bartosz Nitka <bnitka at fb.com>
Date: Wed Dec 2 06:20:55 2015 -0800
Make callToPats deterministic in SpecConstr
This fixes a non-determinism bug where where depending on the
order of uniques allocated, the specialized workers would have different
order of arguments.
Compare:
```
$s$wgo_s1CN :: Int# -> Int -> Int#
[LclId, Arity=2, Str=DmdType <L,U><L,U>]
$s$wgo_s1CN =
\ (sc_s1CI :: Int#) (sc_s1CJ :: Int) ->
case tagToEnum# @ Bool (<=# sc_s1CI 0#) of _ [Occ=Dead] {
False ->
$wgo_s1BU (Just @ Int (I# (-# sc_s1CI 1#))) (Just @ Int sc_s1CJ);
True -> 0#
}
```
vs
```
$s$wgo_s18mTj :: Int -> Int# -> Int#
[LclId, Arity=2, Str=DmdType <L,U><L,U>]
$s$wgo_s18mTj =
\ (sc_s18mTn :: Int) (sc_s18mTo :: Int#) ->
case tagToEnum# @ Bool (<=# sc_s18mTo 0#) of _ [Occ=Dead] {
False ->
$wgo_s18mUc
(Just @ Int (I# (-# sc_s18mTo 1#))) (Just @ Int sc_s18mTn);
True -> 0#
}
```
Test Plan:
I've added a new testcase
./validate
Reviewers: simonmar, simonpj, austin, goldfire, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1508
GHC Trac Issues: #4012
>---------------------------------------------------------------
5b2b7e338c822c34f86e8bd3ff442a979711d1fe
compiler/specialise/SpecConstr.hs | 10 ++++--
.../determinism/simplCore/should_compile/Makefile | 13 +++++++
.../determinism/simplCore/should_compile/all.T | 4 +++
.../simplCore/should_compile/determ006.stdout | 2 ++
.../simplCore/should_compile/spec-inline-determ.hs | 40 ++++++++++++++++++++++
.../tests/simplCore/should_compile/T4908.stderr | 18 +++++-----
.../tests/simplCore/should_compile/T7865.stdout | 2 +-
.../simplCore/should_compile/spec-inline.stderr | 26 +++++++-------
8 files changed, 90 insertions(+), 25 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5b2b7e338c822c34f86e8bd3ff442a979711d1fe
More information about the ghc-commits
mailing list