Kill non-deterministic foldUFM in TrieMap and TcAppMap
authorBartosz Nitka <niteria@gmail.com>
Wed, 4 May 2016 16:22:37 +0000 (09:22 -0700)
committerBartosz Nitka <niteria@gmail.com>
Wed, 4 May 2016 17:18:10 +0000 (10:18 -0700)
commitad4392c142696d5092533480a82ed65322e9d413
tree6b7dc893f6dcf0c87db84fef9c29e675a8db8095
parent763610e990207eaa143856fca411d5ad420651ed
Kill non-deterministic foldUFM in TrieMap and TcAppMap

Summary:
foldUFM introduces unnecessary non-determinism that actually
leads to different generated code as explained in
Note [TrieMap determinism].

As we're switching from UniqFM to UniqDFM here you might be
concerned about performance. There's nothing that ./validate
detects. nofib reports no change in Compile Allocations, but
Compile Time got better on some tests and worse on some,
yielding this summary:

        -1 s.d.                -----            -3.8%
        +1 s.d.                -----            +5.4%
        Average                -----            +0.7%

This is not a fair comparison as the order of Uniques
changes what GHC is actually doing. One benefit from making
this deterministic is also that it will make the
performance results more stable.

Full nofib results: P108

Test Plan: ./validate, nofib

Reviewers: goldfire, simonpj, simonmar, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2169

GHC Trac Issues: #4012
20 files changed:
compiler/basicTypes/NameEnv.hs
compiler/basicTypes/VarEnv.hs
compiler/coreSyn/TrieMap.hs
compiler/typecheck/TcSMonad.hs
testsuite/tests/ado/ado004.stderr
testsuite/tests/ghc-api/apirecomp001/apirecomp001.stderr
testsuite/tests/indexed-types/should_compile/T3017.stderr
testsuite/tests/parser/should_compile/T2245.stderr
testsuite/tests/partial-sigs/should_compile/ExtraConstraints1.stderr
testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr
testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr
testsuite/tests/partial-sigs/should_fail/InstantiatedNamedWildcardsInConstraints.stderr
testsuite/tests/partial-sigs/should_fail/WildcardInstantiations.stderr
testsuite/tests/rebindable/rebindable6.stderr
testsuite/tests/typecheck/should_compile/T10971a.stderr
testsuite/tests/typecheck/should_fail/T5300.stderr
testsuite/tests/typecheck/should_fail/T5853.stderr
testsuite/tests/typecheck/should_fail/tcfail171.stderr
testsuite/tests/typecheck/should_fail/tcfail204.stderr
testsuite/tests/warnings/should_compile/PluralS.stderr