[commit: ghc] master: Document codegen nondeterminism (27fc75b)

git at git.haskell.org git at git.haskell.org
Tue Jul 5 16:40:07 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/27fc75b2fea014006964eafe53b3ae17e058d75b/ghc

>---------------------------------------------------------------

commit 27fc75b2fea014006964eafe53b3ae17e058d75b
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Tue Jul 5 09:42:44 2016 -0700

    Document codegen nondeterminism
    
    We don't care about bit-for-bit reproducibility, so
    I'm just documenting this as a possible source.
    
    GHC Trac: #4012


>---------------------------------------------------------------

27fc75b2fea014006964eafe53b3ae17e058d75b
 compiler/stgSyn/CoreToStg.hs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/compiler/stgSyn/CoreToStg.hs b/compiler/stgSyn/CoreToStg.hs
index 273cbdb..2d9ca8c 100644
--- a/compiler/stgSyn/CoreToStg.hs
+++ b/compiler/stgSyn/CoreToStg.hs
@@ -43,6 +43,7 @@ import DynFlags
 import ForeignCall
 import Demand           ( isUsedOnce )
 import PrimOp           ( PrimCall(..) )
+import UniqFM
 
 import Data.Maybe    (isJust)
 import Control.Monad (liftM, ap)
@@ -1002,7 +1003,10 @@ lookupFVInfo fvs id
 
 -- Non-top-level things only, both type variables and ids
 getFVs :: FreeVarsInfo -> [Var]
-getFVs fvs = [id | (id, how_bound, _) <- varEnvElts fvs,
+getFVs fvs = [id | (id, how_bound, _) <- nonDetEltsUFM fvs,
+  -- It's OK to use nonDetEltsUFM here because we're not aiming for
+  -- bit-for-bit determinism.
+  -- See Note [Unique Determinism and code generation]
                     not (topLevelBound how_bound) ]
 
 getFVSet :: FreeVarsInfo -> VarSet



More information about the ghc-commits mailing list