summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2016-05-12 05:42:21 -0700
committerBartosz Nitka <niteria@gmail.com>2016-07-25 07:36:03 -0700
commit29c0807d23e78502ee05fad4055343d904e55c29 (patch)
tree667ae556d093000f6c39af9f7b87eb92cb1b2288
parent0234bfa6c15c3f49f60c288c3a29399105450ca0 (diff)
downloadhaskell-29c0807d23e78502ee05fad4055343d904e55c29.tar.gz
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 (cherry picked from commit 925b0aea8edc1761fcc16feba1601bea38422c92)
-rw-r--r--compiler/stranal/WwLib.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs
index 1472eadc26..09bc204b50 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)]