[commit: ghc] wip/ghc-8.0-det: Make absentError not depend on uniques (06ca161)

git at git.haskell.org git at git.haskell.org
Mon Jul 18 17:57:58 UTC 2016


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

On branch  : wip/ghc-8.0-det
Link       : http://ghc.haskell.org/trac/ghc/changeset/06ca16125d9ea1bbb5d8c8f8c2e13c6d6217420c/ghc

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

commit 06ca16125d9ea1bbb5d8c8f8c2e13c6d6217420c
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Thu May 12 05:42:21 2016 -0700

    Make absentError not depend on uniques
    
    As explained in the comment it will cause changes in
    inlining if we don't suppress them.
    
    Test Plan: ./validate
    
    Reviewers: bgamari, austin, simonpj, goldfire, simonmar
    
    Reviewed By: simonmar
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2203
    
    GHC Trac Issues: #4012


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

06ca16125d9ea1bbb5d8c8f8c2e13c6d6217420c
 compiler/stranal/WwLib.hs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs
index 1472ead..09bc204 100644
--- a/compiler/stranal/WwLib.hs
+++ b/compiler/stranal/WwLib.hs
@@ -757,7 +757,14 @@ mk_absent_let dflags arg
   where
     arg_ty  = idType arg
     abs_rhs = mkRuntimeErrorApp aBSENT_ERROR_ID arg_ty msg
-    msg     = showSDoc dflags (ppr arg <+> ppr (idType arg))
+    msg     = showSDoc (gopt_set dflags Opt_SuppressUniques)
+                       (ppr arg <+> ppr (idType arg))
+              -- We need to suppress uniques here because otherwise they'd
+              -- end up in the generated code as strings. This is bad for
+              -- determinism, because with different uniques the strings
+              -- will have different lengths and hence different costs for
+              -- the inliner leading to different inlining.
+              -- See also Note [Unique Determinism] in Unique
 
 mk_seq_case :: Id -> CoreExpr -> CoreExpr
 mk_seq_case arg body = Case (Var arg) (sanitiseCaseBndr arg) (exprType body) [(DEFAULT, [], body)]



More information about the ghc-commits mailing list